From 03e252b53af972c0404eaa94630c6d0b7b184271 Mon Sep 17 00:00:00 2001 From: hakril Date: Mon, 5 Mar 2018 01:06:30 +0100 Subject: [PATCH] Upgrade to sphinx 1.7.1 + small css fix + review/update/refactor doc samples --- docs/source/_static/css/mbasic.css | 25 + docs/source/conf.py | 6 +- docs/source/sample.rst | 611 ++---------------- .../samples_output/alpc_advanced_alpc.txt | 87 +++ .../samples_output/alpc_simple_alpc.txt | 12 + .../samples_output/com_com_inetfwpolicy2.txt | 15 + .../samples_output/crypto_certificate.txt | 33 + .../source/samples_output/crypto_wintrust.txt | 15 + docs/source/samples_output/debug_attach.txt | 15 + .../samples_output/debug_debug_functionbp.txt | 11 + .../debug_debugger_membp_singlestep.txt | 11 + .../debug_debugger_print_LdrLoaddll.txt | 24 + .../samples_output/debug_local_debugger.txt | 8 + .../source/samples_output/network_network.txt | 16 + .../process_current_process.txt | 12 + .../samples_output/process_iat_hook.txt | 15 + docs/source/samples_output/process_peb.txt | 23 + .../samples_output/process_remote_process.txt | 30 + .../samples_output/process_veh_segv.txt | 19 + .../samples_output/registry_registry.txt | 27 + docs/source/samples_output/rpc_lsass.txt | 36 ++ docs/source/samples_output/system.txt | 39 ++ docs/source/samples_output/test_code.txt | 82 +++ .../source/samples_output/wmi_wmi_request.txt | 15 + samples/alpc/advanced_alpc.py | 6 +- samples/crypto/encryption_demo.py | 2 +- samples/debug/debugger_print_LdrLoaddll.py | 6 +- samples/process/remote_process.py | 2 +- windows/injection.py | 2 +- 29 files changed, 637 insertions(+), 568 deletions(-) create mode 100644 docs/source/_static/css/mbasic.css create mode 100644 docs/source/samples_output/alpc_advanced_alpc.txt create mode 100644 docs/source/samples_output/alpc_simple_alpc.txt create mode 100644 docs/source/samples_output/com_com_inetfwpolicy2.txt create mode 100644 docs/source/samples_output/crypto_certificate.txt create mode 100644 docs/source/samples_output/crypto_wintrust.txt create mode 100644 docs/source/samples_output/debug_attach.txt create mode 100644 docs/source/samples_output/debug_debug_functionbp.txt create mode 100644 docs/source/samples_output/debug_debugger_membp_singlestep.txt create mode 100644 docs/source/samples_output/debug_debugger_print_LdrLoaddll.txt create mode 100644 docs/source/samples_output/debug_local_debugger.txt create mode 100644 docs/source/samples_output/network_network.txt create mode 100644 docs/source/samples_output/process_current_process.txt create mode 100644 docs/source/samples_output/process_iat_hook.txt create mode 100644 docs/source/samples_output/process_peb.txt create mode 100644 docs/source/samples_output/process_remote_process.txt create mode 100644 docs/source/samples_output/process_veh_segv.txt create mode 100644 docs/source/samples_output/registry_registry.txt create mode 100644 docs/source/samples_output/rpc_lsass.txt create mode 100644 docs/source/samples_output/system.txt create mode 100644 docs/source/samples_output/test_code.txt create mode 100644 docs/source/samples_output/wmi_wmi_request.txt diff --git a/docs/source/_static/css/mbasic.css b/docs/source/_static/css/mbasic.css new file mode 100644 index 0000000..1440e00 --- /dev/null +++ b/docs/source/_static/css/mbasic.css @@ -0,0 +1,25 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- general body styles --------------------------------------------------- */ + +div.body { + min-width: 450px; + max-width: none; +} + +div.admonition-todo { + border-top: 2px solid red; + border-bottom: 2px solid red; + border-left: 2px solid red; + border-right: 2px solid red; + background-color: #ff6347 +} \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 42fbe79..7e92a2a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -41,9 +41,11 @@ extensions = [ 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode', 'sphinx.ext.autodoc', + 'sphinx.ext.todo', ] autodoc_default_flags = ['inherited-members'] +todo_include_todos = True # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -364,7 +366,7 @@ epub_exclude_files = ['search.html'] # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'http://docs.python.org/': None} +intersphinx_mapping = {'https://docs.python.org/2.7': None} def get_rst(app, what, name, obj, options, lines): @@ -374,4 +376,4 @@ def get_rst2(app, what, name, obj, options, signature, return_annotation): pass def setup(app): - pass + app.add_stylesheet('css/mbasic.css') # may also be an URL diff --git a/docs/source/sample.rst b/docs/source/sample.rst index 60543e3..7544960 100644 --- a/docs/source/sample.rst +++ b/docs/source/sample.rst @@ -1,4 +1,3 @@ - .. _sample_of_code: Samples of code @@ -14,20 +13,10 @@ Processes .. literalinclude:: ..\..\samples\process\current_process.py -Output:: +Output + +.. literalinclude:: samples_output\process_current_process.txt - (cmd λ) python32.exe process\current_process.py - current process is - current process is a <32> bits process - current process is a SysWow64 process ? - current process pid <8264> and ppid <4100> - Here are the current process threads: <[]> - Let's execute some native code ! (0x41 + 1) - Native code returned <0x42> - Allocating memory in current process - Allocated memory is at <0xd60000> - Writing 'SOME STUFF' in allocation memory - Reading memory : <'SOME STUFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'> .. _sample_remote_process: @@ -36,38 +25,11 @@ Remote process : :class:`WinProcess` .. literalinclude:: ..\..\samples\process\remote_process.py -Output:: - (cmd λ) python.exe process\remote_process.py - Creating a notepad - Looking for notepads in the processes - They are currently <1> notepads running on the system - Let's play with our notepad: <> - Our notepad pid is 2044 - Our notepad is a <32> bits process - Our notepad is a SysWow64 process ? - Our notepad have threads ! <[, , ...]> - Exploring our notepad PEB ! - Command line is - Here are 3 loaded modules: [, , ] - Allocating memory in our notepad - Allocated memory is at <0x6f80000> - Writing 'SOME STUFF' in allocated memory - Reading allocated memory : <'SOME STUFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'> - Execution some native code in our notepad (write 0x424242 at allocated address + return 0x1337) - Executing native code ! - Return code = 0x1337L - Reading allocated memory : <'BBBB STUFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'> - Executing python code ! - Reading allocated memory : <'HELLO FROM notepad\x00\x00'> - Trying to import in remote module 'FAKE_MODULE' - Remote ERROR ! - Traceback (most recent call last): - File "", line 3, in - File "", line 2, in func - ImportError: No module named FAKE_MODULE +Output + +.. literalinclude:: samples_output\process_remote_process.txt - That's all ! killing the notepad .. _sample_peb_exploration: @@ -77,31 +39,10 @@ Output:: .. literalinclude:: ..\..\samples\process\peb.py -Output:: +Output + +.. literalinclude:: samples_output\process_peb.txt - (cmd λ) python.exe process\peb.py - Exploring the current process PEB - PEB is <> - Commandline object is - Commandline string is u'python.exe peb.py ' - Imagepath - Printing some modules: - - - - - - === K32 === - Looking for kernel32.dll - Kernel32 module: - Module name = | Fullname = - Kernel32 is loaded at address 0x774c0000 - === K32 PE === - PE Representation of k32: - Here are some exports {0: 2001566688L, u'CreateFileA': 2001635616L, 42: 2001647872L, u'VirtualAlloc': 2001570704L} - Import DLL dependancies are (without api-*): [u'ntdll.dll', u'kernelbase.dll'] - IAT Entry for ntdll!NtCreateFile = | addr = 0x77541128L - Sections: [, , , , ] .. _sample_iat_hook: @@ -110,23 +51,10 @@ IAT hooking .. literalinclude:: ..\..\samples\process\iat_hook.py -Output:: +Output - (cmd λ) python process\iat_hook.py - Asking for - Hook called | hKey = 0x12d687 | lpSubKey = - Secret key asked, returning magic handle 0x12345678 - Result = 0x12345678 +.. literalinclude:: samples_output\process_iat_hook.txt - Asking for - Hook called | hKey = 0x12d687 | lpSubKey = - Asked for a failing key: returning 0x2a - WindowsError(42, 'Windows Error 0x2A') - - Asking for - Hook called | hKey = 0x80000001L | lpSubKey = - Non-secret key : calling normal function - Result = 0x108 .. _sample_system: @@ -136,48 +64,9 @@ Output:: .. literalinclude:: ..\..\samples\system.py -Output:: - - (cmd λ) python system.py - Basic system infos: - version = (6, 3) - bitness = 64 - computer_name = HAKRIL-PC - product_type = VER_NT_WORKSTATION(0x1L) - version_name = Windows 8.1 - - There is 117 processes - There is 1246 threads - - Dumping first logical drive: - - name = C:\ - type = DRIVE_FIXED(0x3L) - path = \Device\HarddiskVolume2 - - Dumping first service: - - name = ACPI - description = Microsoft ACPI Driver - status = ServiceStatus(type=SERVICE_KERNEL_DRIVER(0x1L), state=SERVICE_RUNNING(0x4L), control_accepted=1L, flags=0L) - process = None - - Finding a service in a user process: - - name = Appinfo - description = Application Information - status = ServiceStatus(type=SERVICE_WIN32_SHARE_PROCESS(0x20L), state=SERVICE_RUNNING(0x4L), control_accepted=129L, flags=0L) - process = - - Enumerating handles: - There are 40664 handles: - First handle is: in process pid=4> - Enumerating handles of the current process: - There are 255 handles for this process - Looking for a File handle: - Handle is in process pid=14340> - Name is <\Device\ConDrv> +Output +.. literalinclude:: samples_output\system.txt .. _sample_network_exploration: @@ -187,24 +76,9 @@ Output:: .. literalinclude:: ..\..\samples\network\network.py -Output:: +Output-New - (cmd λ) python.exe network\network.py - Working on ipv4 - == Listening == - Some listening connections: [, , ] - Listening ports are : [80, 135, 443, 445, 902, 912, 5357, 49152, 49153, 49154, 49155, 49157, 49159, 8307, 25340, 139, 139] - == Established == - Some established connections: [ 127.0.0.1:49472>, 127.0.0.1:49174>, 127.0.0.1:49173>] - == connection to localhost:80 == - Our connection is [ 127.0.0.1:80>] - Sending YOP - Closing socket - Sending LAIT - Traceback (most recent call last): - File ".\network.py", line 45, in - s.send("LAIT") - socket.error: [Errno 10054] An existing connection was forcibly closed by the remote host +.. literalinclude:: samples_output\network_network.txt .. _sample_registry: @@ -214,36 +88,9 @@ Output:: .. literalinclude:: ..\..\samples\registry\registry.py -Output:: +Output - (cmd λ) python.exe registry\registry.py - Registry is <> - HKEY_CURRENT_USER is <> - HKEY_CURRENT_USER subkeys names are: - ['AppEvents', - 'AppXBackupContentType', - 'Console', - 'Control Panel', - 'Environment', - 'EUDC', - 'Identities', - 'Keyboard Layout', - 'Network', - 'Printers', - 'Software', - 'System', - 'Volatile Environment'] - Opening 'Software' in HKEY_CURRENT_USER: - We can also open it in one access: - Looking at CurrentVersion - Key is - values are: - [KeyValue(name='SoftwareType', value=u'System', type=1), - KeyValue(name='RegisteredOwner', value=u'hakril', type=1), - KeyValue(name='InstallDate', value=0, type=4), - ... - KeyValue(name='PathName', value=u'C:\\Windows', type=1)] - registered owner = +.. literalinclude:: samples_output\registry_registry.txt .. _sample_wintrust: @@ -253,23 +100,10 @@ Output:: .. literalinclude:: ..\..\samples\crypto\wintrust.py -Output:: +Output + +.. literalinclude:: samples_output\crypto_wintrust.txt - (cmd λ) python crypto\wintrust.py - Checking signature of - is_signed: - check_signature: <0> - full_signature_information: - * signed - * catalog - * catalogsigned - * additionalinfo <0> - Checking signature of some loaded DLL - : False (TRUST_E_NOSIGNATURE(0x800b0100L)) - : True - : True - : True - : False (TRUST_E_NOSIGNATURE(0x800b0100L)) .. _sample_vectoredexception: @@ -281,27 +115,10 @@ In local process .. literalinclude:: ..\..\samples\process\veh_segv.py -Output:: +Output - (cmd λ) python.exe process\veh_segv.py - Protected page is at <0x1db0000> - Setting page protection to +.. literalinclude:: samples_output\process_veh_segv.txt - ==Entry of VEH handler== - Instr at 0x1d1ab574 accessed to addr 0x1db0000 - Resetting page protection to - ==Entry of VEH handler== - Exception of type EXCEPTION_SINGLE_STEP(0x80000004L) - Resetting page protection to - Value 1 read - - ==Entry of VEH handler== - Instr at 0x1d1ab574 accessed to addr 0x1db0010 - Resetting page protection to - ==Entry of VEH handler== - Exception of type EXCEPTION_SINGLE_STEP(0x80000004L) - Resetting page protection to - Value 2 read In remote process @@ -347,25 +164,11 @@ Debugging .. literalinclude:: ..\..\samples\debug\debugger_print_LdrLoaddll.py -Ouput:: - (cmd λ) python.exe debug\debugger_print_LdrLoaddll.py - Loading - Got exception EXCEPTION_BREAKPOINT(0x80000003L) at 0x77a73bad - Loading - Loading - Loading - Loading - Loading - Loading - Loading - Loading - Loading - Loading - Loading - Loading - Loading - Ask to load : exiting process +Output + +.. literalinclude:: samples_output\debug_debugger_print_LdrLoaddll.txt + Single stepping @@ -373,19 +176,9 @@ Single stepping .. literalinclude:: ..\..\samples\debug\debugger_membp_singlestep.py -Ouput:: +Output - (cmd λ) python.exe debug\debugger_membp_singlestep.py - Got exception EXCEPTION_BREAKPOINT(0x80000003L) at 0x77ae3c7d - Instruction at <0x8d0006> wrote at <0x8e0000> - Got single_step EXCEPTION_SINGLE_STEP(0x80000004L) at 0x8d000c - Got single_step EXCEPTION_SINGLE_STEP(0x80000004L) at 0x8d0011 - Instruction at <0x8d0011> wrote at <0x8e0004> - Got single_step EXCEPTION_SINGLE_STEP(0x80000004L) at 0x8d0017 - Got single_step EXCEPTION_SINGLE_STEP(0x80000004L) at 0x8d001c - Got single_step EXCEPTION_SINGLE_STEP(0x80000004L) at 0x8d0022 - Got single_step EXCEPTION_SINGLE_STEP(0x80000004L) at 0x8d0023 - No more single step: exiting +.. literalinclude:: samples_output\debug_debugger_membp_singlestep.txt :class:`windows.debug.FunctionBP` @@ -393,19 +186,10 @@ Ouput:: .. literalinclude:: ..\..\samples\debug\debug_functionbp.py -Ouput:: +Output - (cmd λ) python.exe debug\debug_functionbp.py - NtCreateFile of <\??\C:\Windows\syswow64\en-US\calc.exe.mui>: handle = 0xac - Handle manually found! typename=, name=<\Device\HarddiskVolume2\Windows\SysWOW64\en-US\calc.exe.mui> +.. literalinclude:: samples_output\debug_debug_functionbp.txt - NtCreateFile of <\Device\DeviceApi\CMApi>: handle = 0x108 - Handle manually found! typename=, name=<\Device\DeviceApi> - - NtCreateFile of <\??\C:\Windows\Fonts\staticcache.dat>: handle = 0x154 - Handle manually found! typename=, name=<\Device\HarddiskVolume2\Windows\Fonts\StaticCache.dat> - - Exiting process .. _sample_debugger_attach: @@ -414,25 +198,9 @@ Ouput:: .. literalinclude:: ..\..\samples\debug\attach.py -Ouput:: - - (cmd λ) python.exe debug\attach.py - Finding process with pid <11392> - Target is - Debugger attached: - - NtCreateFile of <\??\C:\Windows\Fonts\staticcache.dat>: handle = 0x288 - Handle manually found! typename=, name=<\Device\HarddiskVolume4\Windows\Fonts\StaticCache.dat> - - NtCreateFile of <\??\C:\WINDOWS\Registration\R000000000015.clb>: handle = 0x320 - Handle manually found! typename=, name=<\Device\HarddiskVolume4\Windows\Registration\R000000000015.clb> - - NtCreateFile of <\??\C:\WINDOWS\Globalization\Sorting\sortdefault.nls>: handle = 0x334 - Handle manually found! typename=, name=<\Device\HarddiskVolume4\Windows\Globalization\Sorting\SortDefault.nls> - - Exiting process - +Output +.. literalinclude:: samples_output\debug_attach.txt @@ -442,90 +210,9 @@ Native code tester .. literalinclude:: ..\..\samples\test_code.py -Ouput:: +Ouput - (cmd λ) python.exe test_code.py "mov eax, 0x42424242" "eax=0x11223344" - Testing x86 code - Startup context is: - Eip -> 0x3f0000L - Esp -> 0x3bfae4L - Eax -> 0x11223344L - Ebx -> 0x5a6000L - Ecx -> 0x0L - Edx -> 0x0L - Ebp -> 0x0L - Edi -> 0x0L - Esi -> 0x0L - EFlags -> 0x202L - EEflags(0x202L:IF) - ==Post-exec context== - Eip -> 0x3f0007L - Esp -> 0x3bfae4L - Eax -> 0x42424242L - Ebx -> 0x5a6000L - Ecx -> 0x0L - Edx -> 0x0L - Ebp -> 0x0L - Edi -> 0x0L - Esi -> 0x0L - EFlags -> 0x202L - EEflags(0x202L:IF) - - ==DIFF== - Eip: 0x3f0000 -> 0x3f0007 (+0x7) - Eax: 0x11223344 -> 0x42424242 (+0x31200efe) - - - (cmd λ) python64 test_code.py --x64 "mov r15, 0x11223344; push r14; call r15" "rcx=1; r14=0x4242424243434343" - Testing x64 code - Startup context is: - Rip -> 0x205a1d60000L - Rsp -> 0xe24a88fa88L - Rax -> 0x0L - Rbx -> 0x0L - Rcx -> 0x1L - Rdx -> 0xe24aaf9000L - Rbp -> 0x0L - Rdi -> 0x0L - Rsi -> 0x0L - R8 -> 0x0L - R9 -> 0x0L - R10 -> 0x0L - R11 -> 0x0L - R12 -> 0x0L - R13 -> 0x0L - R14 -> 0x4242424243434343L - R15 -> 0x0L - EFlags -> 0x200L - EEflags(0x200L:IF) - ==Post-exec context== - Rip -> 0x11223344L - Rsp -> 0xe24a88fa78L - Rax -> 0x0L - Rbx -> 0x0L - Rcx -> 0x1L - Rdx -> 0xe24aaf9000L - Rbp -> 0x0L - Rdi -> 0x0L - Rsi -> 0x0L - R8 -> 0x0L - R9 -> 0x0L - R10 -> 0x0L - R11 -> 0x0L - R12 -> 0x0L - R13 -> 0x0L - R14 -> 0x4242424243434343L - R15 -> 0x11223344L - EFlags -> 0x10202L - EEflags(0x10202L:IF|RF) - at <0x11223344> - ==DIFF== - Rip: 0x205a1d60000 -> 0x11223344 (-0x20590b3ccbc) - Rsp: 0xe24a88fa88 -> 0xe24a88fa78 (-0x10) - R15: 0x0 -> 0x11223344 (+0x11223344) - EFlags: 0x200 -> 0x10202 (+0x10002) - Negative Stack: dumping: - E24A88FA88 0C 00 D6 A1 05 02 00 00 43 43 43 43 42 42 42 42 ........CCCCBBBB +.. literalinclude:: samples_output\test_code.txt .. _sample_local_debugger: @@ -539,16 +226,9 @@ In current process .. literalinclude:: ..\..\samples\debug\local_debugger.py -Ouput:: +Output - (cmd λ) python.exe debug\local_debugger.py - Code addr = 0xcf0002 - GOT AN HXBP at 0xcf0002 - EXCEPTION !!!! Got a EXCEPTION_SINGLE_STEP(0x80000004L) at 0xcf0003 - EXCEPTION !!!! Got a EXCEPTION_SINGLE_STEP(0x80000004L) at 0xcf0004 - EXCEPTION !!!! Got a EXCEPTION_SINGLE_STEP(0x80000004L) at 0xcf0005 - EXCEPTION !!!! Got a EXCEPTION_SINGLE_STEP(0x80000004L) at 0x770d7c04 - Done! +.. literalinclude:: samples_output\debug_local_debugger.txt In remote process @@ -556,6 +236,7 @@ In remote process .. literalinclude:: ..\..\samples\debug\local_debugger_remote_process.py + Ouput:: (cmd λ) python.exe debug\local_debugger_remote_process.py @@ -590,26 +271,10 @@ WMI requests .. literalinclude:: ..\..\samples\wmi\wmi_request.py +Output -Ouput:: +.. literalinclude:: samples_output\wmi_wmi_request.txt - (cmd λ) python wmi\wmi_request.py - WMI requester is - Selecting * from 'Win32_Process' - They are <92> processes - Looking for ourself via pid - Some info about our process: - * Name -> python.exe - * ProcessId -> 7968 - * OSName -> Microsoft Windows 8.1 Pro|C:\Windows|\Device\Harddisk0\Partition2 - * UserModeTime -> 2812500 - * WindowsVersion -> 6.3.9600 - * CommandLine -> python.exe .\samples\wmi_request.py - : + * {'Caption': u'C:', 'FreeSpace': u'15900839936', 'FileSystem': u'NTFS'} + * {'Caption': u'D:', 'FreeSpace': u'301635821568', 'FileSystem': u'NTFS'} diff --git a/samples/alpc/advanced_alpc.py b/samples/alpc/advanced_alpc.py index ebdcdfb..00c4e86 100644 --- a/samples/alpc/advanced_alpc.py +++ b/samples/alpc/advanced_alpc.py @@ -1,3 +1,4 @@ +import sys import multiprocessing import windows.alpc @@ -67,9 +68,10 @@ def full_alpc_server(): # - Send the same message with modified data # - Recreate a Message and copy the MessageId msg.data = "REQUEST '{0}' DONE".format(msg.data) + sys.stdout.flush() server.send(msg) else: - raise ValueError("Unexpected message type") + print ValueError("Unexpected message type <{0}>".format(msg.type & 0xfff)) def send_message_with_handle(client): @@ -135,6 +137,7 @@ def alpc_client(): send_message_with_handle(client) send_message_with_view(client) + sys.stdout.flush() if __name__ == "__main__": @@ -142,5 +145,6 @@ if __name__ == "__main__": proc.start() import time; time.sleep(0.5) alpc_client() + import time; time.sleep(0.5) print("BYE") proc.terminate() \ No newline at end of file diff --git a/samples/crypto/encryption_demo.py b/samples/crypto/encryption_demo.py index e1735c6..14c7eff 100644 --- a/samples/crypto/encryption_demo.py +++ b/samples/crypto/encryption_demo.py @@ -12,7 +12,7 @@ import windows.crypto.generation as gencrypt def crypt(src, dst, certs, **kwargs): """Encrypt the content of 'src' file with the certifacts in 'certs' into 'dst'""" # Open every certificates in the certs list - certlist = [crypto.CertificateContext.from_file(x) for x in certs] + certlist = [crypto.Certificate.from_file(x) for x in certs] # Encrypt the content of 'src' with all the public keys(certs) res = crypto.encrypt(certlist, src.read()) print("Encryption done. Result:") diff --git a/samples/debug/debugger_print_LdrLoaddll.py b/samples/debug/debugger_print_LdrLoaddll.py index 70bb28a..cfcfd37 100644 --- a/samples/debug/debugger_print_LdrLoaddll.py +++ b/samples/debug/debugger_print_LdrLoaddll.py @@ -31,11 +31,11 @@ class PrintUnicodeString(windows.debug.Breakpoint): unicode_string_addr = p.read_ptr(esp + (self.arg_pos + 1) * 4) wstring_addr = p.read_ptr(unicode_string_addr + 4) - dll_loaded = p.read_wstring(wstring_addr) + dll_loaded = p.read_wstring(wstring_addr).lower() print("Loading <{0}>".format(dll_loaded)) - if dll_loaded.endswith("ole32.dll"): - print("Ask to load : exiting process") + if dll_loaded.endswith("comctl32.dll"): + print("Ask to load : exiting process") dbg.current_process.exit() diff --git a/samples/process/remote_process.py b/samples/process/remote_process.py index 8230d76..b1f6749 100644 --- a/samples/process/remote_process.py +++ b/samples/process/remote_process.py @@ -78,7 +78,7 @@ try: print("Trying to import in remote module 'FAKE_MODULE'") notepad.execute_python("def func():\n import FAKE_MODULE\nfunc()") except windows.injection.RemotePythonError as e: - print("Remote ERROR !") + print("Exception in remote process!") print(e) print("That's all ! killing the notepad") diff --git a/windows/injection.py b/windows/injection.py index e8fe287..105f3f4 100644 --- a/windows/injection.py +++ b/windows/injection.py @@ -318,7 +318,7 @@ buff[:] = txt def retrieve_last_exception_data(process): with process.allocated_memory(0x1000) as mem: - execute_python_code(process, retrieve_exc.format(mem)) + execute_python_code(process, retrieve_exc.format(mem)).wait() size = struct.unpack("