forked from emanuelb/RID
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxmlgen.py
99 lines (79 loc) · 2.34 KB
/
xmlgen.py
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
96
97
98
99
import re
from enum import Enum
class LineType(Enum):
MINUS, PLUS, CONSTANT, SOURCE, ORDER, PROCESSOR, COMMENT = range(7)
class StripTypes(Enum):
HEXDUMPBINARY, HEXDUMPUNKNOWN, NONE = range(3)
processors=(
'Files',
'Checksums-Sha256',
'md5sums',
'file list',
'encoding',
'metadata',
'line order',
'msgunfmt {}',
'readelf --wide --dynamic {}',
'readelf --wide --file-header {}',
'readelf --wide --notes {}',
'readelf --wide --program-header {}',
'readelf --wide --relocs {}',
'readelf --wide --sections {}',
'readelf --wide --symbols {}',
'readelf --wide --version-info {}',
'readelf --string-dump=.gnu_debuglink {}',
'readelf --wide --section-headers {}',
'find {} -execdir llvm-dis -o - {} ;',
'llvm-bcanalyzer -dump {}',
'bzip2 --decompress --stdout {}',
'cpio --quiet --numeric-uid-gid --force-local -tvF {}',
'lsattr -d {}',
# gzip.py
'gzip --decompress --stdout {}',
# cbfs.py
'cbfstool {} print',
# ar.py
'nm -s {}',
# mono.py
'pedump {}',
# javascript.py
'js-beautify {}',
# openssh.py
'ssh-keygen -l -f {}',
# ppu.py
'ppudump {}',
# java.py
'javap -verbose -constants -s -l -private {}',
# xz.py
'xz --decompress --stdout {}',
# unsquashfs
'unsquashfs -s {}',
'unsquashfs -d -lls {}',
# pdf.py
'pdftotext {} -',
'pdftk {} output - uncompress',
# ps.py
'ps2ascii {}',
# iso9660.py
'isoinfo -l -i {}',
'isoinfo -l -i {} -R',
'isoinfo -R -f -i {}',
'isoinfo -d -i {}',
'isoinfo -l -i {} -J -j iso8859-15',
# icc.py
'cd-iccdump {}',
# fonts.py
'showttf {}',
# sqlite.py
'sqlite3 {} .dump',
# png.py
'sng',
# zip.py
'zipinfo {}',
'zipinfo -v {}',
)
ProcessorsMatch = re.compile("^(objdump --line-numbers --disassemble --demangle --section=|readelf --wide --debug-dump=|readelf --wide --decompress --hex-dump=|readelf --wide --decompress --string-dump=|otool -arch )")
# when file-type & extension is unknown
HexDumpUnknownDetect = re.compile("^[0-9a-f]{8}: (?:[0-9a-f]{4} ){8} ")
# from readelf
HexDumpBinaryDetect = re.compile('^ 0x(?:[0-9a-f]{8} ){1,5}');