(self, pe: pefile.PE, image_base: int)
| 801 | self.ql.os.KUSER_SHARED_DATA = kusd_obj |
| 802 | |
| 803 | def init_security_cookie(self, pe: pefile.PE, image_base: int): |
| 804 | if not Process.directory_exists(pe, 'IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG'): |
| 805 | return |
| 806 | |
| 807 | cookie_rva = pe.DIRECTORY_ENTRY_LOAD_CONFIG.struct.SecurityCookie - pe.OPTIONAL_HEADER.ImageBase |
| 808 | |
| 809 | # get a random cookie value but keep the two most significant bytes zeroes |
| 810 | # |
| 811 | # rol rcx, 10h ; rcx = cookie |
| 812 | # test cx, 0FFFFh |
| 813 | cookie = secrets.randbits(self.ql.arch.bits - 16) |
| 814 | |
| 815 | self.ql.mem.write_ptr(cookie_rva + image_base, cookie) |
| 816 | |
| 817 | class QlLoaderPE(QlLoader, Process): |
| 818 | def __init__(self, ql: Qiling, libcache: bool): |
no test coverage detected