Rizin
unix-like reverse engineering framework and cli tools
x86odd Namespace Reference

Functions

def to_hex (s)
 
def test_cs_disasm_quick ()
 

Variables

string CODE32 = b"\xc0\xe0\x02"
 
string CODE32_MEMREF = b"\x8b\x84\x91\x23\x01\x00\x00"
 
string CODE64_MEMREF = b"\xa3\x0b\x00\x00\x0f\xbe\xc0\x48\x83"
 
string CODE32_ARITH = b"\x83\xe0\xf7"
 
string CODE64_ARITH = b"\x41\x83\xe0\xfa"
 
string CODE32_IMM = b"\xc2\xb8\xc0"
 
int _python3 = 3
 
tuple all_tests
 

Function Documentation

◆ test_cs_disasm_quick()

def x86odd.test_cs_disasm_quick ( )

Definition at line 92 of file x86odd.py.

93  for (arch, mode, code, comment, syntax) in all_tests:
94  print("Platform: %s" % comment)
95  print("Code: %s" %(to_hex(code))),
96  print("Disasm:")
97  md = Cs(arch, mode)
98  if syntax != 0:
99  md.syntax = syntax
100  for insn in md.disasm(code, 0x1000):
101  print("0x%x:\t%s\t%s" % (insn.address, insn.mnemonic, insn.op_str))
102  print("--------")
103 
104 
def to_hex(s)
Definition: x86odd.py:85
def test_cs_disasm_quick()
Definition: x86odd.py:92

References to_hex().

◆ to_hex()

def x86odd.to_hex (   s)

Definition at line 85 of file x86odd.py.

85 def to_hex(s):
86  if _python3:
87  return " ".join("0x{0:02x}".format(c) for c in s) # <-- Python 3 is OK
88  else:
89  return " ".join("0x{0:02x}".format(ord(c)) for c in s)
90 
91 # ## Test cs_disasm_quick()

Referenced by test_cs_disasm_quick().

Variable Documentation

◆ _python3

int x86odd._python3 = 3
private

Definition at line 67 of file x86odd.py.

◆ all_tests

tuple x86odd.all_tests
Initial value:
1 = (
2  (CS_ARCH_X86, CS_MODE_32, CODE32, "X86 32 (Intel syntax)", 0),
3  (CS_ARCH_X86, CS_MODE_32, CODE32, "X86 32 (ATT syntax)", CS_OPT_SYNTAX_ATT),
4 
5  (CS_ARCH_X86, CS_MODE_32, CODE32_MEMREF, "X86 32 MemRef (Intel syntax)", 0),
6  (CS_ARCH_X86, CS_MODE_32, CODE32_MEMREF, "X86 32 MemRef (ATT syntax)", CS_OPT_SYNTAX_ATT),
7  (CS_ARCH_X86, CS_MODE_64, CODE64_MEMREF, "X86 64 (Intel syntax)", 0),
8 
9  (CS_ARCH_X86, CS_MODE_32, CODE32_ARITH, "X86 32 (Intel syntax)", 0),
10  (CS_ARCH_X86, CS_MODE_64, CODE64_ARITH, "X86 64 (Intel syntax)", 0),
11 
12  (CS_ARCH_X86, CS_MODE_32, CODE32_IMM, "X86 32 (Intel syntax)", 0),
13  (CS_ARCH_X86, CS_MODE_32, CODE32_IMM, "X86 32 (Intel syntax)", CS_OPT_SYNTAX_ATT),
14 )

Definition at line 69 of file x86odd.py.

◆ CODE32

string x86odd.CODE32 = b"\xc0\xe0\x02"

Definition at line 8 of file x86odd.py.

◆ CODE32_ARITH

string x86odd.CODE32_ARITH = b"\x83\xe0\xf7"

Definition at line 53 of file x86odd.py.

◆ CODE32_IMM

string x86odd.CODE32_IMM = b"\xc2\xb8\xc0"

Definition at line 61 of file x86odd.py.

◆ CODE32_MEMREF

string x86odd.CODE32_MEMREF = b"\x8b\x84\x91\x23\x01\x00\x00"

Definition at line 42 of file x86odd.py.

◆ CODE64_ARITH

string x86odd.CODE64_ARITH = b"\x41\x83\xe0\xfa"

Definition at line 58 of file x86odd.py.

◆ CODE64_MEMREF

string x86odd.CODE64_MEMREF = b"\xa3\x0b\x00\x00\x0f\xbe\xc0\x48\x83"

Definition at line 50 of file x86odd.py.