forked from skelsec/minidump
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__amain__.py
More file actions
95 lines (84 loc) · 3.19 KB
/
Copy path__amain__.py
File metadata and controls
95 lines (84 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env python3
#
# Author:
# Tamas Jos (@skelsec)
#
import logging
import asyncio
from minidump.aminidumpfile import AMinidumpFile
from minidump.common_structs import hexdump
from minidump._version import __banner__
async def run():
import argparse
parser = argparse.ArgumentParser(description='A parser for minidumnp files')
parser.add_argument('minidumpfile', help='path to the minidump file of lsass.exe')
parser.add_argument('-v', '--verbose', action='count', default=0)
parser.add_argument('--header', action='store_true', help='File header info')
parser.add_argument('--modules', action='store_true', help='List modules')
parser.add_argument('--threads', action='store_true', help='List threads')
parser.add_argument('--memory', action='store_true', help='List memory')
parser.add_argument('--sysinfo', action='store_true', help='Show sysinfo')
parser.add_argument('--comments', action='store_true', help='Show comments')
parser.add_argument('--exception', action='store_true', help='Show exception records')
parser.add_argument('--handles', action='store_true', help='List handles')
parser.add_argument('--misc', action='store_true', help='Show misc info')
parser.add_argument('--all', action='store_true', help='Show all info')
parser.add_argument('-r', '--read-addr', type=lambda x: int(x,0), help='Dump a memory region from the process\'s addres space')
parser.add_argument('-s', '--read-size', type=lambda x: int(x,0), default = 0x20, help='Dump a memory region from the process\'s addres space')
args = parser.parse_args()
if args.verbose == 0:
logging.basicConfig(level=logging.INFO)
elif args.verbose == 1:
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=1)
print(__banner__)
mf = await AMinidumpFile.parse(args.minidumpfile)
reader = mf.get_reader()
if args.all or args.threads:
if mf.threads is not None:
print(str(mf.threads))
if mf.threads_ex is not None:
print(str(mf.threads_ex))
if mf.thread_info is not None:
print(str(mf.thread_info))
if args.all or args.modules:
if mf.modules is not None:
print(str(mf.modules))
if mf.unloaded_modules is not None:
print(str(mf.unloaded_modules))
if args.all or args.memory:
if mf.memory_segments is not None:
print(str(mf.memory_segments))
if mf.memory_segments_64 is not None:
print(str(mf.memory_segments_64))
if mf.memory_info is not None:
print(str(mf.memory_info))
if args.all or args.sysinfo:
if mf.sysinfo is not None:
print(str(mf.sysinfo))
if args.all or args.exception:
if mf.exception is not None:
print(str(mf.exception))
if args.all or args.comments:
if mf.comment_a is not None:
print(str(mf.comment_a))
if mf.comment_w is not None:
print(str(mf.comment_w))
if args.all or args.handles:
if mf.handles is not None:
print(str(mf.handles))
if args.all or args.misc:
if mf.misc_info is not None:
print(str(mf.misc_info))
if args.all or args.header:
print(str(mf.header))
if args.read_addr:
buff_reader = reader.get_buffered_reader()
await buff_reader.move(args.read_addr)
data = await buff_reader.peek(args.read_size)
print(hexdump(data, start = args.read_addr))
def main():
asyncio.run(run())
if __name__ == '__main__':
main()