From 48691ea74855a919245ea5dc173ef7f9a82c47a7 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Tue, 9 May 2017 22:25:48 -0400 Subject: style tweaks and banner at the bottom of svgs --- python/examples/export_svg.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'python') 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 += ' \n'.format(type=BranchType(edge.type).name, points=points) output += ' ' + edges + '\n' output += ' \n' - output += '' + output += '' + + output += '

This CFG generated by Binary Ninja from {filename} on {timestring}.

'.format(filename = origname, timestring = time.strftime("%c")) + output += '' return output -- cgit v1.3.1