Samples of code =============== .. _sample_current_process: ``windows.current_process`` """"""""""""""""""""""""""" .. literalinclude:: ..\..\samples\current_process.py Output:: (cmd λ) python32.exe current_process.py current process is current process is a <32> bits process current process is a SysWow64 process ? current process pid <7432> and ppid <5412> Here are the current process threads: <[]> Let's execute some native code ! (0x41 + 1) Waiting for execution to finish ! Native code returned <0x42L> Allocating memory in current process Allocated memory is at <0x3f0000> Writing 'SOME STUFF' in allocation memory Reading memory : <'SOME STUFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'> .. _sample_remote_process: Remote process : :class:`WinProcess` """""""""""""""""""""""""""""""""""" .. literalinclude:: ..\..\samples\remote_calc.py Output:: (cmd λ) python.exe remote_calc.py Creating a calc Looking for calcs in the processes They are currently <1> calcs running on the system Let's play with our calc: <> Our calc pid is 8052 Our calc is a <32> bits process Our calc is a SysWow64 process ? Our calc have threads ! <[, , ]> Exploring our calc PEB ! Command line is Here are 3 loaded modules: [, , ] Allocating memory in our calc Allocated memory is at <0x5c90000> 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 calc (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 CALC\x00\x00\x00\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 That's all ! killing the calc .. _sample_peb_exploration: :class:`PEB` exploration """""""""""""""""""""""" .. literalinclude:: ..\..\samples\peb.py Output:: (cmd λ) python.exe 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: [, , , , ]