shellcode.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:covertutils 作者: operatorequals 项目源码 文件源码
def init(storage) :

    import ctypes
    import ctypes.wintypes as wintypes

    class __PROCESS_INFORMATION(ctypes.Structure):
        """see:
    http://msdn.microsoft.com/en-us/library/windows/desktop/ms684873(v=vs.85).aspx
    """
        _fields_ = [("hProcess",    wintypes.HANDLE),
                    ("hThread",     wintypes.HANDLE),
                    ("dwProcessId", wintypes.DWORD),
                    ("dwThreadId",  wintypes.DWORD),]
    wintypes.PROCESS_INFORMATION = __PROCESS_INFORMATION

    pid = wintypes.PROCESS_INFORMATION().dwProcessId
    PROCESS_ALL_ACCESS = (0x000F0000|0x00100000|0xFFF)
    handle = ctypes.windll.kernel32.OpenProcess(
                                        PROCESS_ALL_ACCESS,
                                        False,
                                        pid
                                        )
    storage['process_pid'] = pid
    storage['process_handle'] = handle
    ModuleHandle = ctypes.windll.kernel32.GetModuleHandleA("kernel32.dll")
    LoadLibraryA = ctypes.windll.kernel32.GetProcAddress(
                                wintypes.HANDLE(ModuleHandle),
                                "LoadLibraryA",
                                )
    storage['LoadLibraryA'] = LoadLibraryA
    return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号