File: test-bin-orig.py

package info (click to toggle)
radare2 0.9.6-3.1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 17,496 kB
  • ctags: 45,959
  • sloc: ansic: 240,999; sh: 3,645; makefile: 2,520; python: 1,212; asm: 312; ruby: 214; awk: 209; perl: 188; lisp: 169; java: 23; xml: 17; php: 6
file content (49 lines) | stat: -rw-r--r-- 942 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/python
from r_bin import *
import ctypes

a=RBin()
if not a.load("/bin/ls", False):
	print "Fuck. cannot load /bin/ls"
	exit(1)

print ("------")
info = a.get_info ()
print ("type: "+info.type)
print ("arch: "+info.arch)
print ("mach: "+info.machine)
print ("os: "+info.os)
print ("subsys: "+info.subsystem)

print ("------")

o = a.get_object ()
print ("object: "+str(o))

baddr= a.get_baddr ()
print ("base address: "+str(baddr))

sect = a.get_sections ()
#sect._o = addressof (sect)
print(dir(sect))

it = sect.iterator ()
print(dir(it))
while True:
	data = it.get_data ()
	print ("+++++",sect._o)
	ds = cast (data, POINTER(RBinSection)).contents
	print ("Section: ", ds.name)
	if it.n == None:
		print ("GO BREAK")
		break
	it = it.get_next ()

exit(0)
sect._o = addressof (sect)
print ("_________________O ",a._o)

print ("sections: "+str(sect))
print dir(sect)
#sectlist = cast(a, ctypes.c_void_p)
#print ("iter "+str(iter))