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

Functions

def to_hex (s)
 
def get_code (f, size)
 
def cs (md, code)
 
def cs_lite (md, code)
 

Variables

string FILE = '/usr/bin/python'
 
int TIMES = 64
 
tuple INTERVALS = (4, 5, 7, 9, 11, 13)
 
tuple all_tests
 
 cfile = open(FILE)
 
 request = sys.argv[1]
 
 md = Cs(arch, mode)
 
 detail
 
 syntax
 
def code = get_code(cfile, j * ii)
 

Function Documentation

◆ cs()

def fuzz.cs (   md,
  code 
)

Definition at line 66 of file fuzz.py.

66 def cs(md, code):
67  insns = md.disasm(code, 0)
68  for i in insns:
69  if i.address == 0x100000:
70  print i
71 
72 
def cs(md, code)
Definition: fuzz.py:66

◆ cs_lite()

def fuzz.cs_lite (   md,
  code 
)

Definition at line 73 of file fuzz.py.

73 def cs_lite(md, code):
74  insns = md.disasm_lite(code, 0)
75  for (addr, size, mnem, ops) in insns:
76  if addr == 0x100000:
77  print i
78 
79 
def cs_lite(md, code)
Definition: fuzz.py:73

◆ get_code()

def fuzz.get_code (   f,
  size 
)

Definition at line 56 of file fuzz.py.

56 def get_code(f, size):
57  code = f.read(size)
58  if len(code) != size: # reached end-of-file?
59  # then reset file position to begin-of-file
60  f.seek(0)
61  return None
62 
63  return code
64 
65 
size_t len
Definition: 6502dis.c:15
def get_code(f, size)
Definition: fuzz.py:56

References len.

◆ to_hex()

def fuzz.to_hex (   s)

Definition at line 50 of file fuzz.py.

50 def to_hex(s):
51  return " ".join("0x" + "{0:x}".format(ord(c)).zfill(2) for c in s) # <-- Python 3 is OK
52 
53 
54 # read @size bytes from @f & return data.
55 # return None when there is not enough data
def to_hex(s)
Definition: fuzz.py:50

Variable Documentation

◆ all_tests

tuple fuzz.all_tests
Initial value:
1 = (
2  (CS_ARCH_X86, CS_MODE_16, "X86-16bit (Intel syntax)", 0),
3  (CS_ARCH_X86, CS_MODE_16, "X86-16bit (ATT syntax)", CS_OPT_SYNTAX_ATT),
4  (CS_ARCH_X86, CS_MODE_32, "X86-32 (Intel syntax)", 0),
5  (CS_ARCH_X86, CS_MODE_32, "X86-32 (ATT syntax)", CS_OPT_SYNTAX_ATT),
6  (CS_ARCH_X86, CS_MODE_64, "X86-64 (Intel syntax)", 0),
7  (CS_ARCH_X86, CS_MODE_64, "X86-64 (ATT syntax)", CS_OPT_SYNTAX_ATT),
8  (CS_ARCH_ARM, CS_MODE_ARM, "ARM", 0),
9  (CS_ARCH_ARM, CS_MODE_THUMB, "THUMB (ARM)", 0),
10  (CS_ARCH_MIPS, CS_MODE_MIPS32 + CS_MODE_BIG_ENDIAN, "MIPS-32 (Big-endian)", 0),
11  (CS_ARCH_MIPS, CS_MODE_MIPS64 + CS_MODE_LITTLE_ENDIAN, "MIPS-64-EL (Little-endian)", 0),
12  (CS_ARCH_ARM64, CS_MODE_ARM, "ARM-64 (AArch64)", 0),
13  (CS_ARCH_PPC, CS_MODE_BIG_ENDIAN, "PPC", 0),
14  (CS_ARCH_PPC, CS_MODE_BIG_ENDIAN, "PPC, print register with number only", CS_OPT_SYNTAX_NOREGNAME),
15  (CS_ARCH_SPARC, CS_MODE_BIG_ENDIAN, "Sparc", 0),
16  (CS_ARCH_SYSZ, 0, "SystemZ", 0),
17  (CS_ARCH_XCORE, 0, "XCore", 0),
18  (CS_ARCH_M68K, 0, "M68K", 0),
19  )

Definition at line 28 of file fuzz.py.

◆ cfile

fuzz.cfile = open(FILE)

Definition at line 80 of file fuzz.py.

◆ code

def fuzz.code ( void  ) = get_code(cfile, j * ii)

Definition at line 103 of file fuzz.py.

◆ detail

fuzz.detail

Definition at line 92 of file fuzz.py.

◆ FILE

string fuzz.FILE = '/usr/bin/python'

Definition at line 23 of file fuzz.py.

◆ INTERVALS

tuple fuzz.INTERVALS = (4, 5, 7, 9, 11, 13)

Definition at line 26 of file fuzz.py.

◆ md

fuzz.md = Cs(arch, mode)

Definition at line 91 of file fuzz.py.

◆ request

fuzz.request = sys.argv[1]

Definition at line 84 of file fuzz.py.

◆ syntax

fuzz.syntax

Definition at line 95 of file fuzz.py.

◆ TIMES

int fuzz.TIMES = 64

Definition at line 25 of file fuzz.py.