forked from radareorg/radare2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Honor iomaps in search ranges and add basic awk bindings
Honor iomaps on search.to Initial import of the 'awk bindings' Honor search.{from|to}
- Loading branch information
Showing
4 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/awk -f | ||
|
||
# Configuration | ||
BEGIN { | ||
cpu="arm"; | ||
bits=32 | ||
offset=0 | ||
} | ||
# API | ||
function sys(cmd) { | ||
res = "" | ||
while((cmd|getline line)>0) { | ||
res=res""line"\n" | ||
} | ||
close(x) | ||
return res | ||
} | ||
|
||
function dis(x) { return sys("rasm2 -o "offset" -b "bits" -a "cpu" -d '"x"'"); } | ||
function asm(x) { return sys("rasm2 -o "offset" -b "bits" -a "cpu" '"x"'"); } | ||
function symbols(x) { return sys("rabin2 -vs '"x"'"); } | ||
function entry(x) { return sys("rabin2 -ve '"x"'"); } | ||
#TODO: function write(data,off) { return sys("rabin2 -ve '"x"'"); } | ||
|
||
function hexfind(file, x) { | ||
return sys("rafind2 -x '"x"' '"file"'|cut -d @ -f 2") | ||
} | ||
|
||
# Your program here | ||
BEGIN { | ||
cpu="x86" | ||
op=dis("90903939"); | ||
print("Commandline disassembler") | ||
split (hexfind("/bin/ls", "90"), results, / /) | ||
for (a in results) { | ||
print("--- "a) | ||
} | ||
} |