diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2017-05-09 22:25:48 -0400 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2017-05-09 22:25:48 -0400 |
| commit | 48691ea74855a919245ea5dc173ef7f9a82c47a7 (patch) | |
| tree | 572904d45503c115e46eb7e620605d55360051e3 /python/examples | |
| parent | 7bc394fc4490920bac688234f5c4c23901ab84c7 (diff) | |
style tweaks and banner at the bottom of svgs
Diffstat (limited to 'python/examples')
| -rwxr-xr-x | python/examples/export_svg.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/python/examples/export_svg.py b/python/examples/export_svg.py index 95e2d62d..7814c9fd 100755 --- a/python/examples/export_svg.py +++ b/python/examples/export_svg.py @@ -1,6 +1,7 @@ # from binaryninja import * import os import webbrowser +import time try: from urllib import pathname2url # Python 2.x except: @@ -34,7 +35,7 @@ def save_svg(bv, function): outputfile = get_save_filename_input('File name for export_svg', 'HTML files (*.html)', filename) if outputfile is None: return - content = render_svg(function) + content = render_svg(function, origname) output = open(outputfile, 'w') output.write(content) output.close() @@ -54,7 +55,7 @@ def instruction_data_flow(function, address): return 'Opcode: {bytes}'.format(bytes=padded) -def render_svg(function): +def render_svg(function, origname): graph = function.create_graph() graph.layout_and_wait() heightconst = 15 @@ -67,7 +68,13 @@ def render_svg(function): @import url(https://fonts.googleapis.com/css?family=Source+Code+Pro); body { background-color: rgb(42, 42, 42); + color: rgb(220, 220, 220); + font-family: "Source Code Pro", "Lucida Console", "Consolas", monospace; } + a, a:visited { + color: rgb(200, 200, 200); + font-weight: bold; + } svg { background-color: rgb(42, 42, 42); display: block; @@ -101,7 +108,7 @@ def render_svg(function): fill: currentColor; } text { - font-family: 'Source Code Pro'; + font-family: "Source Code Pro", "Lucida Console", "Consolas", monospace; font-size: 9pt; fill: rgb(224, 224, 224); } @@ -207,7 +214,10 @@ def render_svg(function): edges += ' <polyline class="edge {type}" points="{points}" marker-end="url(#arrow-{type})"/>\n'.format(type=BranchType(edge.type).name, points=points) output += ' ' + edges + '\n' output += ' </g>\n' - output += '</svg></html>' + output += '</svg>' + + output += '<p>This CFG generated by <a href="https://binary.ninja/">Binary Ninja</a> from {filename} on {timestring}.</p>'.format(filename = origname, timestring = time.strftime("%c")) + output += '</html>' return output |
