<s> from capstone import * <EOL> from binascii import hexlify <EOL> def disasNOTintel ( shellcode , choice , bits = <NUM_LIT:32> ) : <EOL> ARCH = { <EOL> '<STR_LIT>' : CS_ARCH_ARM , <EOL> '<STR_LIT>' : CS_ARCH_ARM64 , <EOL> '<STR_LIT>' : CS_ARCH_MIPS , <EOL> '<STR_LIT>' : CS_ARCH_PPC , <EOL> '<STR_LIT>' : CS_ARCH_X86 , <EOL> '<STR_LIT>' : CS_ARCH_XCORE <EOL> } <EOL> MODE = { <EOL> '<STR_LIT>' : CS_MODE_16 , <EOL> '<STR_LIT>' : CS_MODE_32 , <EOL> '<STR_LIT>' : CS_MODE_64 , <EOL> '<STR_LIT>' : CS_MODE_ARM , <EOL> '<STR_LIT>' : CS_MODE_BIG_ENDIAN , <EOL> '<STR_LIT>' : CS_MODE_LITTLE_ENDIAN , <EOL> '<STR_LIT>' : CS_MODE_MICRO , <EOL> '<STR_LIT>' : CS_MODE_THUMB <EOL> } <EOL> if choice == "<STR_LIT>" : <EOL> if bits == <NUM_LIT:64> : <EOL> md = Cs ( CS_ARCH_ARM64 , CS_MODE_ARM ) <EOL> else : <EOL> md = Cs ( CS_ARCH_ARM32 , CS_MODE_ARM ) <EOL> else : <EOL> if bits == <NUM_LIT:64> : <EOL> md = Cs ( CS_ARCH_MIPS , CS_MODE_64 ) <EOL> else : <EOL> md = Cs ( CS_ARCH_MIPS , CS_MODE_32 ) <EOL> list = [ ] <EOL> for i in md . disasm ( shellcode , <NUM_LIT> ) : <EOL> if len ( i . mnemonic ) <= <NUM_LIT:3> : <EOL> db = "<STR_LIT>" % ( i . address , hexlify ( i . bytes ) , i . mnemonic , i . op_str ) <EOL> else : <EOL> db = "<STR_LIT>" % ( i . address , hexlify ( i . bytes ) , i . mnemonic , i . op_str ) <EOL> list . append ( db ) <EOL> return "<STR_LIT:\n>" . join ( list ) </s>
