pedump 0.6.6 → 0.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +34 -32
- data/README.md +8 -0
- data/VERSION +1 -1
- data/data/ordlookup/oleaut32.dll.yml +796 -0
- data/data/ordlookup/pefile2json.py +17 -0
- data/data/ordlookup/ws2_32.dll.yml +234 -0
- data/data/ordlookup/wsock32.dll.yml +234 -0
- data/lib/pedump/cli.rb +92 -9
- data/lib/pedump/ordlookup.rb +19 -0
- data/lib/pedump/pe.rb +4 -2
- data/lib/pedump.rb +28 -0
- data/pedump.gemspec +19 -28
- metadata +8 -3
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
import yaml
|
3
|
+
from pefile import ordlookup
|
4
|
+
#from PE import ordlookup
|
5
|
+
|
6
|
+
for dll, ord_names in ordlookup.ords.items():
|
7
|
+
if isinstance(list(ord_names.keys())[0], bytes):
|
8
|
+
ord_names = {k: v.decode("utf-8") for k, v in ord_names.items()}
|
9
|
+
|
10
|
+
yaml_data = yaml.dump(ord_names, allow_unicode=True, default_flow_style=False)
|
11
|
+
|
12
|
+
if isinstance(dll, bytes):
|
13
|
+
dll = dll.decode("utf-8")
|
14
|
+
file_name = dll + ".yml"
|
15
|
+
with open(file_name, 'w', encoding='utf-8') as yaml_file:
|
16
|
+
yaml_file.write(yaml_data)
|
17
|
+
|
@@ -0,0 +1,234 @@
|
|
1
|
+
1: !!binary |
|
2
|
+
YWNjZXB0
|
3
|
+
2: !!binary |
|
4
|
+
YmluZA==
|
5
|
+
3: !!binary |
|
6
|
+
Y2xvc2Vzb2NrZXQ=
|
7
|
+
4: !!binary |
|
8
|
+
Y29ubmVjdA==
|
9
|
+
5: !!binary |
|
10
|
+
Z2V0cGVlcm5hbWU=
|
11
|
+
6: !!binary |
|
12
|
+
Z2V0c29ja25hbWU=
|
13
|
+
7: !!binary |
|
14
|
+
Z2V0c29ja29wdA==
|
15
|
+
8: !!binary |
|
16
|
+
aHRvbmw=
|
17
|
+
9: !!binary |
|
18
|
+
aHRvbnM=
|
19
|
+
10: !!binary |
|
20
|
+
aW9jdGxzb2NrZXQ=
|
21
|
+
11: !!binary |
|
22
|
+
aW5ldF9hZGRy
|
23
|
+
12: !!binary |
|
24
|
+
aW5ldF9udG9h
|
25
|
+
13: !!binary |
|
26
|
+
bGlzdGVu
|
27
|
+
14: !!binary |
|
28
|
+
bnRvaGw=
|
29
|
+
15: !!binary |
|
30
|
+
bnRvaHM=
|
31
|
+
16: !!binary |
|
32
|
+
cmVjdg==
|
33
|
+
17: !!binary |
|
34
|
+
cmVjdmZyb20=
|
35
|
+
18: !!binary |
|
36
|
+
c2VsZWN0
|
37
|
+
19: !!binary |
|
38
|
+
c2VuZA==
|
39
|
+
20: !!binary |
|
40
|
+
c2VuZHRv
|
41
|
+
21: !!binary |
|
42
|
+
c2V0c29ja29wdA==
|
43
|
+
22: !!binary |
|
44
|
+
c2h1dGRvd24=
|
45
|
+
23: !!binary |
|
46
|
+
c29ja2V0
|
47
|
+
24: !!binary |
|
48
|
+
R2V0QWRkckluZm9X
|
49
|
+
25: !!binary |
|
50
|
+
R2V0TmFtZUluZm9X
|
51
|
+
26: !!binary |
|
52
|
+
V1NBcFNldFBvc3RSb3V0aW5l
|
53
|
+
27: !!binary |
|
54
|
+
RnJlZUFkZHJJbmZvVw==
|
55
|
+
28: !!binary |
|
56
|
+
V1BVQ29tcGxldGVPdmVybGFwcGVkUmVxdWVzdA==
|
57
|
+
29: !!binary |
|
58
|
+
V1NBQWNjZXB0
|
59
|
+
30: !!binary |
|
60
|
+
V1NBQWRkcmVzc1RvU3RyaW5nQQ==
|
61
|
+
31: !!binary |
|
62
|
+
V1NBQWRkcmVzc1RvU3RyaW5nVw==
|
63
|
+
32: !!binary |
|
64
|
+
V1NBQ2xvc2VFdmVudA==
|
65
|
+
33: !!binary |
|
66
|
+
V1NBQ29ubmVjdA==
|
67
|
+
34: !!binary |
|
68
|
+
V1NBQ3JlYXRlRXZlbnQ=
|
69
|
+
35: !!binary |
|
70
|
+
V1NBRHVwbGljYXRlU29ja2V0QQ==
|
71
|
+
36: !!binary |
|
72
|
+
V1NBRHVwbGljYXRlU29ja2V0Vw==
|
73
|
+
37: !!binary |
|
74
|
+
V1NBRW51bU5hbWVTcGFjZVByb3ZpZGVyc0E=
|
75
|
+
38: !!binary |
|
76
|
+
V1NBRW51bU5hbWVTcGFjZVByb3ZpZGVyc1c=
|
77
|
+
39: !!binary |
|
78
|
+
V1NBRW51bU5ldHdvcmtFdmVudHM=
|
79
|
+
40: !!binary |
|
80
|
+
V1NBRW51bVByb3RvY29sc0E=
|
81
|
+
41: !!binary |
|
82
|
+
V1NBRW51bVByb3RvY29sc1c=
|
83
|
+
42: !!binary |
|
84
|
+
V1NBRXZlbnRTZWxlY3Q=
|
85
|
+
43: !!binary |
|
86
|
+
V1NBR2V0T3ZlcmxhcHBlZFJlc3VsdA==
|
87
|
+
44: !!binary |
|
88
|
+
V1NBR2V0UU9TQnlOYW1l
|
89
|
+
45: !!binary |
|
90
|
+
V1NBR2V0U2VydmljZUNsYXNzSW5mb0E=
|
91
|
+
46: !!binary |
|
92
|
+
V1NBR2V0U2VydmljZUNsYXNzSW5mb1c=
|
93
|
+
47: !!binary |
|
94
|
+
V1NBR2V0U2VydmljZUNsYXNzTmFtZUJ5Q2xhc3NJZEE=
|
95
|
+
48: !!binary |
|
96
|
+
V1NBR2V0U2VydmljZUNsYXNzTmFtZUJ5Q2xhc3NJZFc=
|
97
|
+
49: !!binary |
|
98
|
+
V1NBSHRvbmw=
|
99
|
+
50: !!binary |
|
100
|
+
V1NBSHRvbnM=
|
101
|
+
51: !!binary |
|
102
|
+
Z2V0aG9zdGJ5YWRkcg==
|
103
|
+
52: !!binary |
|
104
|
+
Z2V0aG9zdGJ5bmFtZQ==
|
105
|
+
53: !!binary |
|
106
|
+
Z2V0cHJvdG9ieW5hbWU=
|
107
|
+
54: !!binary |
|
108
|
+
Z2V0cHJvdG9ieW51bWJlcg==
|
109
|
+
55: !!binary |
|
110
|
+
Z2V0c2VydmJ5bmFtZQ==
|
111
|
+
56: !!binary |
|
112
|
+
Z2V0c2VydmJ5cG9ydA==
|
113
|
+
57: !!binary |
|
114
|
+
Z2V0aG9zdG5hbWU=
|
115
|
+
58: !!binary |
|
116
|
+
V1NBSW5zdGFsbFNlcnZpY2VDbGFzc0E=
|
117
|
+
59: !!binary |
|
118
|
+
V1NBSW5zdGFsbFNlcnZpY2VDbGFzc1c=
|
119
|
+
60: !!binary |
|
120
|
+
V1NBSW9jdGw=
|
121
|
+
61: !!binary |
|
122
|
+
V1NBSm9pbkxlYWY=
|
123
|
+
62: !!binary |
|
124
|
+
V1NBTG9va3VwU2VydmljZUJlZ2luQQ==
|
125
|
+
63: !!binary |
|
126
|
+
V1NBTG9va3VwU2VydmljZUJlZ2luVw==
|
127
|
+
64: !!binary |
|
128
|
+
V1NBTG9va3VwU2VydmljZUVuZA==
|
129
|
+
65: !!binary |
|
130
|
+
V1NBTG9va3VwU2VydmljZU5leHRB
|
131
|
+
66: !!binary |
|
132
|
+
V1NBTG9va3VwU2VydmljZU5leHRX
|
133
|
+
67: !!binary |
|
134
|
+
V1NBTlNQSW9jdGw=
|
135
|
+
68: !!binary |
|
136
|
+
V1NBTnRvaGw=
|
137
|
+
69: !!binary |
|
138
|
+
V1NBTnRvaHM=
|
139
|
+
70: !!binary |
|
140
|
+
V1NBUHJvdmlkZXJDb25maWdDaGFuZ2U=
|
141
|
+
71: !!binary |
|
142
|
+
V1NBUmVjdg==
|
143
|
+
72: !!binary |
|
144
|
+
V1NBUmVjdkRpc2Nvbm5lY3Q=
|
145
|
+
73: !!binary |
|
146
|
+
V1NBUmVjdkZyb20=
|
147
|
+
74: !!binary |
|
148
|
+
V1NBUmVtb3ZlU2VydmljZUNsYXNz
|
149
|
+
75: !!binary |
|
150
|
+
V1NBUmVzZXRFdmVudA==
|
151
|
+
76: !!binary |
|
152
|
+
V1NBU2VuZA==
|
153
|
+
77: !!binary |
|
154
|
+
V1NBU2VuZERpc2Nvbm5lY3Q=
|
155
|
+
78: !!binary |
|
156
|
+
V1NBU2VuZFRv
|
157
|
+
79: !!binary |
|
158
|
+
V1NBU2V0RXZlbnQ=
|
159
|
+
80: !!binary |
|
160
|
+
V1NBU2V0U2VydmljZUE=
|
161
|
+
81: !!binary |
|
162
|
+
V1NBU2V0U2VydmljZVc=
|
163
|
+
82: !!binary |
|
164
|
+
V1NBU29ja2V0QQ==
|
165
|
+
83: !!binary |
|
166
|
+
V1NBU29ja2V0Vw==
|
167
|
+
84: !!binary |
|
168
|
+
V1NBU3RyaW5nVG9BZGRyZXNzQQ==
|
169
|
+
85: !!binary |
|
170
|
+
V1NBU3RyaW5nVG9BZGRyZXNzVw==
|
171
|
+
86: !!binary |
|
172
|
+
V1NBV2FpdEZvck11bHRpcGxlRXZlbnRz
|
173
|
+
87: !!binary |
|
174
|
+
V1NDRGVpbnN0YWxsUHJvdmlkZXI=
|
175
|
+
88: !!binary |
|
176
|
+
V1NDRW5hYmxlTlNQcm92aWRlcg==
|
177
|
+
89: !!binary |
|
178
|
+
V1NDRW51bVByb3RvY29scw==
|
179
|
+
90: !!binary |
|
180
|
+
V1NDR2V0UHJvdmlkZXJQYXRo
|
181
|
+
91: !!binary |
|
182
|
+
V1NDSW5zdGFsbE5hbWVTcGFjZQ==
|
183
|
+
92: !!binary |
|
184
|
+
V1NDSW5zdGFsbFByb3ZpZGVy
|
185
|
+
93: !!binary |
|
186
|
+
V1NDVW5JbnN0YWxsTmFtZVNwYWNl
|
187
|
+
94: !!binary |
|
188
|
+
V1NDVXBkYXRlUHJvdmlkZXI=
|
189
|
+
95: !!binary |
|
190
|
+
V1NDV3JpdGVOYW1lU3BhY2VPcmRlcg==
|
191
|
+
96: !!binary |
|
192
|
+
V1NDV3JpdGVQcm92aWRlck9yZGVy
|
193
|
+
97: !!binary |
|
194
|
+
ZnJlZWFkZHJpbmZv
|
195
|
+
98: !!binary |
|
196
|
+
Z2V0YWRkcmluZm8=
|
197
|
+
99: !!binary |
|
198
|
+
Z2V0bmFtZWluZm8=
|
199
|
+
101: !!binary |
|
200
|
+
V1NBQXN5bmNTZWxlY3Q=
|
201
|
+
102: !!binary |
|
202
|
+
V1NBQXN5bmNHZXRIb3N0QnlBZGRy
|
203
|
+
103: !!binary |
|
204
|
+
V1NBQXN5bmNHZXRIb3N0QnlOYW1l
|
205
|
+
104: !!binary |
|
206
|
+
V1NBQXN5bmNHZXRQcm90b0J5TnVtYmVy
|
207
|
+
105: !!binary |
|
208
|
+
V1NBQXN5bmNHZXRQcm90b0J5TmFtZQ==
|
209
|
+
106: !!binary |
|
210
|
+
V1NBQXN5bmNHZXRTZXJ2QnlQb3J0
|
211
|
+
107: !!binary |
|
212
|
+
V1NBQXN5bmNHZXRTZXJ2QnlOYW1l
|
213
|
+
108: !!binary |
|
214
|
+
V1NBQ2FuY2VsQXN5bmNSZXF1ZXN0
|
215
|
+
109: !!binary |
|
216
|
+
V1NBU2V0QmxvY2tpbmdIb29r
|
217
|
+
110: !!binary |
|
218
|
+
V1NBVW5ob29rQmxvY2tpbmdIb29r
|
219
|
+
111: !!binary |
|
220
|
+
V1NBR2V0TGFzdEVycm9y
|
221
|
+
112: !!binary |
|
222
|
+
V1NBU2V0TGFzdEVycm9y
|
223
|
+
113: !!binary |
|
224
|
+
V1NBQ2FuY2VsQmxvY2tpbmdDYWxs
|
225
|
+
114: !!binary |
|
226
|
+
V1NBSXNCbG9ja2luZw==
|
227
|
+
115: !!binary |
|
228
|
+
V1NBU3RhcnR1cA==
|
229
|
+
116: !!binary |
|
230
|
+
V1NBQ2xlYW51cA==
|
231
|
+
151: !!binary |
|
232
|
+
X19XU0FGRElzU2V0
|
233
|
+
500: !!binary |
|
234
|
+
V0VQ
|
@@ -0,0 +1,234 @@
|
|
1
|
+
1: !!binary |
|
2
|
+
YWNjZXB0
|
3
|
+
2: !!binary |
|
4
|
+
YmluZA==
|
5
|
+
3: !!binary |
|
6
|
+
Y2xvc2Vzb2NrZXQ=
|
7
|
+
4: !!binary |
|
8
|
+
Y29ubmVjdA==
|
9
|
+
5: !!binary |
|
10
|
+
Z2V0cGVlcm5hbWU=
|
11
|
+
6: !!binary |
|
12
|
+
Z2V0c29ja25hbWU=
|
13
|
+
7: !!binary |
|
14
|
+
Z2V0c29ja29wdA==
|
15
|
+
8: !!binary |
|
16
|
+
aHRvbmw=
|
17
|
+
9: !!binary |
|
18
|
+
aHRvbnM=
|
19
|
+
10: !!binary |
|
20
|
+
aW9jdGxzb2NrZXQ=
|
21
|
+
11: !!binary |
|
22
|
+
aW5ldF9hZGRy
|
23
|
+
12: !!binary |
|
24
|
+
aW5ldF9udG9h
|
25
|
+
13: !!binary |
|
26
|
+
bGlzdGVu
|
27
|
+
14: !!binary |
|
28
|
+
bnRvaGw=
|
29
|
+
15: !!binary |
|
30
|
+
bnRvaHM=
|
31
|
+
16: !!binary |
|
32
|
+
cmVjdg==
|
33
|
+
17: !!binary |
|
34
|
+
cmVjdmZyb20=
|
35
|
+
18: !!binary |
|
36
|
+
c2VsZWN0
|
37
|
+
19: !!binary |
|
38
|
+
c2VuZA==
|
39
|
+
20: !!binary |
|
40
|
+
c2VuZHRv
|
41
|
+
21: !!binary |
|
42
|
+
c2V0c29ja29wdA==
|
43
|
+
22: !!binary |
|
44
|
+
c2h1dGRvd24=
|
45
|
+
23: !!binary |
|
46
|
+
c29ja2V0
|
47
|
+
24: !!binary |
|
48
|
+
R2V0QWRkckluZm9X
|
49
|
+
25: !!binary |
|
50
|
+
R2V0TmFtZUluZm9X
|
51
|
+
26: !!binary |
|
52
|
+
V1NBcFNldFBvc3RSb3V0aW5l
|
53
|
+
27: !!binary |
|
54
|
+
RnJlZUFkZHJJbmZvVw==
|
55
|
+
28: !!binary |
|
56
|
+
V1BVQ29tcGxldGVPdmVybGFwcGVkUmVxdWVzdA==
|
57
|
+
29: !!binary |
|
58
|
+
V1NBQWNjZXB0
|
59
|
+
30: !!binary |
|
60
|
+
V1NBQWRkcmVzc1RvU3RyaW5nQQ==
|
61
|
+
31: !!binary |
|
62
|
+
V1NBQWRkcmVzc1RvU3RyaW5nVw==
|
63
|
+
32: !!binary |
|
64
|
+
V1NBQ2xvc2VFdmVudA==
|
65
|
+
33: !!binary |
|
66
|
+
V1NBQ29ubmVjdA==
|
67
|
+
34: !!binary |
|
68
|
+
V1NBQ3JlYXRlRXZlbnQ=
|
69
|
+
35: !!binary |
|
70
|
+
V1NBRHVwbGljYXRlU29ja2V0QQ==
|
71
|
+
36: !!binary |
|
72
|
+
V1NBRHVwbGljYXRlU29ja2V0Vw==
|
73
|
+
37: !!binary |
|
74
|
+
V1NBRW51bU5hbWVTcGFjZVByb3ZpZGVyc0E=
|
75
|
+
38: !!binary |
|
76
|
+
V1NBRW51bU5hbWVTcGFjZVByb3ZpZGVyc1c=
|
77
|
+
39: !!binary |
|
78
|
+
V1NBRW51bU5ldHdvcmtFdmVudHM=
|
79
|
+
40: !!binary |
|
80
|
+
V1NBRW51bVByb3RvY29sc0E=
|
81
|
+
41: !!binary |
|
82
|
+
V1NBRW51bVByb3RvY29sc1c=
|
83
|
+
42: !!binary |
|
84
|
+
V1NBRXZlbnRTZWxlY3Q=
|
85
|
+
43: !!binary |
|
86
|
+
V1NBR2V0T3ZlcmxhcHBlZFJlc3VsdA==
|
87
|
+
44: !!binary |
|
88
|
+
V1NBR2V0UU9TQnlOYW1l
|
89
|
+
45: !!binary |
|
90
|
+
V1NBR2V0U2VydmljZUNsYXNzSW5mb0E=
|
91
|
+
46: !!binary |
|
92
|
+
V1NBR2V0U2VydmljZUNsYXNzSW5mb1c=
|
93
|
+
47: !!binary |
|
94
|
+
V1NBR2V0U2VydmljZUNsYXNzTmFtZUJ5Q2xhc3NJZEE=
|
95
|
+
48: !!binary |
|
96
|
+
V1NBR2V0U2VydmljZUNsYXNzTmFtZUJ5Q2xhc3NJZFc=
|
97
|
+
49: !!binary |
|
98
|
+
V1NBSHRvbmw=
|
99
|
+
50: !!binary |
|
100
|
+
V1NBSHRvbnM=
|
101
|
+
51: !!binary |
|
102
|
+
Z2V0aG9zdGJ5YWRkcg==
|
103
|
+
52: !!binary |
|
104
|
+
Z2V0aG9zdGJ5bmFtZQ==
|
105
|
+
53: !!binary |
|
106
|
+
Z2V0cHJvdG9ieW5hbWU=
|
107
|
+
54: !!binary |
|
108
|
+
Z2V0cHJvdG9ieW51bWJlcg==
|
109
|
+
55: !!binary |
|
110
|
+
Z2V0c2VydmJ5bmFtZQ==
|
111
|
+
56: !!binary |
|
112
|
+
Z2V0c2VydmJ5cG9ydA==
|
113
|
+
57: !!binary |
|
114
|
+
Z2V0aG9zdG5hbWU=
|
115
|
+
58: !!binary |
|
116
|
+
V1NBSW5zdGFsbFNlcnZpY2VDbGFzc0E=
|
117
|
+
59: !!binary |
|
118
|
+
V1NBSW5zdGFsbFNlcnZpY2VDbGFzc1c=
|
119
|
+
60: !!binary |
|
120
|
+
V1NBSW9jdGw=
|
121
|
+
61: !!binary |
|
122
|
+
V1NBSm9pbkxlYWY=
|
123
|
+
62: !!binary |
|
124
|
+
V1NBTG9va3VwU2VydmljZUJlZ2luQQ==
|
125
|
+
63: !!binary |
|
126
|
+
V1NBTG9va3VwU2VydmljZUJlZ2luVw==
|
127
|
+
64: !!binary |
|
128
|
+
V1NBTG9va3VwU2VydmljZUVuZA==
|
129
|
+
65: !!binary |
|
130
|
+
V1NBTG9va3VwU2VydmljZU5leHRB
|
131
|
+
66: !!binary |
|
132
|
+
V1NBTG9va3VwU2VydmljZU5leHRX
|
133
|
+
67: !!binary |
|
134
|
+
V1NBTlNQSW9jdGw=
|
135
|
+
68: !!binary |
|
136
|
+
V1NBTnRvaGw=
|
137
|
+
69: !!binary |
|
138
|
+
V1NBTnRvaHM=
|
139
|
+
70: !!binary |
|
140
|
+
V1NBUHJvdmlkZXJDb25maWdDaGFuZ2U=
|
141
|
+
71: !!binary |
|
142
|
+
V1NBUmVjdg==
|
143
|
+
72: !!binary |
|
144
|
+
V1NBUmVjdkRpc2Nvbm5lY3Q=
|
145
|
+
73: !!binary |
|
146
|
+
V1NBUmVjdkZyb20=
|
147
|
+
74: !!binary |
|
148
|
+
V1NBUmVtb3ZlU2VydmljZUNsYXNz
|
149
|
+
75: !!binary |
|
150
|
+
V1NBUmVzZXRFdmVudA==
|
151
|
+
76: !!binary |
|
152
|
+
V1NBU2VuZA==
|
153
|
+
77: !!binary |
|
154
|
+
V1NBU2VuZERpc2Nvbm5lY3Q=
|
155
|
+
78: !!binary |
|
156
|
+
V1NBU2VuZFRv
|
157
|
+
79: !!binary |
|
158
|
+
V1NBU2V0RXZlbnQ=
|
159
|
+
80: !!binary |
|
160
|
+
V1NBU2V0U2VydmljZUE=
|
161
|
+
81: !!binary |
|
162
|
+
V1NBU2V0U2VydmljZVc=
|
163
|
+
82: !!binary |
|
164
|
+
V1NBU29ja2V0QQ==
|
165
|
+
83: !!binary |
|
166
|
+
V1NBU29ja2V0Vw==
|
167
|
+
84: !!binary |
|
168
|
+
V1NBU3RyaW5nVG9BZGRyZXNzQQ==
|
169
|
+
85: !!binary |
|
170
|
+
V1NBU3RyaW5nVG9BZGRyZXNzVw==
|
171
|
+
86: !!binary |
|
172
|
+
V1NBV2FpdEZvck11bHRpcGxlRXZlbnRz
|
173
|
+
87: !!binary |
|
174
|
+
V1NDRGVpbnN0YWxsUHJvdmlkZXI=
|
175
|
+
88: !!binary |
|
176
|
+
V1NDRW5hYmxlTlNQcm92aWRlcg==
|
177
|
+
89: !!binary |
|
178
|
+
V1NDRW51bVByb3RvY29scw==
|
179
|
+
90: !!binary |
|
180
|
+
V1NDR2V0UHJvdmlkZXJQYXRo
|
181
|
+
91: !!binary |
|
182
|
+
V1NDSW5zdGFsbE5hbWVTcGFjZQ==
|
183
|
+
92: !!binary |
|
184
|
+
V1NDSW5zdGFsbFByb3ZpZGVy
|
185
|
+
93: !!binary |
|
186
|
+
V1NDVW5JbnN0YWxsTmFtZVNwYWNl
|
187
|
+
94: !!binary |
|
188
|
+
V1NDVXBkYXRlUHJvdmlkZXI=
|
189
|
+
95: !!binary |
|
190
|
+
V1NDV3JpdGVOYW1lU3BhY2VPcmRlcg==
|
191
|
+
96: !!binary |
|
192
|
+
V1NDV3JpdGVQcm92aWRlck9yZGVy
|
193
|
+
97: !!binary |
|
194
|
+
ZnJlZWFkZHJpbmZv
|
195
|
+
98: !!binary |
|
196
|
+
Z2V0YWRkcmluZm8=
|
197
|
+
99: !!binary |
|
198
|
+
Z2V0bmFtZWluZm8=
|
199
|
+
101: !!binary |
|
200
|
+
V1NBQXN5bmNTZWxlY3Q=
|
201
|
+
102: !!binary |
|
202
|
+
V1NBQXN5bmNHZXRIb3N0QnlBZGRy
|
203
|
+
103: !!binary |
|
204
|
+
V1NBQXN5bmNHZXRIb3N0QnlOYW1l
|
205
|
+
104: !!binary |
|
206
|
+
V1NBQXN5bmNHZXRQcm90b0J5TnVtYmVy
|
207
|
+
105: !!binary |
|
208
|
+
V1NBQXN5bmNHZXRQcm90b0J5TmFtZQ==
|
209
|
+
106: !!binary |
|
210
|
+
V1NBQXN5bmNHZXRTZXJ2QnlQb3J0
|
211
|
+
107: !!binary |
|
212
|
+
V1NBQXN5bmNHZXRTZXJ2QnlOYW1l
|
213
|
+
108: !!binary |
|
214
|
+
V1NBQ2FuY2VsQXN5bmNSZXF1ZXN0
|
215
|
+
109: !!binary |
|
216
|
+
V1NBU2V0QmxvY2tpbmdIb29r
|
217
|
+
110: !!binary |
|
218
|
+
V1NBVW5ob29rQmxvY2tpbmdIb29r
|
219
|
+
111: !!binary |
|
220
|
+
V1NBR2V0TGFzdEVycm9y
|
221
|
+
112: !!binary |
|
222
|
+
V1NBU2V0TGFzdEVycm9y
|
223
|
+
113: !!binary |
|
224
|
+
V1NBQ2FuY2VsQmxvY2tpbmdDYWxs
|
225
|
+
114: !!binary |
|
226
|
+
V1NBSXNCbG9ja2luZw==
|
227
|
+
115: !!binary |
|
228
|
+
V1NBU3RhcnR1cA==
|
229
|
+
116: !!binary |
|
230
|
+
V1NBQ2xlYW51cA==
|
231
|
+
151: !!binary |
|
232
|
+
X19XU0FGRElzU2V0
|
233
|
+
500: !!binary |
|
234
|
+
V0VQ
|
data/lib/pedump/cli.rb
CHANGED
@@ -35,7 +35,7 @@ class PEdump::CLI
|
|
35
35
|
|
36
36
|
KNOWN_ACTIONS = (
|
37
37
|
%w'mz dos_stub rich pe ne te data_directory sections tls security' +
|
38
|
-
%w'strings resources resource_directory imports exports version_info packer web console packer_only' +
|
38
|
+
%w'strings resources resource_directory imports exports version_info imphash packer web console packer_only' +
|
39
39
|
%w'extract' # 'disasm'
|
40
40
|
).map(&:to_sym)
|
41
41
|
|
@@ -118,6 +118,13 @@ class PEdump::CLI
|
|
118
118
|
@actions << [:va2file, va]
|
119
119
|
end
|
120
120
|
|
121
|
+
opts.on "--set-os-version VER", "Patch OS version in PE header" do |ver|
|
122
|
+
@actions << [:set_os_version, ver]
|
123
|
+
end
|
124
|
+
opts.on "--set-dll-char X", "Patch IMAGE_OPTIONAL_HEADER32.DllCharacteristics" do |x|
|
125
|
+
@actions << [:set_dll_char, x]
|
126
|
+
end
|
127
|
+
|
121
128
|
opts.separator ''
|
122
129
|
|
123
130
|
opts.on "-W", "--web", "Uploads files to a #{URL_BASE}","for a nice HTML tables with image previews,","candies & stuff" do
|
@@ -327,6 +334,7 @@ class PEdump::CLI
|
|
327
334
|
s = action.to_s.upcase.tr('_',' ')
|
328
335
|
s += " Header" if [:mz, :pe, :rich].include?(action)
|
329
336
|
s = "Packer / Compiler" if action == :packer
|
337
|
+
s = "imphash" if action == :imphash
|
330
338
|
"\n=== %s ===\n\n" % s
|
331
339
|
end
|
332
340
|
|
@@ -337,6 +345,10 @@ class PEdump::CLI
|
|
337
345
|
return
|
338
346
|
when :extract
|
339
347
|
return extract action[1]
|
348
|
+
when :set_os_version
|
349
|
+
return set_os_version action[1]
|
350
|
+
when :set_dll_char
|
351
|
+
return set_dll_char action[1]
|
340
352
|
when :va2file
|
341
353
|
@pedump.sections(f)
|
342
354
|
va = action[1] =~ /(^0x)|(h$)/i ? action[1].to_i(16) : action[1].to_i
|
@@ -350,9 +362,9 @@ class PEdump::CLI
|
|
350
362
|
data = @pedump.send(action, f)
|
351
363
|
return if !data || (data.respond_to?(:empty?) && data.empty?)
|
352
364
|
|
353
|
-
puts action_title(action) unless @options[:format] == :binary
|
365
|
+
puts action_title(action) unless @options[:format] == :binary || @actions == [:imphash]
|
354
366
|
|
355
|
-
return dump(data) if [:inspect, :table, :json, :yaml].include?(@options[:format])
|
367
|
+
return dump(data, action:) if [:inspect, :table, :json, :yaml].include?(@options[:format])
|
356
368
|
|
357
369
|
dump_opts = {:name => action}
|
358
370
|
case action
|
@@ -398,7 +410,7 @@ class PEdump::CLI
|
|
398
410
|
require 'pp'
|
399
411
|
pp data
|
400
412
|
when :table
|
401
|
-
dump_table data
|
413
|
+
dump_table data, opts
|
402
414
|
when :yaml
|
403
415
|
require 'yaml'
|
404
416
|
puts data.to_yaml
|
@@ -474,7 +486,7 @@ class PEdump::CLI
|
|
474
486
|
end
|
475
487
|
end
|
476
488
|
|
477
|
-
def dump_table data
|
489
|
+
def dump_table data, opts = {}
|
478
490
|
if data.is_a?(Struct)
|
479
491
|
return dump_res_dir(data) if data.is_a?(PEdump::IMAGE_RESOURCE_DIRECTORY)
|
480
492
|
return dump_exports(data) if data.is_a?(PEdump::IMAGE_EXPORT_DIRECTORY)
|
@@ -511,7 +523,12 @@ class PEdump::CLI
|
|
511
523
|
elsif data.is_a?(PEdump::RichHdr)
|
512
524
|
dump_rich_hdr data
|
513
525
|
else
|
514
|
-
|
526
|
+
case opts[:action]
|
527
|
+
when :imphash
|
528
|
+
puts "#{data} #{@file_name}"
|
529
|
+
else
|
530
|
+
puts "[?] Don't know how to display #{data.inspect[0,50]}... as a table"
|
531
|
+
end
|
515
532
|
end
|
516
533
|
end
|
517
534
|
|
@@ -864,7 +881,7 @@ class PEdump::CLI
|
|
864
881
|
exit(1)
|
865
882
|
end
|
866
883
|
if entry.size != 0
|
867
|
-
|
884
|
+
_copy_stream @pedump.io, $stdout, entry.size, @pedump.va2file(entry.va)
|
868
885
|
end
|
869
886
|
end
|
870
887
|
|
@@ -887,7 +904,7 @@ class PEdump::CLI
|
|
887
904
|
@pedump.logger.fatal "[!] resource #{id.inspect} not found"
|
888
905
|
exit(1)
|
889
906
|
end
|
890
|
-
|
907
|
+
_copy_stream @pedump.io, $stdout, res.size, res.file_offset
|
891
908
|
end
|
892
909
|
|
893
910
|
def extract_section id
|
@@ -911,7 +928,73 @@ class PEdump::CLI
|
|
911
928
|
@pedump.logger.fatal "[!] section #{id.inspect} not found"
|
912
929
|
exit(1)
|
913
930
|
end
|
914
|
-
|
931
|
+
_copy_stream @pedump.io, $stdout, section.SizeOfRawData, section.PointerToRawData
|
915
932
|
end
|
916
933
|
|
934
|
+
def set_dll_char x
|
935
|
+
@pedump.pe.image_optional_header.DllCharacteristics = x.to_i(0)
|
936
|
+
io = @pedump.io.reopen(@file_name,'rb+')
|
937
|
+
io.seek @pedump.pe.ioh_offset
|
938
|
+
io.write @pedump.pe.image_optional_header.pack
|
939
|
+
io.close
|
940
|
+
end
|
941
|
+
|
942
|
+
def set_os_version ver
|
943
|
+
raise "[!] invalid version #{ver.inspect}" unless ver =~ /\A(\d+)\.(\d+)\Z/
|
944
|
+
raise "[!] no IMAGE_OPTIONAL_HEADER" if @pedump.pe.ifh.SizeOfOptionalHeader.to_i == 0
|
945
|
+
major = $1.to_i
|
946
|
+
minor = $2.to_i
|
947
|
+
ver = "#{major}.#{minor}"
|
948
|
+
ioh = @pedump.pe.image_optional_header
|
949
|
+
|
950
|
+
prev_os_ver = "#{ioh.MajorOperatingSystemVersion}.#{ioh.MinorOperatingSystemVersion}"
|
951
|
+
prev_ss_ver = "#{ioh.MajorSubsystemVersion}.#{ioh.MinorSubsystemVersion}"
|
952
|
+
|
953
|
+
if prev_os_ver == ver && prev_ss_ver == ver
|
954
|
+
@pedump.logger.warn "[?] already has #{ver}"
|
955
|
+
return
|
956
|
+
end
|
957
|
+
|
958
|
+
if prev_os_ver != ver
|
959
|
+
ioh.MajorOperatingSystemVersion = major
|
960
|
+
ioh.MinorOperatingSystemVersion = minor
|
961
|
+
@pedump.logger.warn "[.] MajorOperatingSystemVersion: #{prev_os_ver} -> #{ver}"
|
962
|
+
end
|
963
|
+
|
964
|
+
if prev_ss_ver != ver
|
965
|
+
ioh.MajorSubsystemVersion = major
|
966
|
+
ioh.MinorSubsystemVersion = minor
|
967
|
+
@pedump.logger.warn "[.] MajorSubsystemVersion: #{prev_ss_ver} -> #{ver}"
|
968
|
+
end
|
969
|
+
|
970
|
+
io = @pedump.io.reopen(@file_name,'rb+')
|
971
|
+
io.seek @pedump.pe.ioh_offset
|
972
|
+
io.write ioh.pack
|
973
|
+
io.close
|
974
|
+
end
|
975
|
+
|
976
|
+
private
|
977
|
+
|
978
|
+
# https://github.com/zed-0xff/pedump/issues/44
|
979
|
+
# https://redmine.ruby-lang.org/issues/12280
|
980
|
+
def _copy_stream(src, dst, src_length = nil, src_offset = 0)
|
981
|
+
IO::copy_stream(src, dst, src_length, src_offset)
|
982
|
+
rescue NotImplementedError # `copy_stream': pread() not implemented (NotImplementedError)
|
983
|
+
src_length ||= src.size - src_offset
|
984
|
+
bufsize = 16384
|
985
|
+
buf = ("\x00".force_encoding('binary')) * bufsize
|
986
|
+
src.binmode
|
987
|
+
dst.binmode
|
988
|
+
saved_pos = src.tell
|
989
|
+
src.seek(src_offset)
|
990
|
+
bytes_copied = 0
|
991
|
+
while src_length > 0 && buf.size != 0
|
992
|
+
src.read([bufsize, src_length].min, buf)
|
993
|
+
dst.write(buf)
|
994
|
+
src_length -= buf.size
|
995
|
+
bytes_copied += buf.size
|
996
|
+
end
|
997
|
+
src.seek(saved_pos)
|
998
|
+
bytes_copied
|
999
|
+
end
|
917
1000
|
end # class PEdump::CLI
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
class PEdump
|
5
|
+
def self.ordlookup(dll, ord, make_name: false)
|
6
|
+
dll = dll.downcase
|
7
|
+
@ordlookup ||= {}
|
8
|
+
@ordlookup[dll] ||=
|
9
|
+
begin
|
10
|
+
yml_fname = File.expand_path(File.dirname(__FILE__) + "/../../data/ordlookup/" + dll + ".yml")
|
11
|
+
if File.exist?(yml_fname)
|
12
|
+
YAML.load_file(yml_fname)
|
13
|
+
else
|
14
|
+
{}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
@ordlookup[dll][ord] || (make_name ? "ord#{ord}" : nil)
|
18
|
+
end
|
19
|
+
end
|
data/lib/pedump/pe.rb
CHANGED
@@ -7,6 +7,8 @@ class PEdump
|
|
7
7
|
:image_optional_header, # includes data directory
|
8
8
|
:section_table
|
9
9
|
)
|
10
|
+
attr_accessor :ioh_offset
|
11
|
+
|
10
12
|
alias :ifh :image_file_header
|
11
13
|
alias :ifh= :image_file_header=
|
12
14
|
alias :ioh :image_optional_header
|
@@ -68,7 +70,7 @@ class PEdump
|
|
68
70
|
end
|
69
71
|
pe = PE.new(pe_sig)
|
70
72
|
pe.image_file_header = IMAGE_FILE_HEADER.read(f)
|
71
|
-
ioh_offset = f.tell # offset to IMAGE_OPTIONAL_HEADER
|
73
|
+
pe.ioh_offset = f.tell # offset to IMAGE_OPTIONAL_HEADER
|
72
74
|
if pe.ifh.SizeOfOptionalHeader.to_i > 0
|
73
75
|
if pe.x64?
|
74
76
|
pe.image_optional_header = IMAGE_OPTIONAL_HEADER64.read(f, pe.ifh.SizeOfOptionalHeader)
|
@@ -81,7 +83,7 @@ class PEdump
|
|
81
83
|
|
82
84
|
# The Windows loader expects to find the PE section headers after the optional header. It calculates the address of the first section header by adding SizeOfOptionalHeader to the beginning of the optional header.
|
83
85
|
# // http://www.phreedom.org/research/tinype/
|
84
|
-
f.seek( ioh_offset + pe.ifh.SizeOfOptionalHeader.to_i )
|
86
|
+
f.seek( pe.ioh_offset + pe.ifh.SizeOfOptionalHeader.to_i )
|
85
87
|
pe.sections = read_sections(f, nToRead, args)
|
86
88
|
|
87
89
|
pe_end = f.tell
|