Skip to content

Commit 2e48f90

Browse files
committed
Multiple docs update some __init__.py code (windows.debug not imported by default anymore)
1 parent aec35a4 commit 2e48f90

10 files changed

Lines changed: 167 additions & 3830 deletions

File tree

ctypes_generation/extended_structs/_SYMBOL_INFO.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

ctypes_generation/extended_structs/_SYMBOL_INFOW.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/err.txt

Lines changed: 0 additions & 3814 deletions
This file was deleted.

docs/generate_samples.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import os
2+
import sys
3+
import subprocess
4+
5+
print(__file__)
6+
7+
samplepath = os.path.join(os.path.dirname(__file__), "..", "samples")
8+
resultdir = os.path.join(os.path.dirname(__file__), "source", "samples_output")
9+
resultdir = os.path.abspath(resultdir)
10+
os.chdir(samplepath)
11+
12+
python_exe = sys.executable
13+
14+
def generate_output_result(target, output):
15+
print("Generating result of <{0}>".format(target))
16+
p = subprocess.Popen([python_exe, target], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
17+
result = p.communicate()
18+
with open(os.path.join(resultdir, output), "wb") as f:
19+
f.write("(cmd) python {0}\n".format(target))
20+
f.write(result[0])
21+
22+
23+
if "-n" in sys.argv:
24+
sys.exit(0)
25+
26+
generate_output_result(r"process\current_process.py", "process_current_process.txt")
27+
generate_output_result(r"process\remote_process.py", "process_remote_process.txt")
28+
generate_output_result(r"process\peb.py", "process_peb.txt")
29+
generate_output_result(r"process\iat_hook.py", "process_iat_hook.txt")
30+
generate_output_result(r"process\veh_segv.py", "process_veh_segv.txt")
31+
generate_output_result(r"process\apisetmap.py", "process_apisetmap.txt")
32+
33+
34+
generate_output_result(r"token\token_demo.py", "token_token_demo.txt")
35+
36+
generate_output_result(r"system.py", "system.txt")
37+
# Require admin for 'network.py'
38+
# Also require a local connection to port 80
39+
generate_output_result(r"network\network.py", "network_network.txt")
40+
41+
# Need to anonymise the output
42+
# generate_output_result(r"registry\registry.py", "registry_registry.txt")
43+
44+
generate_output_result(r"crypto\wintrust.py", "crypto_wintrust.txt")
45+
46+
47+
generate_output_result(r"debug\debugger_print_LdrLoaddll.py", "debug_debugger_print_LdrLoaddll.txt")
48+
generate_output_result(r"debug\debugger_membp_singlestep.py", "debug_debugger_membp_singlestep.txt")
49+
generate_output_result(r"debug\debug_functionbp.py", "debug_debug_functionbp.txt")
50+
generate_output_result(r"debug\attach.py", "debug_attach.txt")
51+
generate_output_result(r"debug\local_debugger.py", "debug_local_debugger.txt")
52+
generate_output_result(r"debug\debugger_on_setup.py", "debug_debugger_on_setup.txt")
53+
54+
# dbg.symbols
55+
generate_output_result(r"debug\symbols\virtsymdemo.py", "debug_symbol_virtsymdemo.txt")
56+
generate_output_result(r"debug\symbols\processsymdemo.py", "debug_symbol_processsymdemo.txt")
57+
generate_output_result(r"debug\symbol_debugger.py", "debug_symbol_debugger.txt")
58+
59+
60+
# Not generated: need parameters
61+
# generate_output_result(r"debug\symbols\symsearch.py", "debug_symbol_symsearch.txt")
62+
63+
64+
65+
66+
67+
generate_output_result(r"wmi\wmi_request.py", "wmi_wmi_request.txt")
68+
generate_output_result(r"wmi\create_process.py", "wmi_create_process.txt")
69+
70+
generate_output_result(r"com\com_inetfwpolicy2.py", "com_com_inetfwpolicy2.txt")
71+
generate_output_result(r"com\icallinterceptor.py", "com_icallinterceptor.txt")
72+
73+
generate_output_result(r"crypto\certificate.py", "crypto_certificate.txt")
74+
75+
# Those 2 create another process: cannot get full output with this simple implem
76+
# generate_output_result(r"alpc\simple_alpc.py", "alpc_simple_alpc.txt")
77+
# generate_output_result(r"alpc\advanced_alpc.py", "alpc_advanced_alpc.txt")
78+
79+
generate_output_result(r"rpc\lsass.py", "rpc_lsass.txt")
80+
81+
generate_output_result(r"pipe\child_send_object.py", "pipe_child_send_object.txt")
82+
83+
generate_output_result(r"scheduled_tasks\scheduled_task.py", "scheduled_task_scheduled_task.txt")
84+
generate_output_result(r"event_log\eventlog.py", "event_log_eventlog.txt")
85+
86+
generate_output_result(r"object_manager\findobj.py", "object_manager_findobj.txt")
87+
generate_output_result(r"object_manager\object_manager.py", "object_manager_object_manager.txt")
88+
89+
generate_output_result(r"security\security_descriptor.py", "security_security_descriptor.txt")
90+
91+
92+
generate_output_result(r"service\service_demo.py", "service_service_demo.txt")
93+
94+
generate_output_result(r"device_manager\device_manager.py", "device_manager_device_manager.txt")
95+
96+
97+
# Require ADMIN / NotAdmin run
98+
# generate_output_result(r"security\query_sacl.py", "security_query_sacl.txt")

docs/source/debug.rst

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
.. note::
1111

12-
If you are interrested by symbols (PDB) handling, go to subsection :ref:`debug_symbols_module`
12+
If you are interrested by symbols (PDB) handling, go to subsection :ref:`debug_symbols_module`.
13+
14+
You can also look at the symbols-related samples: :ref:`sample_symbols`
1315

1416
:class:`Debugger`
1517
"""""""""""""""""
@@ -31,7 +33,12 @@ This means that those methods see the original ``current_process`` memory access
3133
:class:`SymbolDebugger`
3234
"""""""""""""""""""""""
3335

36+
.. note::
37+
38+
See sample :ref:`sample_symbol_debugger`
39+
3440
.. autoclass:: SymbolDebugger
41+
:show-inheritance:
3542
:members:
3643
:no-inherited-members:
3744

@@ -124,7 +131,7 @@ In its current state, this module does not handle types.
124131

125132
.. note::
126133

127-
See sample <TODO>
134+
See samples :ref:`sample_symbols`
128135

129136

130137
Configuration
@@ -208,9 +215,15 @@ Helpers
208215
'''''''''''''''''''
209216

210217
.. autoclass:: SymbolInfo
218+
:show-inheritance:
211219
:members:
212220

213-
214221
.. autoclass:: SymbolInfoA
222+
:show-inheritance:
215223
:members:
224+
:inherited-members: displacement
216225
:special-members: __str__, __int__
226+
227+
.. py:attribute:: displacement
228+
229+
The displacement between the addresse and the start of the symbol (name)

docs/source/device_manager.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ ResourceDescriptor
6363

6464

6565
Concrete ResourceDescriptor
66-
''''''''''''''''''''''''''
66+
'''''''''''''''''''''''''''
6767

6868
ResourceNoType
6969
------------------

docs/source/object_manager.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ KernelObject
3232
.. autoclass:: KernelObject
3333
:members:
3434
:undoc-members:
35-
:special-members: __getitem__, __iter__
35+
:special-members: __getitem__,__iter__

docs/source/sample.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,18 @@ Ouput
344344
.. literalinclude:: samples_output\test_code.txt
345345

346346

347+
.. _sample_symbol_debugger:
348+
349+
:class:`SymbolDebugger`
350+
'''''''''''''''''''''''
351+
352+
.. literalinclude:: ..\..\samples\debug\symbol_debugger.py
353+
354+
Output
355+
356+
.. literalinclude:: samples_output\debug_symbol_debugger.txt
357+
358+
347359
.. _sample_local_debugger:
348360

349361

@@ -392,6 +404,43 @@ Ouput::
392404
I AM LOADING <C:\Windows\system32\ole32.dll>
393405

394406

407+
.. _sample_symbols:
408+
409+
Symbols
410+
"""""""
411+
412+
VirtualSymbolHandler
413+
''''''''''''''''''''
414+
415+
.. literalinclude:: ..\..\samples\debug\symbols\virtsymdemo.py
416+
417+
Output
418+
419+
.. literalinclude:: samples_output\debug_symbol_virtsymdemo.txt
420+
421+
422+
ProcessSymbolHandler
423+
''''''''''''''''''''
424+
425+
.. literalinclude:: ..\..\samples\debug\symbols\processsymdemo.py
426+
427+
Output
428+
429+
.. literalinclude:: samples_output\debug_symbol_processsymdemo.txt
430+
431+
432+
433+
Symbol search
434+
'''''''''''''
435+
436+
.. literalinclude:: ..\..\samples\debug\symbols\symsearch.py
437+
438+
Output
439+
440+
.. literalinclude:: samples_output\debug_symbol_symsearch.txt
441+
442+
443+
395444
.. _wmi_samples:
396445

397446
WMI

windows/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
# Do not move it: risk of circular import
4040

4141
import windows.utils
42-
import windows.debug
4342
import windows.wintrust
4443
import windows.syswow64
4544
import windows.com

windows/debug/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
from .debugger import Debugger, HXBreakpoint
2+
from .symboldbg import SymbolDebugger
23
from .localdbg import LocalDebugger
4+
from .breakpoints import *
35
from .breakpoints import *

0 commit comments

Comments
 (0)