Suspicious 90% python Download

r2pipe 0.9.7

Legitimate radare2 Python interface

Basename is uppercase README.mdPasses direct-IP URL to a call

Evidence

Markdown-style heading precedes a code fence README.md · lines 1–29
1r2pipe for Python
2=================
3
4Interact with radare2 using the #!pipe command or in standalone scripts
5that communicate with local or remote r2 via pipe, tcp or http.
6
7### Installation
8
9```
10$ pip install r2pipe
11```
12
13or
14
15```
16$ pip3 install r2pipe
17```
18
19### Usage example:
20
21```python
22import r2pipe
23
24r2 = r2pipe.open("/bin/ls")
25r2.cmd('aa')
26print(r2.cmd("afl"))
27print(r2.cmdj("aflj")) # evaluates JSONs and returns an object
28r2.quit()
29```
imports byref from ctypes __init__.py · lines 1–48
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4"""r2pipe
5
6This module provides an API to interact with the radare2
7commandline interface from Python using a pipe.
8
9The pipe can be connected to the parent process to run
10Python scripts from the radare2 shell itself, or it can
11spawn a new process, connect via HTTP to a remote r2 http
12server, etc.
13
14Some r2 commands display the information in JSON, that's
15why r2pipe provides `-j` methods to directly parse it
16and return a native Python object.
17
18Example:
19 $ python
20 > import r2pipe
21 > r = r2pipe.open("/bin/ls")
22 > print(r.cmd("pd 10"))
23 > print(r.cmdj("aoj")[0]['size'])
24 > r.quit()
25"""
26
27import os
28import re
29import sys
30import time
31import json
32import socket
33import urllib
34from io import TextIOWrapper
35from subprocess import Popen, PIPE
36try:
37 import r2lang
38except:
39 r2lang = None
40try:
41 import fcntl
42except:
43 fcntl = None
44try:
45 from .native import RCore
46 has_native = True
47except:
48 has_native = False
Hard-coded HTTP command endpoint URL __init__.py · lines 90–97
90:2… def __init__(self, filename='', flags=[]):
91 """Open a new r2 pipe
92 The 'filename' can be one of the following:
93
94 * absolute or relative path to file
95 * http://<host>:<port>/cmd to connect to an r2 webserver
96 * tcp://<host>:<port> to connect to an r2 tcp server
97 * #!pipe when launching it from r2 via RL …
Wait for named pipe server __init__.py · lines 118–124
118:58… Y):
119 print("Could not open pipe")
120 return
121 elif ((windll.kernel32.WaitNamedPipeA(szPipename, 20000)) == 0):
122 print("Could not open pipe\n")
123 return
124 windll.kernel32.WriteFile(hPipe, "e scr.color= …
exception suppression via try/except pass __init__.py · lines 130–137
130 self._cmd = self._cmd_pipe
131 self.url = "#!pipe"
132 return
133 except:
134 pass
135 if filename.startswith("#!pipe"):
136 raise Exception("ERROR: Cannot use #!pipe without R2PIPE_{IN|OUT} env")
137 if filename.st …

No evidence locations were recorded for this file. Raw result

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.