This file is indexed.

/usr/share/doc/radare-doc/html/Section10.6.2.html is in radare-doc 1:1.5.2-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=US-ASCII">
<title>radapy (remote api)</title>
<link rel="previous" href="Section10.6.1.html">
<link rel="ToC" href="contents.html">
<link rel="next" href="Section10.6.3.html">
</head>
<body>
<h1><a name="python-radapy"></a>10.6.2 radapy (remote api)</h1>
<p>
There are some extension APIs that uses r.cmd() as entrypoint in python radare, these are:
</p>
<pre><code>radapy   - client/server radare remote protocolo (rap://) implementation in pure python
ranal    - code analysis object-oriented api
radare   - commands aliased with userfriendly function names
</code></pre>
<p>
As all those apis remains on r.cmd() to work (but radapy), you can use radapy to redefine the 'r' instance and make radare and ranal APIs work remotely or locally seamlessly.
</p>
<p>
The radapy API is used to implement radare servers or clients in python scripting. Here's a client example:
</p>
<pre><code>import sys
sys.path.append('.')
import radapy

c = radapy.RapClient('localhost', 9999)
fd = c.open("/bin/ls", 0)
print c.cmd("px")
c.close(fd)
c.disconnect()
</code></pre>
<p>
Here's another example in python that hijacks the 'r' instance of radare api and proxies all the commands via network to a remote radare:
</p>
<pre><code>hijack=1

import radare
import ranal
import radapy

# r.cmd() hijacking
if hijack:
        class Food:
                def cmd(str):
                        global c
                        print "Command to run is (%s)"%str
                        return c.cmd(str)
                cmd = staticmethod(cmd)
        global r
        radare.r = Food


c = radapy.RapClient("localhost", 9999)

fd = c.open("/bin/ls", 0)
print c.cmd("px")
print radare.r.cmd("pd 20")
radare.seek(33)
print radare.disasm(0, 10)

c.close(fd)
c.disconnect()
</code></pre>
<p>
The program expects to have radare server running at port 9999 in localhost. This is: 'radare rap://:9999' or 'radare listen://:9999'
</p>
<p>
The server-side is a bit more complicated to manage because it aims to implement a remote-io with support for remote commands and system execution thru the network. The following example shows implements a radare server that ignores any 'open' or 'close' operation but provides access to a local buffer (python string) as the remote file contents.
</p>
<p>
The seeking can be hooked, but by default radapy API implements a basic failover and tracks the value of current seek on a local variable of the radapy instance.
</p>
<pre><code>import radapy
from string import *

PORT = 8888

def fun_write(buf):
	print "WRITING %d bytes (%s)"%(len(buf),buf)
	return 6

def fun_read(len):
	global rs
	print "READ %d bytes from %d\n"% (len, rs.offset)
	str = "patata"
	str = str[rs.offset:]
	return str


# main

rs = radapy.RapServer()
rs.handle_cmd_read = fun_read
rs.handle_cmd_write = fun_write
rs.size = 10
rs.listen_tcp (PORT)
</code></pre>
<p>
Using the radapy API you can easily make any python-based application interact with radare. This is for example: IDA, Inmunity Debugger, Bochs, etc..
</p>
<p>
The bochs-radare support is actually implement in a script that provides works as a bridge between the ero's python patch for bochs and radare. The details of this are described in the 'Debugging with bochs and python' chapter.
</p>
<p>
See 'scripts/radapy_bochs.py' for more information.
</p>

<!-- version IDs:
$Id: radare.but 2009-04-25 pancake $
-->
</body>
</html>