diff options
| author | serpilliere <devnull@localhost> | 2011-08-11 10:52:02 +0200 |
|---|---|---|
| committer | serpilliere <devnull@localhost> | 2011-08-11 10:52:02 +0200 |
| commit | d91b77a9cdd07abf12f6cef43d8e9ff539de6b50 (patch) | |
| tree | dca8003c37a0d5af719c030159e8e899be6bd8a1 /example | |
| parent | 7542338f5d8335bf0c2ef0a6c91c7b926f1d899c (diff) | |
| download | miasm-d91b77a9cdd07abf12f6cef43d8e9ff539de6b50.tar.gz miasm-d91b77a9cdd07abf12f6cef43d8e9ff539de6b50.zip | |
add name to ressource extractor
Diffstat (limited to 'example')
| -rw-r--r-- | example/extract_pe_ressources.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/example/extract_pe_ressources.py b/example/extract_pe_ressources.py index d8fe11c1..c21f999c 100644 --- a/example/extract_pe_ressources.py +++ b/example/extract_pe_ressources.py @@ -6,20 +6,26 @@ import sys # example for extracting all pe ressources -def extract_res(res, num = 0, lvl=-1): +def extract_res(res, name_o = "", num = 0, lvl=-1): lvl +=1 if not res: return num for x in res.resentries: print "\t"*lvl, repr(x) num += 1 + + if x.name_s: + name = name_o[:]+repr(x.name_s) + else: + name = name_o[:] + if x.data: print "\t"*lvl, 'data', len(x.data.s) - open('out/%.3d.bin'%(num), 'w').write(str(x.data.s)) + open('out/%.3d_%s.bin'%(num, name), 'w').write(str(x.data.s)) else: print "\t"*lvl, None if x.offsettosubdir: - num = extract_res(x.subdir, num, lvl+1) + num = extract_res(x.subdir, name, num, lvl+1) return num |