@@ -30,7 +30,7 @@ Miasm is a free and open source (GPLv2) reverse engineering framework.
3030Miasm aims to analyze / modify / generate binary programs. Here is
3131a non exhaustive list of features:
3232
33- * Opening / modifying / generating PE / ELF 32 / 64 LE / BE using Elfesteem
33+ * Opening / modifying / generating PE / ELF 32 / 64 LE / BE
3434* Assembling / Disassembling X86 / ARM / MIPS / SH4 / MSP430
3535* Representing assembly semantic using intermediate language
3636* Emulating using JIT (dynamic code analysis, unpacking, ...)
@@ -47,8 +47,8 @@ Assembling / Disassembling
4747
4848Import Miasm x86 architecture:
4949``` pycon
50- >>> from miasm2 .arch.x86.arch import mn_x86
51- >>> from miasm2 .core.locationdb import LocationDB
50+ >>> from miasm .arch.x86.arch import mn_x86
51+ >>> from miasm .core.locationdb import LocationDB
5252```
5353Get a location db:
5454
@@ -58,38 +58,38 @@ Get a location db:
5858Assemble a line:
5959``` pycon
6060>>> l = mn_x86.fromstring(' XOR ECX, ECX' , loc_db, 32 )
61- >>> print l
61+ >>> print (l)
6262XOR ECX, ECX
6363>>> mn_x86.asm(l)
6464['1\xc9', '3\xc9', 'g1\xc9', 'g3\xc9']
6565```
6666Modify an operand:
6767``` pycon
6868>>> l.args[0 ] = mn_x86.regs.EAX
69- >>> print l
69+ >>> print (l)
7070XOR EAX, ECX
7171>>> a = mn_x86.asm(l)
72- >>> print a
72+ >>> print (a)
7373['1\xc8', '3\xc1', 'g1\xc8', 'g3\xc1']
7474```
7575Disassemble the result:
7676``` pycon
77- >>> print mn_x86.dis(a[0 ], 32 )
77+ >>> print ( mn_x86.dis(a[0 ], 32 ) )
7878XOR EAX, ECX
7979```
8080Using ` Machine ` abstraction:
8181
8282``` pycon
83- >>> from miasm2 .analysis.machine import Machine
83+ >>> from miasm .analysis.machine import Machine
8484>>> mn = Machine(' x86_32' ).mn
85- >>> print mn.dis(' \x33\x30 ' , 32 )
85+ >>> print ( mn.dis(' \x33\x30 ' , 32 ) )
8686XOR ESI, DWORD PTR [EAX]
8787```
8888
8989For Mips:
9090``` pycon
9191>>> mn = Machine(' mips32b' ).mn
92- >>> print mn.dis(' 97A30020 ' .decode( ' hex ' ) , " b" )
92+ >>> print ( mn.dis(b ' \x97\xa3\x00 ' , " b" ) )
9393LHU V1, 0x20(SP)
9494```
9595Intermediate representation
@@ -99,8 +99,8 @@ Create an instruction:
9999
100100``` pycon
101101>>> machine = Machine(' arml' )
102- >>> instr = machine.mn.dis(' 002088e0 ' .decode( ' hex ' ) , ' l' )
103- >>> print instr
102+ >>> instr = machine.mn.dis(' \x00 \x88\xe0 ' , ' l' )
103+ >>> print ( instr)
104104ADD R2, R8, R0
105105```
106106
@@ -120,7 +120,7 @@ Add instruction to the pool:
120120Print current pool:
121121``` pycon
122122>>> for lbl, irblock in ircfg.blocks.items():
123- ... print irblock.to_string(loc_db)
123+ ... print ( irblock.to_string(loc_db) )
124124loc_0:
125125R2 = R8 + R0
126126
@@ -133,9 +133,9 @@ Working with IR, for instance by getting side effects:
133133... for assignblk in irblock:
134134... rw = assignblk.get_rw()
135135... for dst, reads in rw.iteritems():
136- ... print ' read: ' , [str (x) for x in reads]
137- ... print ' written:' , dst
138- ... print
136+ ... print ( ' read: ' , [str (x) for x in reads])
137+ ... print ( ' written:' , dst)
138+ ... print ()
139139...
140140read: ['R8', 'R0']
141141written: R2
@@ -164,21 +164,21 @@ Giving a shellcode:
164164Import the shellcode thanks to the ` Container ` abstraction:
165165
166166``` pycon
167- >>> from miasm2 .analysis.binary import Container
167+ >>> from miasm .analysis.binary import Container
168168>>> c = Container.from_string(s)
169169>>> c
170- <miasm2 .analysis.binary.ContainerUnknown object at 0x7f34cefe6090>
170+ <miasm .analysis.binary.ContainerUnknown object at 0x7f34cefe6090>
171171```
172172
173173Disassembling the shellcode at address ` 0 ` :
174174
175175``` pycon
176- >>> from miasm2 .analysis.machine import Machine
176+ >>> from miasm .analysis.machine import Machine
177177>>> machine = Machine(' x86_32' )
178178>>> mdis = machine.dis_engine(c.bin_stream)
179179>>> asmcfg = mdis.dis_multiblock(0 )
180180>>> for block in asmcfg.blocks:
181- ... print block.to_string(asmcfg.loc_db)
181+ ... print ( block.to_string(asmcfg.loc_db) )
182182...
183183loc_0
184184LEA ECX, DWORD PTR [ECX + 0x4]
@@ -208,7 +208,7 @@ Initializing the Jit engine with a stack:
208208Add the shellcode in an arbitrary memory location:
209209``` pycon
210210>>> run_addr = 0x 40000000
211- >>> from miasm2 .jitter.csts import PAGE_READ , PAGE_WRITE
211+ >>> from miasm .jitter.csts import PAGE_READ , PAGE_WRITE
212212>>> jitter.vm.add_memory_page(run_addr, PAGE_READ | PAGE_WRITE , s)
213213```
214214
@@ -284,15 +284,15 @@ Initializing the IR pool:
284284Initializing the engine with default symbolic values:
285285
286286``` pycon
287- >>> from miasm2 .ir.symbexec import SymbolicExecutionEngine
287+ >>> from miasm .ir.symbexec import SymbolicExecutionEngine
288288>>> sb = SymbolicExecutionEngine(ira)
289289```
290290
291291Launching the execution:
292292
293293``` pycon
294294>>> symbolic_pc = sb.run_at(ircfg, 0 )
295- >>> print symbolic_pc
295+ >>> print ( symbolic_pc)
296296((ECX + 0x4)[0:8] + 0xFF)?(0xB,0x10)
297297```
298298
@@ -355,7 +355,7 @@ ________________________________________________________________________________
355355Retry execution with a concrete ECX. Here, the symbolic / concolic execution reach the shellcode's end:
356356
357357``` pycon
358- >>> from miasm2 .expression.expression import ExprInt
358+ >>> from miasm .expression.expression import ExprInt
359359>>> sb.symbols[machine.mn.regs.ECX ] = ExprInt(- 3 , 32 )
360360>>> symbolic_pc = sb.run_at(ircfg, 0 , step = True )
361361Instr LEA ECX, DWORD PTR [ECX + 0x4]
@@ -525,7 +525,6 @@ Miasm uses:
525525
526526* python-pyparsing
527527* python-dev
528- * elfesteem from [ Elfesteem] ( https://github.com/serpilliere/elfesteem.git )
529528* optionally python-pycparser (version >= 2.17)
530529
531530To enable code JIT, one of the following module is mandatory:
@@ -539,14 +538,6 @@ To enable code JIT, one of the following module is mandatory:
539538Configuration
540539-------------
541540
542- * Install elfesteem
543- ``` pycon
544- git clone https://github.com/serpilliere/elfesteem.git elfesteem
545- cd elfesteem
546- python setup.py build
547- sudo python setup.py install
548- ```
549-
550541To use the jitter, GCC or LLVM is recommended
551542* GCC (any version)
552543* Clang (any version)
@@ -570,8 +561,8 @@ Windows & IDA
570561
571562Most of Miasm's IDA plugins use a subset of Miasm functionality.
572563A quick way to have them working is to add:
573- * ` elfesteem ` directory and ` pyparsing.py ` to ` C:\...\IDA\python\ ` or ` pip install pyparsing elfesteem `
574- * ` miasm2/miasm2 ` directory to ` C:\...\IDA\python\ `
564+ * ` pyparsing.py ` to ` C:\...\IDA\python\ ` or ` pip install pyparsing `
565+ * ` miasm/miasm ` directory to ` C:\...\IDA\python\ `
575566
576567All features excepting JITter related ones will be available. For a more complete installation, please refer to above paragraphs.
577568
@@ -598,7 +589,7 @@ Tools
598589-----
599590
600591* [ Sibyl] ( https://github.com/cea-sec/Sibyl ) : A function divination too
601- * [ R2M2] ( https://github.com/guedou/r2m2 ) : Use miasm2 as a radare2 plugin
592+ * [ R2M2] ( https://github.com/guedou/r2m2 ) : Use miasm as a radare2 plugin
602593* [ CGrex] ( https://github.com/mechaphish/cgrex ) : Targeted patcher for CGC binaries
603594* [ ethRE] ( https://github.com/jbcayrou/ethRE ) Reversing tool for Ethereum EVM (with corresponding Miasm2 architecture)
604595
0 commit comments