diff options
| author | Ajax <commial@gmail.com> | 2015-03-05 16:02:23 +0100 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2015-03-05 16:31:26 +0100 |
| commit | 22df70de9fb343f5106b8da7c8c16a4dde5ea96c (patch) | |
| tree | 6aad3cb6f08261bbe3e2a746829afc9b8f0f9389 | |
| parent | 49e17c7e0f96ecf79d0a0d66d3ba162536c81d78 (diff) | |
| download | miasm-22df70de9fb343f5106b8da7c8c16a4dde5ea96c.tar.gz miasm-22df70de9fb343f5106b8da7c8c16a4dde5ea96c.zip | |
Example/IDA: Replace /tmp/ by tempfile.gettempdir (credits Joel Eriksson)
| -rw-r--r-- | example/ida/depgraph.py | 4 | ||||
| -rw-r--r-- | example/ida/graph_ir.py | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/example/ida/depgraph.py b/example/ida/depgraph.py index 33aaa6cb..edf4ce0b 100644 --- a/example/ida/depgraph.py +++ b/example/ida/depgraph.py @@ -1,4 +1,6 @@ import sys +import os +import tempfile from idaapi import GraphViewer from miasm2.core.bin_stream_ida import bin_stream_ida @@ -175,7 +177,7 @@ def treat_element(): sol_nb += 1 print "Get graph number %02d" % sol_nb - filename = "/tmp/solution_0x%08x_%02d.dot" % (addr, sol_nb) + filename = os.path.join(tempfile.gettempdir(), "solution_0x%08x_%02d.dot" % (addr, sol_nb)) print "Dump the graph to %s" % filename open(filename, "w").write(graph.graph.dot()) diff --git a/example/ida/graph_ir.py b/example/ida/graph_ir.py index 3a936e37..e7fd39d0 100644 --- a/example/ida/graph_ir.py +++ b/example/ida/graph_ir.py @@ -1,4 +1,6 @@ import sys +import os +import tempfile # Set your path first! sys.path.append("/home/serpilliere/tools/pyparsing/pyparsing-2.0.1/build/lib.linux-x86_64-2.7") @@ -144,7 +146,7 @@ for irb in ir_arch.blocs.values(): ir_arch.gen_graph() out = ir_arch.graph() -open('/tmp/graph.txt', 'w').write(out) +open(os.path.join(tempfile.gettempdir(), 'graph.txt'), 'wb').write(out) # ir_arch.dead_simp() |