From d0a21b0738db10c38d20bb9ebeafd5fb8e72fc3a Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Thu, 8 Jan 2015 17:07:17 +0100 Subject: Example/Disasm_02: Comment and expand variables names --- example/disasm_02.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'example/disasm_02.py') diff --git a/example/disasm_02.py b/example/disasm_02.py index 5bfd77de..0d443c26 100644 --- a/example/disasm_02.py +++ b/example/disasm_02.py @@ -1,13 +1,18 @@ from miasm2.arch.x86.disasm import dis_x86_32 from miasm2.core.asmbloc import bloc2graph - -s = '\xb8\xef\xbe7\x13\xb9\x04\x00\x00\x00\xc1\xc0\x08\xe2\xfb\xc3' -mdis = dis_x86_32(s) +# MOV EAX, 0x1337BEEF +# MOV ECX, 0x4 +# loop: +# ROL EAX, 0x8 +# LOOP loop +# RET +shellcode = '\xb8\xef\xbe7\x13\xb9\x04\x00\x00\x00\xc1\xc0\x08\xe2\xfb\xc3' +mdis = dis_x86_32(shellcode) blocs = mdis.dis_multibloc(0) -for b in blocs: - print b +for bloc in blocs: + print bloc -g = bloc2graph(blocs) -open('graph.txt', 'w').write(g) +graph = bloc2graph(blocs) +open('graph.txt', 'w').write(graph) -- cgit 1.4.1 From 17258a346c5ecf423b0758f5de6cf56f423b9e88 Mon Sep 17 00:00:00 2001 From: Camille Mougey Date: Thu, 8 Jan 2015 17:11:11 +0100 Subject: Example: Rename Disasm_02 to Disasm Function --- example/disasm_02.py | 18 ------------------ example/disasm_function.py | 18 ++++++++++++++++++ test/test_all.py | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) delete mode 100644 example/disasm_02.py create mode 100644 example/disasm_function.py (limited to 'example/disasm_02.py') diff --git a/example/disasm_02.py b/example/disasm_02.py deleted file mode 100644 index 0d443c26..00000000 --- a/example/disasm_02.py +++ /dev/null @@ -1,18 +0,0 @@ -from miasm2.arch.x86.disasm import dis_x86_32 -from miasm2.core.asmbloc import bloc2graph - -# MOV EAX, 0x1337BEEF -# MOV ECX, 0x4 -# loop: -# ROL EAX, 0x8 -# LOOP loop -# RET -shellcode = '\xb8\xef\xbe7\x13\xb9\x04\x00\x00\x00\xc1\xc0\x08\xe2\xfb\xc3' -mdis = dis_x86_32(shellcode) -blocs = mdis.dis_multibloc(0) - -for bloc in blocs: - print bloc - -graph = bloc2graph(blocs) -open('graph.txt', 'w').write(graph) diff --git a/example/disasm_function.py b/example/disasm_function.py new file mode 100644 index 00000000..0d443c26 --- /dev/null +++ b/example/disasm_function.py @@ -0,0 +1,18 @@ +from miasm2.arch.x86.disasm import dis_x86_32 +from miasm2.core.asmbloc import bloc2graph + +# MOV EAX, 0x1337BEEF +# MOV ECX, 0x4 +# loop: +# ROL EAX, 0x8 +# LOOP loop +# RET +shellcode = '\xb8\xef\xbe7\x13\xb9\x04\x00\x00\x00\xc1\xc0\x08\xe2\xfb\xc3' +mdis = dis_x86_32(shellcode) +blocs = mdis.dis_multibloc(0) + +for bloc in blocs: + print bloc + +graph = bloc2graph(blocs) +open('graph.txt', 'w').write(graph) diff --git a/test/test_all.py b/test/test_all.py index 7802bf1c..c2b3387b 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -114,7 +114,7 @@ testset += test_box_enc testset += test_msp430 testset += test_mips32 for script in [["disasm_single_instr.py"], - ["disasm_02.py"], + ["disasm_function.py"], ["disasm_03.py", Example.get_sample("box_upx.exe"), "0x410f90"], ]: testset += Example(script) -- cgit 1.4.1