mirror of
https://github.com/geohot/qira
synced 2025-03-14 02:52:52 +03:00
idc parser works
This commit is contained in:
parent
a55694ba63
commit
4dc84fbe3a
24
extra/parseida/parseidb.py
Normal file
24
extra/parseida/parseidb.py
Normal file
@ -0,0 +1,24 @@
|
||||
import sys
|
||||
from hexdump import hexdump
|
||||
|
||||
# name.id0 - contains contents of B-tree style database
|
||||
# name.id1 - contains flags that describe each program byte
|
||||
# name.nam - contains index information related to named program locations
|
||||
# name.til - contains information about local type definitions
|
||||
|
||||
BTREE_PAGE_SIZE = 8192
|
||||
|
||||
#dat = open(sys.argv[1]).read()
|
||||
|
||||
#id0 = dat[0x104:]
|
||||
|
||||
dat = open("/Users/geohot/tmp/test.id0").read()
|
||||
print hex(len(dat)), len(dat)/BTREE_PAGE_SIZE
|
||||
|
||||
for i in range(0, len(dat), BTREE_PAGE_SIZE):
|
||||
hexdump(dat[i:i+0xC0])
|
||||
print ""
|
||||
|
||||
|
||||
|
||||
|
32
extra/parseida/parseidc.py
Normal file
32
extra/parseida/parseidc.py
Normal file
@ -0,0 +1,32 @@
|
||||
import sys
|
||||
import collections
|
||||
|
||||
def ghex(a):
|
||||
if a == None:
|
||||
return None
|
||||
return hex(a).strip("L")
|
||||
|
||||
tags = collections.defaultdict(dict)
|
||||
|
||||
for ln in open(sys.argv[1]).read().split("\n"):
|
||||
ln = ln.strip(" \n\t")
|
||||
if ln.startswith("MakeName"):
|
||||
(addr,name) = ln.split("(")[1].split(")")[0].split(",")
|
||||
addr = addr.strip(" \t")
|
||||
name = name.strip(" \t\"")
|
||||
addr = ghex(int(addr, 16))
|
||||
tags[addr]['name'] = name
|
||||
|
||||
tags = dict(tags)
|
||||
print tags
|
||||
|
||||
# upload the tags
|
||||
|
||||
from socketIO_client import SocketIO, BaseNamespace
|
||||
class QiraNamespace(BaseNamespace):
|
||||
pass
|
||||
|
||||
sio = SocketIO('localhost', 3002)
|
||||
qira = sio.define(QiraNamespace, '/qira')
|
||||
qira.emit("settags", dict(tags))
|
||||
|
@ -1,19 +0,0 @@
|
||||
import sys
|
||||
from hexdump import hexdump
|
||||
|
||||
BTREE_PAGE_SIZE = 8192
|
||||
|
||||
#dat = open(sys.argv[1]).read()
|
||||
|
||||
#id0 = dat[0x104:]
|
||||
|
||||
dat = open("/Users/geohot/tmp/test.id0").read()
|
||||
print hex(len(dat)), len(dat)/BTREE_PAGE_SIZE
|
||||
|
||||
for i in range(0, len(dat), BTREE_PAGE_SIZE):
|
||||
hexdump(dat[i:i+0x20])
|
||||
print ""
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user