forked from TheCjw/ida_android_script
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdump_range.py
More file actions
37 lines (25 loc) · 794 Bytes
/
dump_range.py
File metadata and controls
37 lines (25 loc) · 794 Bytes
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
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Author: TheCjw<[email protected]>
# Created on 10:19 2015/3/6
__author__ = "TheCjw"
import os
import idaapi
def main():
address = AskAddr(BADADDR, "Enter address: ")
if address == BADADDR:
print "Invalid address."
return
size = AskLong(0, "Enter size: ")
if size == 0:
print "Invalid size."
return
print "Range: ", hex(address), hex(size)
buffer = idaapi.dbg_read_memory(address, size)
if (len(buffer)) != 0:
output_file = os.path.join(os.path.dirname(GetIdbPath()), "dump_%08x_%08x.bin" % (address, size))
with open(output_file, "wb") as f:
f.write(buffer)
print "Saved data success", output_file
if __name__ == "__main__":
main()