-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds taint visualizer which reveals bitmaps of nudge dumps
- Loading branch information
1 parent
f9773c9
commit 6b40f8f
Showing
2 changed files
with
29 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import numpngw | ||
import operator | ||
import sys | ||
import numpy | ||
|
||
file = sys.argv[1] | ||
|
||
file = open(file).read() | ||
file = file.split("\n") | ||
|
||
# make sure it's the right type of file | ||
assert file[0].rstrip() == "TAINT DUMP" | ||
file = file[1:-1] | ||
def parse_line(i): | ||
i = i.rstrip().split(" ") | ||
assert i[0] == "APP" and \ | ||
i[2] == "SHADOW" | ||
return int(i[1], 16), i[4] | ||
mappings = map(parse_line, file) | ||
|
||
for n,shadow in mappings: | ||
shadow = map(ord, shadow) | ||
shadow = numpy.asarray(shadow, | ||
dtype=numpy.uint8) | ||
shadow.resize(256, 64) | ||
|
||
numpngw.write_png("app_{:x}.png".format(n), | ||
shadow, bitdepth=1) |