Skip to content

Commit

Permalink
Add: scripts to scan ghidra generated source
Browse files Browse the repository at this point in the history
  • Loading branch information
Yangff committed Jul 19, 2021
1 parent 55c01a3 commit 1169dbf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions script/extract_funcs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ctags --fields=+ne -o - --sort=no ../blobs/bl602_demo_wifi.ghidra.c | sed -r 's/([^\t]+).*line:([0-9]+).*end:([0-9]+)/\1 \2 \3/'

23 changes: 23 additions & 0 deletions script/getfuncs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python3
import sys
src = open('../blobs/bl602_demo_wifi.ghidra.c').readlines()

feature = 'DAT_44c0'
if len(sys.argv) == 2:
feature = sys.argv[1]

outs = []
for i in sys.stdin.readlines():
fname, begin, end = i.strip().split(' ')
begin = int(begin) - 1
end = int(end)
slocal = src[begin:end]
found = False
for i in slocal:
if i.find(feature) != -1:
found = True
break
if found:
outs.extend(slocal)

print(''.join(outs))

0 comments on commit 1169dbf

Please sign in to comment.