├── r2-program-libr-c ├── README.md ├── Makefile └── test.c ├── r2-script-lang-c ├── README.md ├── Makefile └── test.c ├── r2-plugin-core-ts ├── .gitignore ├── package.json ├── .vscode │ ├── jsconfig.json │ └── launch.json ├── tsconfig.json ├── Makefile ├── src │ └── coreplug.r2.ts └── package-lock.json ├── r2-script-lang-nim ├── README.md ├── Makefile └── src │ ├── main.nim │ └── r2papi.nim ├── r2-plugin-io-js ├── README.md ├── Makefile ├── .vscode │ ├── jsconfig.json │ └── launch.json ├── package.json ├── src │ └── myio.r2.js └── package-lock.json ├── r2-plugin-parse-js ├── Makefile ├── README.md └── parse.r2.js ├── r2frida-plugin-cmd-js ├── .gitignore ├── .vscode │ ├── jsconfig.json │ └── launch.json ├── Makefile ├── package.json ├── src │ └── r2f-newcmd.js └── package-lock.json ├── r2-program-libr-v ├── Makefile ├── v.mod └── r2hello.v ├── r2-plugin-core-py ├── Makefile ├── README.md └── coreplug.py ├── r2-plugin-io-py ├── Makefile ├── README.md └── ioplug.py ├── r2-plugin-arch-py ├── Makefile ├── README.md └── archplug.py ├── r2-plugin-core-js ├── Makefile ├── package.json ├── src │ └── coreplug.r2.js └── package-lock.json ├── r2-script-r2pipe-nodejs ├── Makefile ├── example.js ├── package.json └── package-lock.json ├── r2-script-r2pipe-ts ├── Makefile ├── package.json ├── test-spawn.ts └── tsconfig.json ├── r2-plugin-core-swift ├── Sources │ ├── CRadare2 │ │ ├── module.modulemap │ │ ├── shim.h │ │ └── CoreHelloShim.c │ └── CoreHello │ │ ├── R2API.swift │ │ └── CoreHello.swift ├── Makefile ├── README.md └── Package.swift ├── r2ai-script-cmd-py ├── README.md ├── Makefile └── plugin.py ├── r2-script-r2papi-ts ├── .vscode │ ├── jsconfig.json │ └── launch.json ├── Makefile ├── package.json ├── tsconfig.json ├── src │ └── test.r2.ts └── package-lock.json ├── r2frida-plugin-cmd-ts ├── package.json ├── Makefile ├── src │ └── r2f-newcmd.ts └── package-lock.json ├── r2-plugin-io-c ├── README.md ├── meson.build ├── Makefile └── src │ └── io_hello.c ├── r2-plugin-bin-c ├── README.md ├── meson.build ├── Makefile └── src │ └── bin_hello.c ├── r2-plugin-core-c ├── README.md ├── meson.build ├── Makefile └── src │ └── core_hello.c ├── r2-script-r2pipe-swift ├── Makefile ├── Sources │ └── main.swift └── Package.swift ├── r2-plugin-core-go ├── meson.build ├── Makefile ├── src │ ├── core_hello.go │ ├── core_hello_shim.go │ └── core_hello.h └── README.md ├── r2-script-r2pipe-c ├── Makefile ├── main.c └── README.md ├── r2-plugin-parse-c ├── meson.build ├── README.md ├── Makefile └── src │ └── parse_hello.c ├── README.md ├── Makefile ├── r2-script-r2pipe-rust ├── Cargo.toml ├── src │ └── main.rs └── Cargo.lock └── r2skel /r2-program-libr-c/README.md: -------------------------------------------------------------------------------- 1 | # R2 script in C 2 | -------------------------------------------------------------------------------- /r2-script-lang-c/README.md: -------------------------------------------------------------------------------- 1 | # R2 script in C 2 | -------------------------------------------------------------------------------- /r2-plugin-core-ts/.gitignore: -------------------------------------------------------------------------------- 1 | src/coreplug.r2.js 2 | -------------------------------------------------------------------------------- /r2-script-lang-nim/README.md: -------------------------------------------------------------------------------- 1 | rlang script in nim 2 | -------------------------------------------------------------------------------- /r2-script-lang-c/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | r2 -qi test.c - 3 | -------------------------------------------------------------------------------- /r2-plugin-io-js/README.md: -------------------------------------------------------------------------------- 1 | io plugin in javascript for radare2 2 | -------------------------------------------------------------------------------- /r2-plugin-parse-js/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | r2 -qi parse.r2.js /bin/ls 3 | -------------------------------------------------------------------------------- /r2frida-plugin-cmd-js/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | src/coreplug.r2.js 3 | -------------------------------------------------------------------------------- /r2-program-libr-v/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | v r2hello.v || v install 3 | ./r2hello 4 | 5 | -------------------------------------------------------------------------------- /r2-plugin-core-py/Makefile: -------------------------------------------------------------------------------- 1 | PYTHON?=python3 2 | 3 | all: 4 | r2 -qcq -i coreplug.py /bin/ls 5 | -------------------------------------------------------------------------------- /r2-plugin-io-py/Makefile: -------------------------------------------------------------------------------- 1 | PYTHON?=python3 2 | 3 | all: 4 | r2 -qcq -I ioplug.py pyio://33 5 | -------------------------------------------------------------------------------- /r2-plugin-arch-py/Makefile: -------------------------------------------------------------------------------- 1 | PYTHON?=python3 2 | 3 | all: 4 | r2 -I archplug.py -a pyarch malloc://10000 5 | -------------------------------------------------------------------------------- /r2-script-lang-nim/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | r2 -qi src/main.nim /bin/ls 3 | 4 | clean: 5 | rm -f src/*.qjs src/*.r2.js 6 | -------------------------------------------------------------------------------- /r2-plugin-io-js/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | r2 -q -I src/myio.r2.js myio://123 3 | 4 | open: 5 | open -a "Visual Studio Code" . 6 | -------------------------------------------------------------------------------- /r2-plugin-core-js/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | r2 -q -i src/coreplug.r2.js /bin/ls 3 | 4 | vs open: 5 | open -a "Visual Studio Code" . 6 | -------------------------------------------------------------------------------- /r2-script-r2pipe-nodejs/Makefile: -------------------------------------------------------------------------------- 1 | all: node_modules 2 | npm run script 3 | 4 | node_modules: 5 | mkdir node_modules 6 | npm i 7 | -------------------------------------------------------------------------------- /r2-script-r2pipe-ts/Makefile: -------------------------------------------------------------------------------- 1 | all: node_modules 2 | tsc test-spawn.ts 3 | 4 | node_modules: 5 | mkdir node_modules 6 | npm i 7 | -------------------------------------------------------------------------------- /r2-plugin-core-swift/Sources/CRadare2/module.modulemap: -------------------------------------------------------------------------------- 1 | module CRadare2 { 2 | header "shim.h" 3 | link "r_core" 4 | export * 5 | } -------------------------------------------------------------------------------- /r2-program-libr-c/Makefile: -------------------------------------------------------------------------------- 1 | R2_FLAGS=$(shell pkg-config --cflags --libs r_core) 2 | 3 | all: 4 | $(CC) test.c $(R2_FLAGS) -o test 5 | ./test 6 | -------------------------------------------------------------------------------- /r2-program-libr-v/v.mod: -------------------------------------------------------------------------------- 1 | Module { 2 | name: 'test', 3 | description: 'hello world using v api', 4 | dependencies: ['radare.r2'] 5 | } 6 | 7 | -------------------------------------------------------------------------------- /r2ai-script-cmd-py/README.md: -------------------------------------------------------------------------------- 1 | # r2ai plugin 2 | 3 | r2ai can be extended in python. 4 | 5 | This directory contains a program that interacts with r2 and r2ai. 6 | -------------------------------------------------------------------------------- /r2-plugin-core-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first r2 script", 3 | "devDependencies": { 4 | "r2papi": "^0.3.2", 5 | "@types/node": "^20.9.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /r2-plugin-core-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first r2 script", 3 | "devDependencies": { 4 | "r2papi": "^0.4.9", 5 | "@types/node": "^20.9.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /r2-plugin-io-js/.vscode/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6" 5 | }, 6 | "exclude": ["node_modules"] 7 | } 8 | -------------------------------------------------------------------------------- /r2-plugin-core-ts/.vscode/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6" 5 | }, 6 | "exclude": ["node_modules"] 7 | } 8 | -------------------------------------------------------------------------------- /r2-script-r2papi-ts/.vscode/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | }, 6 | "exclude": ["node_modules"] 7 | } 8 | -------------------------------------------------------------------------------- /r2frida-plugin-cmd-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first r2frida plugin", 3 | "version": "0.0.1", 4 | "devDependencies": { 5 | "@types/node": "^20.9.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /r2frida-plugin-cmd-js/.vscode/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | }, 6 | "exclude": ["node_modules"] 7 | } 8 | -------------------------------------------------------------------------------- /r2-plugin-io-c/README.md: -------------------------------------------------------------------------------- 1 | # Sample IO plugin in C 2 | 3 | This directory contains a basic IO plugin for radare2 written in C. 4 | 5 | Use this as a template and extend it for your needs. 6 | -------------------------------------------------------------------------------- /r2-plugin-bin-c/README.md: -------------------------------------------------------------------------------- 1 | # Sample RBin plugin in C 2 | 3 | This directory contains a basic RBin plugin for radare2 written in C. 4 | 5 | Use this as a template and extend it for your needs. 6 | -------------------------------------------------------------------------------- /r2-plugin-io-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first io plugin for radare2 in javascript", 3 | "devDependencies": { 4 | "r2papi": "^0.3.2", 5 | "@types/node": "^20.9.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /r2-script-r2papi-ts/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | mkdir -p node_modules 3 | npm i 4 | node_modules/.bin/tsc || tsc 5 | r2 -q -i src/test.r2.ts /bin/ls 6 | r2frida-compile -o portable.r2.js src/test.r2.ts 7 | -------------------------------------------------------------------------------- /r2-script-r2papi-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first r2 script", 3 | "devDependencies": { 4 | "typescript": "^5.3.3", 5 | "r2papi": "^0.3.2", 6 | "@types/node": "^20.9.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /r2frida-plugin-cmd-js/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | mkdir -p node_modules 3 | npm i 4 | r2 -q -c ':. src/r2f-newcmd.js' -c ':test' frida://0 5 | 6 | r2f: 7 | r2frida-compile -o portable.r2.js src/test.r2.ts 8 | -------------------------------------------------------------------------------- /r2frida-plugin-cmd-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first r2frida plugin", 3 | "version": "0.0.1", 4 | "devDependencies": { 5 | "r2papi": "^0.3.2", 6 | "@types/node": "^20.9.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /r2-script-lang-c/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void entry(RCore *core) { 4 | R_LOG_INFO ("Hello From %p", core); 5 | char *res = r_core_cmd_str (core, "?E Hello"); 6 | eprintf ("%s", res); 7 | free (res); 8 | } 9 | -------------------------------------------------------------------------------- /r2-program-libr-v/r2hello.v: -------------------------------------------------------------------------------- 1 | module main 2 | 3 | import radare.r2 4 | 5 | fn main() { 6 | c := r2.new() 7 | print(c.cmd('?E Hello')) 8 | c.free() // this is automatic with -autofree segfaults if not commented 9 | } 10 | 11 | -------------------------------------------------------------------------------- /r2frida-plugin-cmd-ts/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | mkdir -p node_modules 3 | r2pm -r r2frida-compile -i 4 | r2pm -r r2frida-compile -o /dev/null src/r2f-newcmd.ts 5 | r2 -q -c ':. src/r2f-newcmd.ts' -c ':test' frida://0 6 | 7 | clean: 8 | rm -rf node_modules 9 | -------------------------------------------------------------------------------- /r2-program-libr-c/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char **argv) { 4 | RCore *core = r_core_new (); 5 | char *res = r_core_cmd_str (core, "?E Hello"); 6 | eprintf ("%s", res); 7 | free (res); 8 | r_core_free (core); 9 | } 10 | -------------------------------------------------------------------------------- /r2ai-script-cmd-py/Makefile: -------------------------------------------------------------------------------- 1 | # R2AI_USERDIR=$(shell r2ai -HR2AI_USERDIR) 2 | R2AI_USERDIR=$(HOME)/.r2ai.plugins 3 | 4 | all: 5 | mkdir -p $(R2AI_USERDIR) 6 | cp -f plugin.py $(R2AI_USERDIR)/plugin.py 7 | 8 | uninstall: 9 | rm -f $(R2AI_USERDIR)/plugin.py 10 | -------------------------------------------------------------------------------- /r2-plugin-core-ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "lib": ["esnext"], 5 | "module": "commonjs", 6 | "outDir": "out", 7 | "sourceMap": true 8 | }, 9 | "include": [ 10 | "src/**/*.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /r2-plugin-io-py/README.md: -------------------------------------------------------------------------------- 1 | # r2 io plugin in Python 2 | 3 | This directory contains a IO plugin for radare2. 4 | 5 | IO plugins register new URI handlers when opening 6 | files in radare2 and abastract the access to data 7 | as if in a virtual memory address space was provided. 8 | -------------------------------------------------------------------------------- /r2-script-r2papi-ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "lib": ["esnext"], 5 | "module": "commonjs", 6 | "outDir": "out", 7 | "sourceMap": true 8 | }, 9 | "include": [ 10 | "src/**/*.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /r2-script-r2pipe-nodejs/example.js: -------------------------------------------------------------------------------- 1 | const r2pipe = require('r2pipe-promise'); 2 | 3 | async function Main() { 4 | const r2 = await r2pipe.open('/bin/ls'); 5 | const res = await r2.cmd("x"); 6 | console.log(res); 7 | await r2.quit(); 8 | } 9 | 10 | Main().then(console.log); 11 | -------------------------------------------------------------------------------- /r2-plugin-core-c/README.md: -------------------------------------------------------------------------------- 1 | # Sample RCore plugin in C 2 | 3 | This directory contains a basic RCore plugin for radare2 written in C. 4 | 5 | The plugin registers a new command 'hello' which prints 'world' and have access to all the APIs in r2. 6 | 7 | Use this as a template and extend it for your needs. 8 | -------------------------------------------------------------------------------- /r2-script-r2pipe-nodejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first r2 script", 3 | "devDependencies": { 4 | "@types/node": "^20.9.0", 5 | "r2pipe": "^2.8.4" 6 | }, 7 | "scripts": { 8 | "script": "node example.js" 9 | }, 10 | "dependencies": { 11 | "r2pipe-promise": "^1.6.1" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /r2-script-lang-nim/src/main.nim: -------------------------------------------------------------------------------- 1 | import r2papi 2 | import std/strformat 3 | import std/json 4 | 5 | echo("Hello From Nim"); 6 | 7 | var r = r2papi.R2Papi() 8 | var o = r.cmdj("ij") 9 | var fileName = o["core"]["file"].str 10 | echo (fmt"filename is: {fileName}") 11 | 12 | echo("Goodbye From Nim"); 13 | -------------------------------------------------------------------------------- /r2-script-r2pipe-swift/Makefile: -------------------------------------------------------------------------------- 1 | SWIFTFLAGS += -Xswiftc -Ir_core 2 | SWIFTFLAGS += -Xswiftc -DUSE_CCALL 3 | 4 | all: 5 | swift build $(SWIFTFLAGS) 6 | swift run 7 | 8 | clean: 9 | rm -rf .build 10 | rm -f Package.resolved 11 | swift package purge-cache 12 | swift package reset 13 | swift package clean 14 | -------------------------------------------------------------------------------- /r2-plugin-core-swift/Sources/CRadare2/shim.h: -------------------------------------------------------------------------------- 1 | #ifndef SHIM_H 2 | #define SHIM_H 3 | 4 | #include 5 | 6 | extern bool swift_hello_call(RCorePluginSession *cps, const char *input); 7 | extern bool swift_hello_init(RCorePluginSession *cps); 8 | extern bool swift_hello_fini(RCorePluginSession *cps); 9 | 10 | #endif -------------------------------------------------------------------------------- /r2-plugin-parse-js/README.md: -------------------------------------------------------------------------------- 1 | # Sample RParse plugin in r2js 2 | 3 | This directory contains a basic RParse plugin for radare2 written in r2js 4 | 5 | Running: 6 | 7 | ``` 8 | $ make 9 | $ make install 10 | ``` 11 | 12 | Usage: 13 | 14 | ``` 15 | $ r2 -e asm.parser=hello -e asm.pseudo=true /bin/ls 16 | > pd 20 17 | ``` 18 | -------------------------------------------------------------------------------- /r2frida-plugin-cmd-ts/src/r2f-newcmd.ts: -------------------------------------------------------------------------------- 1 | declare let r2frida: any; 2 | 3 | r2frida.pluginRegister('test', function(name: string) { 4 | if (name === 'test') { 5 | return function(args: string) { 6 | console.log('Hello Args From r2frida plugin', args); 7 | return 'Things Happen'; 8 | } 9 | } 10 | }); 11 | -------------------------------------------------------------------------------- /r2ai-script-cmd-py/plugin.py: -------------------------------------------------------------------------------- 1 | import r2ai 2 | 3 | print("Hello World from r2ai") 4 | try: 5 | res = r2_cmd("?e hello world from r2").strip() 6 | print(f"RES({res})") 7 | res = runline(None, "-m") 8 | print(f"RES({res})") 9 | res = runline2(None, "-m") 10 | print(f"RES({res})") 11 | except: 12 | traceback.print_exc() 13 | -------------------------------------------------------------------------------- /r2-plugin-core-js/src/coreplug.r2.js: -------------------------------------------------------------------------------- 1 | r2.plugin("core", function () { 2 | function penisCall(cmd) { 3 | if (cmd.startsWith("test")) { 4 | console.log(r2.cmd("?E Hello from r2js")); 5 | return true; 6 | } 7 | return false; 8 | } 9 | return { 10 | name: "test", 11 | call: penisCall, 12 | }; 13 | }); 14 | -------------------------------------------------------------------------------- /r2-plugin-core-ts/Makefile: -------------------------------------------------------------------------------- 1 | all: r2frida-portable 2 | r2 -i src/coreplug.r2.js /bin/ls 3 | 4 | r2frida-portable: node_modules 5 | r2pm -r r2frida-compile -o src/coreplug.r2.js src/coreplug.r2.ts 6 | 7 | node_modules: 8 | mkdir -p node_modules 9 | npm i 10 | 11 | npmway: 12 | tsc 13 | 14 | open: 15 | open -a "Visual Studio Code" . 16 | -------------------------------------------------------------------------------- /r2-plugin-arch-py/README.md: -------------------------------------------------------------------------------- 1 | # r2 arch plugin in Python 2 | 3 | This directory contains an arch plugin for radare2. 4 | 5 | An arch plugin adds support for a new processor architecture to radare2. It 6 | does so by implementing handlers that describe the architecture (regs, info), 7 | and for assembling (encode) and disassembling (decode) instructions. 8 | -------------------------------------------------------------------------------- /r2-script-r2pipe-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "r2pipe-ts-example", 3 | "version": "0.1.0", 4 | "description": "TypeScript r2pipe example", 5 | "type": "commonjs", 6 | "license": "MIT", 7 | "engines": { 8 | "node": ">=18.0" 9 | }, 10 | "dependencies": { 11 | "@types/node": "^20.11.28", 12 | "r2pipe-ts": "^0.1.2" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /r2-plugin-core-go/meson.build: -------------------------------------------------------------------------------- 1 | project('core-hello-go', 'c', 'go', license : 'MIT', meson_version : '>=1.00', version : '0.1.0') 2 | 3 | r2_plugdir = run_command('r2', '-H', 'R2_USER_PLUGINS', check: true).stdout().strip() 4 | 5 | # Note: Building Go plugins with cgo requires special handling 6 | # Use the provided Makefile for building 7 | 8 | # For now, assume the Makefile is used -------------------------------------------------------------------------------- /r2-script-lang-nim/src/r2papi.nim: -------------------------------------------------------------------------------- 1 | import std/[json, options, sugar] 2 | 3 | proc r2cmd(arg: cstring): cstring {.importc} 4 | 5 | type R2Papi = object 6 | 7 | proc cmdj(self: R2Papi, cmd: string): JsonNode = 8 | var res = $r2cmd(cmd) 9 | return parseJson(res) 10 | 11 | proc speak(self: R2Papi, msg: string) = 12 | echo r2cmd("?E " & msg) 13 | 14 | export r2cmd, cmdj, R2Papi, speak 15 | -------------------------------------------------------------------------------- /r2-plugin-io-c/meson.build: -------------------------------------------------------------------------------- 1 | project('io-hello', 'c', license : 'MIT', meson_version : '>=1.00', version : '0.1.0') 2 | 3 | r2_plugdir = run_command('r2', '-H', 'R2_USER_PLUGINS', check: true).stdout().strip() 4 | 5 | sources = [ 'src/io_hello.c' ] 6 | lib = library('iohello', sources, 7 | dependencies : [ 8 | dependency('r_io') 9 | ], 10 | install_dir: r2_plugdir, 11 | install: true 12 | ) 13 | -------------------------------------------------------------------------------- /r2-script-r2pipe-c/Makefile: -------------------------------------------------------------------------------- 1 | CC = cc 2 | PKG = r_socket 3 | CFLAGS = $(shell pkg-config --cflags $(PKG) 2>/dev/null) 4 | LDLIBS = $(shell pkg-config --libs $(PKG) 2>/dev/null) 5 | 6 | TARGET = hello 7 | 8 | all: $(TARGET) 9 | 10 | $(TARGET): main.c 11 | $(CC) $(CFLAGS) -o $@ main.c $(LDLIBS) 12 | 13 | clean: 14 | rm -f $(TARGET) 15 | 16 | test: 17 | r2 -qc '#!pipe ./hello' -- | grep world 18 | -------------------------------------------------------------------------------- /r2-plugin-bin-c/meson.build: -------------------------------------------------------------------------------- 1 | project('bin-hello', 'c', license : 'MIT', meson_version : '>=1.00', version : '0.1.0') 2 | 3 | r2_plugdir = run_command('r2', '-H', 'R2_USER_PLUGINS', check: true).stdout().strip() 4 | 5 | sources = [ 'src/bin_hello.c' ] 6 | lib = library('binhello', sources, 7 | dependencies : [ 8 | dependency('r_bin') 9 | ], 10 | install_dir: r2_plugdir, 11 | install: true 12 | ) 13 | -------------------------------------------------------------------------------- /r2-plugin-core-c/meson.build: -------------------------------------------------------------------------------- 1 | project('core-hello', 'c', license : 'MIT', meson_version : '>=1.00', version : '0.1.0') 2 | 3 | r2_plugdir = run_command('r2', '-H', 'R2_USER_PLUGINS', check: true).stdout().strip() 4 | 5 | sources = [ 'src/core_hello.c' ] 6 | lib = library('corehello', sources, 7 | dependencies : [ 8 | dependency('r_core') 9 | ], 10 | install_dir: r2_plugdir, 11 | install: true 12 | ) 13 | -------------------------------------------------------------------------------- /r2frida-plugin-cmd-js/src/r2f-newcmd.js: -------------------------------------------------------------------------------- 1 | // run ':. plugin.js' inside an 'r2 frida://' session to load it 2 | // run ':.-test' to unload it and ':.' to list them all 3 | 4 | r2frida.pluginRegister('test', function(name) { 5 | if (name === 'test') { 6 | return function(args) { 7 | console.log('Hello Args From r2frida plugin', args); 8 | return 'Things Happen'; 9 | } 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /r2-plugin-core-py/README.md: -------------------------------------------------------------------------------- 1 | # r2 Core plugin in Python 2 | 3 | This directory contains a core plugin for radare2. 4 | 5 | Core plugins have access to the classic r2cmd interface 6 | to execute commands and get the output as a string like 7 | r2pipe does. 8 | 9 | But also provide a way to register core plugins which 10 | let you handle new commands and keep a global state 11 | while the instance of r2 is alive. 12 | -------------------------------------------------------------------------------- /r2-plugin-parse-c/meson.build: -------------------------------------------------------------------------------- 1 | project('parse-hello', 'c', license : 'MIT', meson_versparsen : '>=1.00', versparsen : '0.1.0') 2 | 3 | r2_plugdir = run_command('r2', '-H', 'R2_USER_PLUGINS', check: true).stdout().strip() 4 | 5 | sources = [ 'src/parse_hello.c' ] 6 | lib = library('parsehello', sources, 7 | dependencies : [ 8 | dependency('r_arch') 9 | ], 10 | install_dir: r2_plugdir, 11 | install: true 12 | ) 13 | -------------------------------------------------------------------------------- /r2frida-plugin-cmd-js/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Radare2 Launch", 3 | "request": "launch", 4 | "environment": [ 5 | { 6 | "name": "config", 7 | "value": "Run", 8 | } 9 | ], 10 | "cwd": "${workspaceFolder}", 11 | "configurations": [ 12 | { 13 | "command": "exec make", 14 | "name": "Run JS in radare2", 15 | "request": "launch", 16 | "type": "node-terminal", 17 | "suppressMultipleSessionWarning": true 18 | } 19 | ] 20 | } 21 | 22 | -------------------------------------------------------------------------------- /r2-plugin-parse-js/parse.r2.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let { log } = console; 3 | 4 | function parseExample() { 5 | function parseCall(input) { 6 | return input.replace("sp, -0x60", "LOCALVAR"); 7 | } 8 | return { 9 | name: "qjs", 10 | desc: "Example QJS RParse plugin (qjs://)", 11 | parse: parseCall, 12 | }; 13 | } 14 | 15 | r2.plugin("parse", parseExample); 16 | r2.cmd("-e asm.parser=qjs"); 17 | r2.cmd("-e asm.pseudo=true"); 18 | console.log(r2.cmd("pd 10")); 19 | })(); 20 | 21 | -------------------------------------------------------------------------------- /r2-script-r2pipe-ts/test-spawn.ts: -------------------------------------------------------------------------------- 1 | import * as r2pipe from "r2pipe-ts"; 2 | 3 | async function main() { 4 | console.log("Hello R2Pipe for TypeScript"); 5 | // const r2 = await r2pipe.open("http://127.0.0.1:9090"); 6 | const r2 = await r2pipe.open("/bin/ls"); // create new r2 instance 7 | // const r2 = await r2pipe.open(); // from r2 8 | const res = await r2.cmd("?E Hello TypeScript"); 9 | console.log(res); 10 | await r2.quit(); 11 | } 12 | 13 | main().then((x)=>{}).catch(console.error); 14 | -------------------------------------------------------------------------------- /r2-script-r2pipe-c/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(void) { 6 | R2Pipe *r = r2pipe_open (NULL); // "radare2 -N -q0 -"); 7 | if (!r) { 8 | eprintf ("Failed to open r2pipe\n"); 9 | return 1; 10 | } 11 | 12 | char *res = r2pipe_cmd (r, "?e hello world"); 13 | if (res) { 14 | printf ("r2pipe reply: %s\n", res); 15 | free (res); 16 | } else { 17 | printf ("(no response)\n"); 18 | } 19 | 20 | r2pipe_close (r); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /r2-script-r2papi-ts/src/test.r2.ts: -------------------------------------------------------------------------------- 1 | // import { NativePointer, R, R2Pipe, r2 } from "r2papi"; 2 | import { r2, R, NativePointer } from "r2papi"; 3 | 4 | function Main() { 5 | const msg = r2.cmd("?E Hello World"); 6 | console.log(msg); 7 | const main = new NativePointer("main"); 8 | const res = main.analyzeFunction(); 9 | R.analyzeProgram(); 10 | main.disassemble(); 11 | res.functionBasicBlocks().forEach((bb) => { 12 | console.log(` - ${bb}`); 13 | }); 14 | } 15 | 16 | Main(); 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Radare2 Script Skeletons 2 | 3 | This repository contains directories that can be used as an skeleton or template 4 | to start writing your projects that use radare2. 5 | 6 | Radare2 can be extended in many ways: 7 | 8 | * Scripts 9 | * Plugins 10 | * Programs 11 | 12 | And it is possible to use almost any languages to do so. Those templates include 13 | the `.vscode` and build files too. so you can quickly start doing real work! 14 | 15 | Supported and tested editors: Helix and VSCode. 16 | 17 | --pancake 18 | -------------------------------------------------------------------------------- /r2-plugin-io-js/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Radare2 Launch", 3 | "request": "launch", 4 | "environment": [ 5 | { 6 | "name": "config", 7 | "value": "Run" 8 | } 9 | ], 10 | "cwd": "${workspaceFolder}", 11 | "configurations": [ 12 | { 13 | "command": "exec r2 -i src/myio.r2.js /bin/ls", 14 | "name": "Run JS in radare2", 15 | "request": "launch", 16 | "type": "node-terminal", 17 | "suppressMultipleSessionWarning": true 18 | } 19 | ] 20 | } 21 | 22 | -------------------------------------------------------------------------------- /r2-script-r2pipe-ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "r2pipe", 4 | "moduleResolution": "nodenext", 5 | "target": "es6", 6 | "esModuleInterop": true, 7 | "resolveJsonModule": true, 8 | "module": "commonjs", 9 | "lib": ["es2015"], 10 | "declaration": true, 11 | "strict": false, 12 | "skipLibCheck": true, 13 | "outDir": "./dist" 14 | }, 15 | "paths": { 16 | "*": ["node_modules/*", "src/types/*"] 17 | }, 18 | "include": [ 19 | "r2pipe/index.ts", 20 | "test.ts" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /r2-plugin-core-ts/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Radare2 Launch", 3 | "request": "launch", 4 | "environment": [ 5 | { 6 | "name": "config", 7 | "value": "Run" 8 | } 9 | ], 10 | "cwd": "${workspaceFolder}", 11 | "configurations": [ 12 | { 13 | "command": "exec r2 -I src/coreplug.r2.ts -c 'mycore' /bin/ls", 14 | "name": "Run TS in radare2", 15 | "request": "launch", 16 | "type": "node-terminal", 17 | "outputCapture": "console", 18 | "suppressMultipleSessionWarning": true 19 | } 20 | ] 21 | } 22 | 23 | -------------------------------------------------------------------------------- /r2-plugin-parse-c/README.md: -------------------------------------------------------------------------------- 1 | # Sample RParse plugin in C 2 | 3 | This directory contains a basic RParse plugin for radare2 written in C. 4 | 5 | Use this as a template and extend it for your needs. 6 | 7 | Note that RParse api is very fragile and badly designed, expect 8 | changes in a near future, so be careful and don't use this thing for 9 | anything else than a toy. 10 | 11 | Compilation and Installation: 12 | 13 | ``` 14 | $ make 15 | $ make install 16 | ``` 17 | 18 | Usage: 19 | 20 | ``` 21 | $ r2 -e asm.parser=hello -e asm.pseudo=true /bin/ls 22 | > pd 20 23 | ``` 24 | -------------------------------------------------------------------------------- /r2-plugin-io-c/Makefile: -------------------------------------------------------------------------------- 1 | LIBEXT=$(shell r2 -HR2_LIBEXT) 2 | CFLAGS+=$(shell pkg-config --cflags r_io) 3 | LDFLAGS+=$(shell pkg-config --libs r_io) 4 | R2_USER_PLUGINS=$(shell r2 -HR2_USER_PLUGINS) 5 | 6 | IO_HELLO=src/io_hello.$(LIBEXT) 7 | OBJS=src/io_hello.o 8 | 9 | all: $(IO_HELLO) 10 | 11 | $(IO_HELLO): $(OBJS) 12 | $(CC) $(LDFLAGS) -shared -fPIC -o $(IO_HELLO) $(OBJS) 13 | 14 | clean: 15 | rm -f $(OBJS) $(IO_HELLO) 16 | 17 | user-install install: 18 | mkdir -p $(R2_USER_PLUGINS) 19 | cp -f $(IO_HELLO) $(R2_USER_PLUGINS) 20 | 21 | user-uninstall uninstall: 22 | rm -f $(R2_USER_PLUGINS)/$(IO_HELLO) 23 | -------------------------------------------------------------------------------- /r2-plugin-bin-c/Makefile: -------------------------------------------------------------------------------- 1 | LIBEXT=$(shell r2 -HR2_LIBEXT) 2 | CFLAGS+=$(shell pkg-config --cflags r_bin) 3 | LDFLAGS+=$(shell pkg-config --libs r_bin) 4 | R2_USER_PLUGINS=$(shell r2 -HR2_USER_PLUGINS) 5 | 6 | BIN_HELLO=src/bin_hello.$(LIBEXT) 7 | OBJS=src/bin_hello.o 8 | 9 | all: $(BIN_HELLO) 10 | 11 | $(BIN_HELLO): $(OBJS) 12 | $(CC) $(LDFLAGS) -shared -fPIC -o $(BIN_HELLO) $(OBJS) 13 | 14 | clean: 15 | rm -f $(OBJS) $(BIN_HELLO) 16 | 17 | user-install install: 18 | mkdir -p $(R2_USER_PLUGINS) 19 | cp -f $(BIN_HELLO) $(R2_USER_PLUGINS) 20 | 21 | user-uninstall uninstall: 22 | rm -f $(R2_USER_PLUGINS)/$(BIN_HELLO) 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | R2PM_BINDIR=$(shell r2pm -H R2PM_BINDIR) 2 | R2_BINDIR=$(shell r2 -H R2_BINDIR) 3 | R2_PREFIX=$(shell r2 -H R2_PREFIX) 4 | SYS_SKEL_DIR=$(R2_PREFIX)/share/radare2/r2skel 5 | PWD=$(shell pwd) 6 | 7 | all: 8 | @echo "Run 'make user-install or 'make install'" 9 | 10 | user-install: 11 | ln -fs ${PWD}/r2skel ${R2PM_BINDIR}/r2skel 12 | 13 | user-uninstall: 14 | rm -f ${R2PM_BINDIR}/r2skel 15 | 16 | install: 17 | $(MAKE) uninstall 18 | mkdir -p $(SYS_SKEL_DIR) 19 | cp -rf * $(SYS_SKEL_DIR) 20 | ln -fs $(SYS_SKEL_DIR)/r2skel $(R2_BINDIR)/r2skel 21 | 22 | uninstall: 23 | rm -rf $(SYS_SKEL_DIR) 24 | rm -f $(R2_BINDIR)/r2skel 25 | -------------------------------------------------------------------------------- /r2-plugin-parse-c/Makefile: -------------------------------------------------------------------------------- 1 | LIBEXT=$(shell r2 -HR2_LIBEXT) 2 | CFLAGS+=$(shell pkg-config --cflags r_arch) 3 | LDFLAGS+=$(shell pkg-config --libs r_arch) 4 | R2_USER_PLUGINS=$(shell r2 -HR2_USER_PLUGINS) 5 | 6 | PARSE_HELLO=src/parse_hello.$(LIBEXT) 7 | OBJS=src/parse_hello.o 8 | 9 | all: $(PARSE_HELLO) 10 | 11 | $(PARSE_HELLO): $(OBJS) 12 | $(CC) $(LDFLAGS) -shared -fPIC -o $(PARSE_HELLO) $(OBJS) 13 | 14 | clean: 15 | rm -f $(OBJS) $(PARSE_HELLO) 16 | 17 | user-install install: 18 | mkdir -p $(R2_USER_PLUGINS) 19 | cp -f $(PARSE_HELLO) $(R2_USER_PLUGINS) 20 | 21 | user-uninstall uninstall: 22 | rm -f $(R2_USER_PLUGINS)/$(PARSE_HELLO) 23 | -------------------------------------------------------------------------------- /r2-plugin-core-c/Makefile: -------------------------------------------------------------------------------- 1 | LIBEXT=$(shell r2 -HR2_LIBEXT) 2 | CFLAGS+=$(shell pkg-config --cflags r_core) -fPIC 3 | LDFLAGS+=$(shell pkg-config --libs r_core) -fPIC 4 | R2_USER_PLUGINS=$(shell r2 -HR2_USER_PLUGINS) 5 | 6 | CORE_HELLO=src/core_hello.$(LIBEXT) 7 | OBJS=src/core_hello.o 8 | 9 | all: $(CORE_HELLO) 10 | 11 | $(CORE_HELLO): $(OBJS) 12 | r2pm -r $(CC) $(LDFLAGS) -shared -fPIC -o $(CORE_HELLO) $(OBJS) 13 | 14 | clean: 15 | rm -f $(OBJS) $(CORE_HELLO) 16 | 17 | user-install install: 18 | mkdir -p $(R2_USER_PLUGINS) 19 | cp -f $(CORE_HELLO) $(R2_USER_PLUGINS) 20 | 21 | user-uninstall uninstall: 22 | rm -f $(R2_USER_PLUGINS)/$(CORE_HELLO) 23 | -------------------------------------------------------------------------------- /r2-script-r2pipe-c/README.md: -------------------------------------------------------------------------------- 1 | # Hello r2pipe C example 2 | 3 | This small example demonstrates using the r2pipe C API 4 | provided by libr_socket to spawn radare2 and send a command. 5 | 6 | ## Run: 7 | 8 | To build the program just run `make`. 9 | 10 | ```bash 11 | r2 -c '#!pipe ./hello' -qcq -- 12 | ``` 13 | 14 | ## Notes: 15 | 16 | - The example calls `r2pipe_open("radare2 -N -q0 -")` which spawns radare2 in non-interactive quiet mode. Adjust the command if you need a different radare2 binary or arguments. 17 | - The program uses `r2pipe_cmd(r, "?e hello world");` which mirrors tests in the radare2 tree that evaluate expressions. 18 | - Run `make test` to ensure the implementation works 19 | -------------------------------------------------------------------------------- /r2-script-r2pipe-swift/Sources/main.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | import R2Pipe 3 | 4 | // print(R2Pipe.features) 5 | #if USE_CCALL 6 | if let r2p = R2Pipe("#!ccall") { 7 | print("Testint ccall") 8 | if let res = r2p.cmdSync("?E Hello World") { 9 | print(res) 10 | } else { 11 | print("Cannot run command") 12 | } 13 | } else { 14 | print("Cannot open ccall") 15 | } 16 | #endif 17 | 18 | if let r2p = R2Pipe("#!pipe") { 19 | print("Testint ccall") 20 | if let res = r2p.cmdSync("?E Hello World") { 21 | print(res) 22 | } else { 23 | print("Cannot run command") 24 | } 25 | } else { 26 | print("Cannot open pipe") 27 | } 28 | 29 | print("Hello Swift") 30 | -------------------------------------------------------------------------------- /r2-plugin-core-ts/src/coreplug.r2.ts: -------------------------------------------------------------------------------- 1 | import type { R2PipeSync } from "r2papi"; 2 | declare const r2: R2PipeSync; 3 | 4 | function InstantiateCorePlugin() { 5 | r2.unload("core", "mycore"); 6 | r2.plugin("core", function() { 7 | console.log("==> The 'mycore' plugin has been instantiated. Type 'mycore' to test it"); 8 | function coreCall(cmd: string) { 9 | if (cmd.startsWith("mycore")) { 10 | console.log("Hello From My Core!"); 11 | return true; 12 | } 13 | return false; 14 | } 15 | return { 16 | "name": "mycore", 17 | "license": "MIT", 18 | "desc": "simple core plugin in typescript for radare2", 19 | "call": coreCall, 20 | } 21 | }); 22 | } 23 | 24 | InstantiateCorePlugin(); 25 | -------------------------------------------------------------------------------- /r2-script-r2papi-ts/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Radare2 Launch", 3 | "request": "launch", 4 | "environment": [ 5 | { 6 | "name": "config", 7 | "value": "Run", 8 | } 9 | ], 10 | "cwd": "${workspaceFolder}", 11 | "configurations": [ 12 | { 13 | "command": "exec r2 -i main.r2.js /bin/ls", 14 | "name": "Run JS in radare2", 15 | "request": "launch", 16 | "type": "node-terminal", 17 | "suppressMultipleSessionWarning": true 18 | }, 19 | { 20 | "command": "exec r2 -i src/test.r2.ts /bin/ls", 21 | "name": "Run TS in radare2", 22 | "request": "launch", 23 | "type": "node-terminal", 24 | "outputCapture": "console", 25 | "suppressMultipleSessionWarning": true 26 | } 27 | ] 28 | } 29 | 30 | -------------------------------------------------------------------------------- /r2-script-r2pipe-rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "r2pipe-example" 3 | version = "0.1.0" 4 | authors = [ 5 | "pancake ", 6 | ] 7 | edition = "2018" 8 | description = "Program using r2pipe-rs to automate radare2 in Rust" 9 | 10 | # Repository 11 | repository = "https://github.com/radare/r2pipe.rs" 12 | documentation = "https://radare.github.io/r2pipe.rs/" 13 | 14 | keywords = ["r2", "debugger", "hex" , "editor", "radare"] 15 | 16 | # Readme link 17 | readme = "README.md" 18 | 19 | # License information 20 | license = "MIT OR Apache-2.0" 21 | 22 | [dependencies] 23 | r2pipe = "*" 24 | serde = "1.0.118" 25 | serde_json = "1.0.60" 26 | serde_derive = "1.0.118" 27 | 28 | [[bin]] 29 | name = "main" 30 | path = "src/main.rs" 31 | -------------------------------------------------------------------------------- /r2-plugin-core-py/coreplug.py: -------------------------------------------------------------------------------- 1 | # Example Python Core plugin written in Python 2 | # =========================================== 3 | # -- pancake 2016-2024 4 | # 5 | # $ r2 -i test-py-core.py - 6 | # > q 7 | # .. hexdump .. 8 | # Dont be rude. Use q! 9 | # > ^D 10 | # $ 11 | 12 | import r2lang 13 | 14 | def pycore(a): 15 | def _call(s): 16 | if s == "q": 17 | try: 18 | print(r2lang.cmd("x")) 19 | except: 20 | print("ERR") 21 | print("Dont be rude. Use q!") 22 | return True; 23 | return False 24 | 25 | return { 26 | "name": "pycoretest", 27 | "license": "MIT", 28 | "desc": "example core plugin written in python", 29 | "call": _call, 30 | } 31 | 32 | print("Registering Python core plugin...") 33 | print(r2lang.plugin("core", pycore)) 34 | -------------------------------------------------------------------------------- /r2-plugin-parse-c/src/parse_hello.c: -------------------------------------------------------------------------------- 1 | /* radare - MIT - Copyright 2024 */ 2 | 3 | // XXX this is an experimental plugin that is subject to change in the future. 4 | 5 | #include 6 | 7 | RParsePlugin r_parse_plugin_hello; 8 | 9 | static int parse(RParse *p, const char *data, char *str) { 10 | char *input = strdup (data); 11 | input = r_str_replace_all (input, "sp, -0x60", "LOCALVAR"); 12 | strcpy (str, input); 13 | return true; 14 | } 15 | 16 | RParsePlugin r_parse_plugin_hello = { 17 | .name = "hello", 18 | .desc = "Hello World from radare2's RParse", 19 | .parse = parse, 20 | }; 21 | 22 | #ifndef R2_PLUGIN_INCORE 23 | R_API RLibStruct radare_plugin = { 24 | .type = R_LIB_TYPE_PARSE, 25 | .data = &r_parse_plugin_hello, 26 | .version = R2_VERSION 27 | }; 28 | #endif 29 | -------------------------------------------------------------------------------- /r2-script-r2pipe-swift/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 5.10 2 | import PackageDescription 3 | 4 | let pacakge = Package( 5 | name: "r2pipe-example", 6 | products: [ 7 | .executable(name: "r2pipeExample", targets: ["r2pipeExample"]), 8 | ], 9 | dependencies: [ 10 | .package( 11 | url: "https://github.com/radareorg/radare2-r2pipe", revision: "1.0.5" 12 | ), 13 | ], 14 | targets: [ 15 | .executableTarget( 16 | name: "r2pipeExample", 17 | dependencies: [ 18 | .product(name: "r2pipe", package: "radare2-r2pipe") 19 | ], 20 | swiftSettings: [ 21 | .define("USE_CCALL") 22 | ] 23 | ) 24 | ] 25 | ) 26 | -------------------------------------------------------------------------------- /r2-plugin-core-go/Makefile: -------------------------------------------------------------------------------- 1 | LIBEXT=$(shell r2 -HR2_LIBEXT) 2 | CFLAGS+=$(shell pkg-config --cflags r_core) -fPIC 3 | LDFLAGS+=$(shell pkg-config --libs r_core) -fPIC 4 | R2_USER_PLUGINS=$(shell r2 -HR2_USER_PLUGINS) 5 | 6 | LIBCORE_HELLO=core_hello.$(LIBEXT) 7 | CORE_HELLO=src/$(LIBCORE_HELLO) 8 | 9 | all: $(CORE_HELLO) 10 | 11 | $(CORE_HELLO): src/core_hello.go 12 | GOCACHE=$(GOCACHE) GO111MODULE=off CGO_CFLAGS="$(CFLAGS)" CGO_LDFLAGS="$(LDFLAGS)" go build -buildmode=c-shared -o $(CORE_HELLO) ./src 13 | 14 | clean: 15 | rm -f $(CORE_HELLO) 16 | rm -rf $(GOCACHE) 17 | rm -f src/core_hello.o 18 | 19 | test: 20 | r2 -i $(CORE_HELLO) -qc hello -- 21 | 22 | user-install install: 23 | mkdir -p $(R2_USER_PLUGINS) 24 | cp -f $(CORE_HELLO) $(R2_USER_PLUGINS) 25 | 26 | user-uninstall uninstall: 27 | rm -f $(R2_USER_PLUGINS)/$(LIBCORE_HELLO) 28 | 29 | GOCACHE?=$(CURDIR)/.gocache 30 | -------------------------------------------------------------------------------- /r2-plugin-io-js/src/myio.r2.js: -------------------------------------------------------------------------------- 1 | const ioqjsPlugin = { 2 | name: "myio", 3 | desc: "Simple io plugin in javascript", 4 | license: "MIT", 5 | check: function (uri, perm) { 6 | return uri.startsWith("myio://"); 7 | }, 8 | open: function (uri, perm) { 9 | console.log("open URI is " + uri); 10 | return true; 11 | }, 12 | read: function (addr, len) { 13 | console.log("READ"); 14 | return [1,2,3]; 15 | }, 16 | seek: function (addr, whence) { 17 | const size = 32; // XXX custom size / resizable? 18 | const res = (whence === 2) ? size: addr; 19 | console.log("seek", addr, whence, "=", res); 20 | return res; 21 | }, 22 | write: function () {}, 23 | close: function () {}, 24 | } 25 | 26 | r2.plugin("io", () => ioqjsPlugin); 27 | 28 | // show plugin in the io listing 29 | console.log("==> MyIO plugin: (oL~myio), use 'o myio://123' to test it"); 30 | console.log(r2.cmd("oL~myio")); 31 | -------------------------------------------------------------------------------- /r2-plugin-core-swift/Makefile: -------------------------------------------------------------------------------- 1 | LIBEXT=dylib 2 | R2_USER_PLUGINS=$(shell r2 -HR2_USER_PLUGINS 2>/dev/null | tail -1 || echo "$$HOME/.local/share/radare2/plugins") 3 | 4 | CORE_HELLO=core_hello.$(LIBEXT) 5 | 6 | all: $(CORE_HELLO) 7 | 8 | $(CORE_HELLO): 9 | cc -c Sources/CRadare2/CoreHelloShim.c -I/usr/local/include/libr -o CoreHelloShim.o 10 | swiftc -emit-library -o $(CORE_HELLO) Sources/CoreHello/CoreHello.swift CoreHelloShim.o -L/usr/local/lib -lr_core -lr_config -lr_debug -lr_bin -lr_lang -lr_anal -lr_bp -lr_egg -lr_asm -lr_flag -lr_search -lr_syscall -lr_fs -lr_io -lr_socket -lr_cons -lr_magic -lr_muta -lr_arch -lr_esil -lr_reg -lr_util 11 | rm -f CoreHelloShim.o 12 | 13 | clean: 14 | rm -rf .build $(CORE_HELLO) 15 | 16 | user-install install: 17 | mkdir -p $(R2_USER_PLUGINS) 18 | cp -f $(CORE_HELLO) $(R2_USER_PLUGINS) 19 | 20 | user-uninstall uninstall: 21 | rm -f $(R2_USER_PLUGINS)/$(CORE_HELLO) -------------------------------------------------------------------------------- /r2-script-r2pipe-rust/src/main.rs: -------------------------------------------------------------------------------- 1 | use serde_json; 2 | 3 | use r2pipe::R2PipeSpawnOptions; 4 | use r2pipe::{R2Pipe, Result}; 5 | 6 | fn test_trim() -> Result<()> { 7 | let mut ns = R2Pipe::spawn("/bin/ls".to_owned(), None)?; 8 | println!("(({}))", ns.cmd("\n\n?e hello world\n\n")?); 9 | println!("(({}))", ns.cmd("\n\n?e hello world\n\n")?); 10 | println!("(({}))", ns.cmd("\n\n?e hello world\n\n")?); 11 | ns.close(); 12 | Ok(()) 13 | } 14 | 15 | fn main() -> Result<()> { 16 | test_trim()?; 17 | 18 | let opts = R2PipeSpawnOptions { 19 | exepath: "radare2".to_owned(), 20 | ..Default::default() 21 | }; 22 | let mut r2p = match R2Pipe::in_session() { 23 | Some(_) => R2Pipe::open()?, 24 | None => R2Pipe::spawn("/bin/ls".to_owned(), Some(opts))?, 25 | }; 26 | 27 | println!("{}", r2p.cmd("?e Hello World")?); 28 | 29 | let json = r2p.cmdj("ij")?; 30 | println!("{}", serde_json::to_string_pretty(&json)?); 31 | println!("ARCH {}", json["bin"]["arch"]); 32 | println!("BITS {}", json["bin"]["bits"]); 33 | println!("Disasm:\n{}", r2p.cmd("pd 20")?); 34 | println!("Hexdump:\n{}", r2p.cmd("px 64")?); 35 | r2p.close(); 36 | 37 | Ok(()) 38 | } 39 | -------------------------------------------------------------------------------- /r2skel: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # TODO: eventually rewrite in Python to support Windows 3 | if [ -L "$0" ]; then 4 | SKELDIR=`dirname $(readlink $0)` 5 | else 6 | SKELDIR=`dirname $0` 7 | fi 8 | WORKDIR="`pwd`" 9 | 10 | list_languages() { 11 | ( 12 | cd ${SKELDIR} || exit 1 13 | ls -F | grep r2 | grep / | awk -F - '{print $4}' | sed -e 's,/,,' | sort -u 14 | ) 15 | } 16 | 17 | list_templates() { 18 | ( 19 | cd ${SKELDIR} || exit 1 20 | ls -F | grep r2 | grep /$ | sed -e 's,/,,' 21 | ) 22 | } 23 | 24 | case "$1" in 25 | "-l"|list) 26 | list_templates 27 | ;; 28 | "-L"|langs) 29 | list_languages 30 | ;; 31 | "-h"|"") 32 | echo "r2skel [-lL] | [template] [new-directory]" 33 | echo "Options:" 34 | echo " -l - list all the available project templates" 35 | echo " -L - list all the languages" 36 | echo "Templates: " 37 | list_templates | xargs -L1 echo ' -' 38 | ;; 39 | *) 40 | if [ -n "$2" ]; then 41 | SD="${SKELDIR}/$1" 42 | if [ ! -d "${SD}" ]; then 43 | echo "Invalid skeleton name. See 'r2skel -l'" 44 | exit 1 45 | fi 46 | if [ -d "${2}" ]; then 47 | echo "Target directory already exists" 48 | exit 1 49 | fi 50 | cp -rf "${SD}" "$2" 51 | else 52 | echo "Usage: r2skel [template] [new-directory]" 53 | fi 54 | ;; 55 | esac 56 | 57 | -------------------------------------------------------------------------------- /r2-plugin-core-go/src/core_hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | type helloSession struct { 9 | name string 10 | useClippy bool 11 | } 12 | 13 | func newHelloSession() *helloSession { 14 | return &helloSession{name: "World"} 15 | } 16 | 17 | func handleHelloCommand(session *helloSession, input string, commander r2Commander) (string, bool) { 18 | if session == nil { 19 | return "", false 20 | } 21 | 22 | cmd := strings.TrimSpace(input) 23 | if !strings.HasPrefix(cmd, "hello") { 24 | return "", false 25 | } 26 | 27 | args := strings.Fields(cmd) 28 | if len(args) > 1 { 29 | session.name = strings.Join(args[1:], " ") 30 | } 31 | 32 | if strings.EqualFold(session.name, "clippy") { 33 | session.useClippy = true 34 | } 35 | 36 | if session.useClippy { 37 | if commander == nil { 38 | return fmt.Sprintf("Hello %s!\n", session.name), true 39 | } 40 | 41 | command := fmt.Sprintf("'?E Hello, %s", session.name) 42 | output, err := commander.Cmd(command) 43 | if err != nil { 44 | return fmt.Sprintf("Hello %s!\n", session.name), true 45 | } 46 | return output, true 47 | } 48 | 49 | return fmt.Sprintf("Hello %s!\n", session.name), true 50 | } 51 | 52 | func releaseHelloSession(*helloSession) {} 53 | 54 | func main() {} 55 | -------------------------------------------------------------------------------- /r2-plugin-core-swift/README.md: -------------------------------------------------------------------------------- 1 | # Swift RCore plugin example 2 | 3 | This sample shows how to write a tiny `RCore` plugin for radare2 in Swift using `swift build`. The plugin exposes a `hello` command that: 4 | - executes `ij` via the native `r_core_cmd_str` API 5 | - parses the JSON response with `JSONSerialization` 6 | - prints a short summary through `r_cons_print` 7 | 8 | ## Build 9 | ```sh 10 | $ swift build -c release 11 | # or use the helper to copy the expected filename next to the sources 12 | $ make 13 | ``` 14 | Set `R2_PREFIX=/path/to/radare2/prefix` if radare2 is not installed in one of the default prefixes (`/usr/local`, `/usr`, `/opt/homebrew`). The package manifest automatically injects the matching header search paths. 15 | 16 | ## Install 17 | ```sh 18 | $ make user-install # copies core_hello. into $(r2 -H R2_USER_PLUGINS) 19 | # clean up with: make user-uninstall 20 | ``` 21 | 22 | ## Use inside r2 23 | ```text 24 | [0x00000000]> e cmd.plugin=true # ensure plugin command routing is enabled 25 | [0x00000000]> hello 26 | Hello from Swift! Fetching binary info... 27 | Binary arch: x86 (64 bits) 28 | ``` 29 | 30 | Use this as a starting point for your own plugins. The Swift code in `Sources/CoreHello/CoreHello.swift` interacts with the radare2 C API directly so it is easy to extend with additional commands. 31 | -------------------------------------------------------------------------------- /r2-plugin-core-go/README.md: -------------------------------------------------------------------------------- 1 | # Sample RCore plugin in Go 2 | 3 | This directory contains a basic RCore plugin for radare2 written in Go using cgo. 4 | 5 | The plugin registers a new `hello` command that is fully implemented in Go. At runtime the command prints a greeting and lets you override the target name via `hello `. 6 | 7 | ## Build 8 | 9 | ``` 10 | make 11 | ``` 12 | 13 | The build produces `src/core_hello.dylib` plus the companion C header required by radare2. A local Go build cache (`.gocache/`) is used automatically so the build does not depend on any writable global directories. 14 | 15 | To install the plugin into your user plug-in directory: 16 | 17 | ``` 18 | make user-install 19 | ``` 20 | 21 | Use this skeleton as a starting point for authoring Go-based core plugins without a separate C shim. 22 | 23 | ## Running r2 commands 24 | 25 | The helper created in `src/r2cmd_shim.go` exposes the `r2Commander` interface so Go code can execute core commands without touching C types: 26 | 27 | ```go 28 | func runPrint(cps *C.RCorePluginSession) { 29 | r2 := newCoreCommander(cps) 30 | if r2 == nil { 31 | return 32 | } 33 | if out, err := r2.Cmd("pd 1"); err == nil { 34 | fmt.Println(out) 35 | } 36 | } 37 | ``` 38 | 39 | The snippet assumes the surrounding Go file already imports `"C"` via a cgo preamble. 40 | 41 | The updated `hello` plugin uses this helper internally when the session is switched to the `r2clippy` mode (`hello clippy`). 42 | -------------------------------------------------------------------------------- /r2-plugin-core-c/src/core_hello.c: -------------------------------------------------------------------------------- 1 | /* radare - Copyright 2025 - yourname */ 2 | 3 | #define R_LOG_ORIGIN "core.hello" 4 | 5 | #include 6 | 7 | typedef struct hello_data_t { 8 | char *name; 9 | } HelloData; 10 | 11 | static bool hello_call(RCorePluginSession *cps, const char *input) { 12 | RCore *core = cps->core; 13 | if (r_str_startswith (input, "hello")) { 14 | HelloData *hd = cps->data; 15 | if (hd) { 16 | r_cons_printf (core->cons, "Hello %s\n", hd->name); 17 | } else { 18 | R_LOG_ERROR ("HelloData is null"); 19 | } 20 | return true; 21 | } 22 | return false; 23 | } 24 | 25 | static bool hello_init(RCorePluginSession *cps) { 26 | HelloData *hd = R_NEW0 (HelloData); 27 | hd->name = strdup ("World"); 28 | cps->data = hd; 29 | return true; 30 | } 31 | 32 | static bool hello_fini(RCorePluginSession *cps) { 33 | HelloData *hd = R_NEW0 (HelloData); 34 | if (hd) { 35 | free (hd->name); 36 | free (hd); 37 | } 38 | return true; 39 | } 40 | 41 | // PLUGIN Definition Info 42 | RCorePlugin r_core_plugin_hello = { 43 | .meta = { 44 | .name = "core-hello", 45 | .desc = "hello world from an r2core plugin", 46 | .author = "pancake", 47 | .license = "MIT", 48 | }, 49 | .call = hello_call, 50 | .init = hello_init, // optional 51 | .fini = hello_fini, // optional 52 | }; 53 | 54 | #ifndef R2_PLUGIN_INCORE 55 | R_API RLibStruct radare_plugin = { 56 | .type = R_LIB_TYPE_CORE, 57 | .data = &r_core_plugin_hello, 58 | .version = R2_VERSION, 59 | .abiversion = R2_ABIVERSION 60 | }; 61 | #endif 62 | -------------------------------------------------------------------------------- /r2-plugin-core-swift/Sources/CRadare2/CoreHelloShim.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern bool swift_hello_call(RCorePluginSession *cps, const char *input); 5 | extern bool swift_hello_init(RCorePluginSession *cps); 6 | extern bool swift_hello_fini(RCorePluginSession *cps); 7 | 8 | static bool hello_call(RCorePluginSession *cps, const char *input) { 9 | return swift_hello_call(cps, input); 10 | } 11 | 12 | static bool hello_init(RCorePluginSession *cps) { 13 | return swift_hello_init(cps); 14 | } 15 | 16 | static bool hello_fini(RCorePluginSession *cps) { 17 | return swift_hello_fini(cps); 18 | } 19 | 20 | RCore *get_core(RCorePluginSession *cps) { 21 | return cps->core; 22 | } 23 | 24 | RCons *get_cons(RCore *core) { 25 | return core->cons; 26 | } 27 | 28 | void *get_session_data(RCorePluginSession *cps) { 29 | return cps->data; 30 | } 31 | 32 | void set_session_data(RCorePluginSession *cps, void *data) { 33 | cps->data = data; 34 | } 35 | 36 | RCorePlugin r_core_plugin_hello = { 37 | .meta = { 38 | .name = "core-hello", 39 | .desc = "hello world from an r2core plugin in Swift", 40 | .author = "pancake", 41 | .license = "MIT", 42 | }, 43 | .call = hello_call, 44 | .init = hello_init, 45 | .fini = hello_fini, 46 | }; 47 | 48 | #ifndef R2_PLUGIN_INCORE 49 | RLibStruct radare_plugin = { 50 | .type = R_LIB_TYPE_CORE, 51 | .data = &r_core_plugin_hello, 52 | .version = R2_VERSION, 53 | .abiversion = R2_ABIVERSION 54 | }; 55 | #endif -------------------------------------------------------------------------------- /r2-plugin-io-py/ioplug.py: -------------------------------------------------------------------------------- 1 | # Example Python IO plugin written in Python 2 | # =========================================== 3 | # 4 | # -- pancake @ nopcode.org 5 | # 6 | # Usage: 7 | # r2 -I test-py-io.py pyio://33 8 | # 9 | # The r2lang.plugin function exposes a way to register new plugins 10 | # into the RCore instance. This API is only available from RLang. 11 | 12 | import r2lang 13 | 14 | FAKESIZE = 512 15 | 16 | def pyio(a): 17 | def _open(path, rw, perm): 18 | print("MyPyIO Opening %s"%(path)) 19 | return "pyio-data" 20 | def _check(path, many): 21 | print("python-check %s"%(path)) 22 | return path[0:7] == "pyio://" 23 | def _read(data, size): 24 | print("python-read") 25 | return "A" * size 26 | def _seek(data, offset, whence): 27 | print("python-seek") 28 | if whence == 0: # SET 29 | return offset 30 | if whence == 1: # CUR 31 | return offset 32 | if whence == 2: # END 33 | return 512 34 | return 512 35 | def _write(data, buf, size): 36 | print("python-write") 37 | return True 38 | def _system(data, cmd): 39 | print("python-SYSTEM %s"%(cmd)) 40 | return True 41 | def _close(data): 42 | print(data) 43 | print("python-close") 44 | return 0 45 | return { 46 | "name": "pyio", 47 | "license": "GPL", 48 | "desc": "IO plugin in python (pyio://3)", 49 | "check": _check, 50 | "open": _open, 51 | "read": _read, 52 | "seek": _seek, 53 | "write": _write, 54 | "system": _system, 55 | "close": _close, 56 | } 57 | 58 | print("Registering Python IO plugin...") 59 | print(r2lang.plugin("io", pyio)) 60 | -------------------------------------------------------------------------------- /r2frida-plugin-cmd-ts/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first r2frida plugin", 3 | "version": "0.0.1", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "my first r2frida plugin", 9 | "version": "0.0.1", 10 | "devDependencies": { 11 | "@types/node": "^20.9.0" 12 | } 13 | }, 14 | "node_modules/@types/node": { 15 | "version": "20.9.0", 16 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 17 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 18 | "dev": true, 19 | "dependencies": { 20 | "undici-types": "~5.26.4" 21 | } 22 | }, 23 | "node_modules/undici-types": { 24 | "version": "5.26.5", 25 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 26 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 27 | "dev": true 28 | } 29 | }, 30 | "dependencies": { 31 | "@types/node": { 32 | "version": "20.9.0", 33 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 34 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 35 | "dev": true, 36 | "requires": { 37 | "undici-types": "~5.26.4" 38 | } 39 | }, 40 | "undici-types": { 41 | "version": "5.26.5", 42 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 43 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 44 | "dev": true 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /r2-plugin-core-js/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first r2 script", 3 | "lockfileVersion": 2, 4 | "requires": true, 5 | "packages": { 6 | "": { 7 | "name": "my first r2 script", 8 | "devDependencies": { 9 | "@types/node": "^20.9.0", 10 | "r2papi": "^0.3.2" 11 | } 12 | }, 13 | "node_modules/@types/node": { 14 | "version": "20.9.0", 15 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 16 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 17 | "dev": true, 18 | "dependencies": { 19 | "undici-types": "~5.26.4" 20 | } 21 | }, 22 | "node_modules/r2papi": { 23 | "version": "0.3.2", 24 | "resolved": "https://registry.npmjs.org/r2papi/-/r2papi-0.3.2.tgz", 25 | "integrity": "sha512-PKRdMXsl4lCKO/V1LmNypAwMOyp16IyrrJNRHoYKVwIsXvLkM34MjIdmOl0zNr41NpaoMaFs1EzkuakvekRWNw==", 26 | "dev": true 27 | }, 28 | "node_modules/undici-types": { 29 | "version": "5.26.5", 30 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 31 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 32 | "dev": true 33 | } 34 | }, 35 | "dependencies": { 36 | "@types/node": { 37 | "version": "20.9.0", 38 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 39 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 40 | "dev": true, 41 | "requires": { 42 | "undici-types": "~5.26.4" 43 | } 44 | }, 45 | "r2papi": { 46 | "version": "0.3.2", 47 | "resolved": "https://registry.npmjs.org/r2papi/-/r2papi-0.3.2.tgz", 48 | "integrity": "sha512-PKRdMXsl4lCKO/V1LmNypAwMOyp16IyrrJNRHoYKVwIsXvLkM34MjIdmOl0zNr41NpaoMaFs1EzkuakvekRWNw==", 49 | "dev": true 50 | }, 51 | "undici-types": { 52 | "version": "5.26.5", 53 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 54 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 55 | "dev": true 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /r2-plugin-io-js/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first r2 script", 3 | "lockfileVersion": 2, 4 | "requires": true, 5 | "packages": { 6 | "": { 7 | "name": "my first r2 script", 8 | "devDependencies": { 9 | "@types/node": "^20.9.0", 10 | "r2papi": "^0.3.2" 11 | } 12 | }, 13 | "node_modules/@types/node": { 14 | "version": "20.9.0", 15 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 16 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 17 | "dev": true, 18 | "dependencies": { 19 | "undici-types": "~5.26.4" 20 | } 21 | }, 22 | "node_modules/r2papi": { 23 | "version": "0.3.2", 24 | "resolved": "https://registry.npmjs.org/r2papi/-/r2papi-0.3.2.tgz", 25 | "integrity": "sha512-PKRdMXsl4lCKO/V1LmNypAwMOyp16IyrrJNRHoYKVwIsXvLkM34MjIdmOl0zNr41NpaoMaFs1EzkuakvekRWNw==", 26 | "dev": true 27 | }, 28 | "node_modules/undici-types": { 29 | "version": "5.26.5", 30 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 31 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 32 | "dev": true 33 | } 34 | }, 35 | "dependencies": { 36 | "@types/node": { 37 | "version": "20.9.0", 38 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 39 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 40 | "dev": true, 41 | "requires": { 42 | "undici-types": "~5.26.4" 43 | } 44 | }, 45 | "r2papi": { 46 | "version": "0.3.2", 47 | "resolved": "https://registry.npmjs.org/r2papi/-/r2papi-0.3.2.tgz", 48 | "integrity": "sha512-PKRdMXsl4lCKO/V1LmNypAwMOyp16IyrrJNRHoYKVwIsXvLkM34MjIdmOl0zNr41NpaoMaFs1EzkuakvekRWNw==", 49 | "dev": true 50 | }, 51 | "undici-types": { 52 | "version": "5.26.5", 53 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 54 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 55 | "dev": true 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /r2-plugin-bin-c/src/bin_hello.c: -------------------------------------------------------------------------------- 1 | /* radare - LGPL - Copyright 2023 - pancake */ 2 | 3 | #include 4 | 5 | static bool load(RBinFile *hello, RBuffer *buf, ut64 loadaddr) { 6 | return true; 7 | } 8 | 9 | static void destroy(RBinFile *hello) { 10 | RBuffer *buf = R_UNWRAP3 (hello, bo, bin_obj); 11 | r_buf_free (buf); 12 | } 13 | 14 | static RList *strings(RBinFile *hello) { 15 | // no strings here 16 | return NULL; 17 | } 18 | 19 | static RBinInfo *info(RBinFile *bf) { 20 | RBinInfo *ret = R_NEW0 (RBinInfo); 21 | if (R_LIKELY (ret)) { 22 | ret->lang = NULL; 23 | ret->file = bf->file? strdup (bf->file): NULL; 24 | ret->type = strdup ("executable"); 25 | ret->bclass = strdup ("1.0"); // version 26 | ret->rclass = strdup ("program"); 27 | ret->os = strdup ("any"); 28 | ret->subsystem = strdup ("unknown"); 29 | ret->machine = strdup ("world"); 30 | ret->arch = strdup ("hello"); 31 | ret->has_va = 1; 32 | ret->bits = 32; // 16? 33 | ret->big_endian = 0; 34 | ret->dbg_info = 0; 35 | } 36 | return ret; 37 | } 38 | 39 | static bool check(RBinFile *hello, RBuffer *buf) { 40 | r_return_val_if_fail (buf, false); 41 | 42 | ut8 tmp[64] = {0}; 43 | int read_length = r_buf_read_at (buf, 0, tmp, sizeof (tmp)); 44 | if (read_length < 64) { 45 | return false; 46 | } 47 | if (!memcmp (tmp, "HELL", 4)) { 48 | return true; 49 | } 50 | return false; 51 | } 52 | 53 | static RList *entries(RBinFile *hello) { 54 | r_return_val_if_fail (hello, NULL); 55 | RList *ret = r_list_newf (free); 56 | if (ret) { 57 | RBinAddr *ptr = R_NEW0 (RBinAddr); 58 | if (ptr) { 59 | ptr->paddr = ptr->vaddr = 0; 60 | r_list_append (ret, ptr); 61 | } 62 | } 63 | return ret; 64 | } 65 | 66 | RBinPlugin r_bin_plugin_hello = { 67 | .meta = { 68 | .name = "hello", 69 | .desc = "hello world for rbin", 70 | .license = "MIT", 71 | }, 72 | .load = &load, 73 | .destroy = &destroy, 74 | .check = &check, 75 | .entries = entries, 76 | .strings = &strings, 77 | .info = &info, 78 | }; 79 | 80 | #ifndef R2_PLUGIN_INCORE 81 | R_API RLibStruct radare_plugin = { 82 | .type = R_LIB_TYPE_BIN, 83 | .data = &r_bin_plugin_hello, 84 | .version = R2_VERSION 85 | }; 86 | #endif 87 | -------------------------------------------------------------------------------- /r2-plugin-core-ts/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first r2 script", 3 | "lockfileVersion": 2, 4 | "requires": true, 5 | "packages": { 6 | "": { 7 | "name": "my first r2 script", 8 | "devDependencies": { 9 | "@types/node": "^20.9.0", 10 | "r2papi": "^0.4.9" 11 | } 12 | }, 13 | "node_modules/@types/node": { 14 | "version": "20.9.0", 15 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 16 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 17 | "dev": true, 18 | "dependencies": { 19 | "undici-types": "~5.26.4" 20 | } 21 | }, 22 | "node_modules/r2papi": { 23 | "version": "0.4.9", 24 | "resolved": "https://registry.npmjs.org/r2papi/-/r2papi-0.4.9.tgz", 25 | "integrity": "sha512-j+WpN2gGJn6uMnjasx4WvREs+tw4pakJoqnBfpofW+DhNuOi8gLPf5s+vsr4ZC/Jrd8mNLW+W0FzRX2UMOoCHw==", 26 | "dev": true, 27 | "license": "MIT" 28 | }, 29 | "node_modules/undici-types": { 30 | "version": "5.26.5", 31 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 32 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 33 | "dev": true 34 | } 35 | }, 36 | "dependencies": { 37 | "@types/node": { 38 | "version": "20.9.0", 39 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 40 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 41 | "dev": true, 42 | "requires": { 43 | "undici-types": "~5.26.4" 44 | } 45 | }, 46 | "r2papi": { 47 | "version": "0.4.9", 48 | "resolved": "https://registry.npmjs.org/r2papi/-/r2papi-0.4.9.tgz", 49 | "integrity": "sha512-j+WpN2gGJn6uMnjasx4WvREs+tw4pakJoqnBfpofW+DhNuOi8gLPf5s+vsr4ZC/Jrd8mNLW+W0FzRX2UMOoCHw==", 50 | "dev": true 51 | }, 52 | "undici-types": { 53 | "version": "5.26.5", 54 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 55 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 56 | "dev": true 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /r2-plugin-core-swift/Sources/CoreHello/R2API.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | class RCore { 4 | let ptr: OpaquePointer 5 | 6 | init(_ ptr: OpaquePointer) { 7 | self.ptr = ptr 8 | } 9 | 10 | func cmd(_ command: String) -> Int { 11 | return command.withCString { r_core_cmd(ptr, $0) } 12 | } 13 | 14 | func cmd_str(_ command: String) -> String? { 15 | return command.withCString { cCmd in 16 | if let output = r_core_cmd_str(ptr, cCmd) { 17 | let result = String(cString: output) 18 | output.deallocate() 19 | return result 20 | } 21 | return nil 22 | } 23 | } 24 | 25 | func cmdj(_ command: String) -> Any? { 26 | if let output = cmd_str(command) { 27 | if let data = output.data(using: .utf8) { 28 | return try? JSONSerialization.jsonObject(with: data, options: []) 29 | } 30 | } 31 | return nil 32 | } 33 | 34 | var cons: RCons { 35 | let consPtr = get_cons(ptr) 36 | return RCons(consPtr) 37 | } 38 | } 39 | 40 | class RCons { 41 | let ptr: OpaquePointer 42 | 43 | init(_ ptr: OpaquePointer) { 44 | self.ptr = ptr 45 | } 46 | 47 | func print(_ str: String) { 48 | (str + "\n").withCString { r_cons_print(ptr, $0) } 49 | } 50 | } 51 | 52 | // MARK: - C Symbols 53 | 54 | @_silgen_name("get_core") 55 | func get_core(_ cps: OpaquePointer) -> OpaquePointer 56 | 57 | @_silgen_name("get_cons") 58 | func get_cons(_ core: OpaquePointer) -> OpaquePointer 59 | 60 | @_silgen_name("get_session_data") 61 | func get_session_data(_ cps: OpaquePointer) -> UnsafeMutableRawPointer? 62 | 63 | @_silgen_name("set_session_data") 64 | func set_session_data(_ cps: OpaquePointer, _ data: UnsafeMutableRawPointer?) 65 | 66 | @_silgen_name("r2_core_cmd") 67 | func r_core_cmd(_ core: OpaquePointer, _ cmd: UnsafePointer) -> Int 68 | 69 | @_silgen_name("r_core_cmd_str") 70 | func r_core_cmd_str(_ core: OpaquePointer, _ cmd: UnsafePointer) -> UnsafeMutablePointer? 71 | 72 | @_silgen_name("r_cons_print") 73 | func r_cons_print(_ cons: OpaquePointer, _ str: UnsafePointer) -------------------------------------------------------------------------------- /r2frida-plugin-cmd-js/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first r2frida plugin", 3 | "version": "0.0.1", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "my first r2frida plugin", 9 | "version": "0.0.1", 10 | "devDependencies": { 11 | "@types/node": "^20.9.0", 12 | "r2papi": "^0.3.2" 13 | } 14 | }, 15 | "node_modules/@types/node": { 16 | "version": "20.9.0", 17 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 18 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 19 | "dev": true, 20 | "dependencies": { 21 | "undici-types": "~5.26.4" 22 | } 23 | }, 24 | "node_modules/r2papi": { 25 | "version": "0.3.2", 26 | "resolved": "https://registry.npmjs.org/r2papi/-/r2papi-0.3.2.tgz", 27 | "integrity": "sha512-PKRdMXsl4lCKO/V1LmNypAwMOyp16IyrrJNRHoYKVwIsXvLkM34MjIdmOl0zNr41NpaoMaFs1EzkuakvekRWNw==", 28 | "dev": true 29 | }, 30 | "node_modules/undici-types": { 31 | "version": "5.26.5", 32 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 33 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 34 | "dev": true 35 | } 36 | }, 37 | "dependencies": { 38 | "@types/node": { 39 | "version": "20.9.0", 40 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 41 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 42 | "dev": true, 43 | "requires": { 44 | "undici-types": "~5.26.4" 45 | } 46 | }, 47 | "r2papi": { 48 | "version": "0.3.2", 49 | "resolved": "https://registry.npmjs.org/r2papi/-/r2papi-0.3.2.tgz", 50 | "integrity": "sha512-PKRdMXsl4lCKO/V1LmNypAwMOyp16IyrrJNRHoYKVwIsXvLkM34MjIdmOl0zNr41NpaoMaFs1EzkuakvekRWNw==", 51 | "dev": true 52 | }, 53 | "undici-types": { 54 | "version": "5.26.5", 55 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 56 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 57 | "dev": true 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /r2-plugin-io-c/src/io_hello.c: -------------------------------------------------------------------------------- 1 | /* radare - MIT - Copyright 2023 */ 2 | 3 | #include 4 | 5 | #define SOCKETURI "hello://" 6 | 7 | RIOPlugin r_io_plugin_hello; 8 | 9 | typedef struct { 10 | int magic; 11 | int size; 12 | } HelloUserData; 13 | 14 | static int __write(RIO *io, RIODesc *desc, const ut8 *buf, int count) { 15 | HelloUserData *userdata = desc->data; 16 | if (userdata) { 17 | R_LOG_WARN ("writing %d on ", userdata->magic); 18 | } 19 | return count; 20 | } 21 | 22 | static ut64 __lseek(RIO *io, RIODesc *desc, ut64 offset, int whence) { 23 | HelloUserData *userdata = desc->data; 24 | switch (whence) { 25 | case SEEK_SET: return r_io_desc_seek (desc, 0LL, R_IO_SEEK_CUR); 26 | case SEEK_CUR: return io->off + offset; 27 | case SEEK_END: return userdata->size; 28 | } 29 | return offset; 30 | } 31 | 32 | static int __read(RIO *io, RIODesc *desc, ut8 *buf, int count) { 33 | ut64 addr = r_io_desc_seek (desc, 0LL, R_IO_SEEK_CUR); 34 | R_LOG_WARN ("reading %d bytes from 0x%08"PFMT64x, count, addr); 35 | HelloUserData *userdata = desc->data; 36 | int i; 37 | for (i = 0; i < count; i++) { 38 | buf[0] = userdata->magic; 39 | } 40 | return count; 41 | } 42 | 43 | static bool __close(RIODesc *desc) { 44 | // HelloUserData *userdata = desc->data; 45 | R_FREE (desc->data); 46 | return true; 47 | } 48 | 49 | static bool __check(RIO *io, const char *pathname, bool many) { 50 | return r_str_startswith (pathname, SOCKETURI); 51 | } 52 | 53 | static RIODesc *__open(RIO *io, const char *pathname, int rw, int mode) { 54 | if (!__check (io, pathname, 0)) { 55 | return NULL; 56 | } 57 | pathname += strlen (SOCKETURI); 58 | HelloUserData *userdata = R_NEW0 (HelloUserData); 59 | if (userdata) { 60 | userdata->size = 64; 61 | userdata->magic = atoi (pathname); 62 | R_LOG_WARN ("Opening Hello '%s'", pathname); 63 | return r_io_desc_new (io, 64 | &r_io_plugin_hello, 65 | pathname, 66 | R_PERM_RW | (rw & R_PERM_X), 67 | mode, 68 | userdata); 69 | } 70 | return NULL; 71 | } 72 | 73 | static char *__system(RIO *io, RIODesc *desc, const char *cmd) { 74 | R_LOG_WARN ("system command executed '%s'", cmd); 75 | return NULL; 76 | } 77 | 78 | RIOPlugin r_io_plugin_hello = { 79 | .meta = { 80 | .name = "hello", 81 | .desc = "Hello World from radare2's IO", 82 | .license = "MIT", 83 | }, 84 | .uris = SOCKETURI, 85 | .open = __open, 86 | .close = __close, 87 | .seek = __lseek, 88 | .read = __read, 89 | .check = __check, 90 | .write = __write, 91 | .system = __system, 92 | }; 93 | 94 | #ifndef R2_PLUGIN_INCORE 95 | R_API RLibStruct radare_plugin = { 96 | .type = R_LIB_TYPE_IO, 97 | .data = &r_io_plugin_hello, 98 | .version = R2_VERSION 99 | }; 100 | #endif 101 | -------------------------------------------------------------------------------- /r2-script-r2papi-ts/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first r2 script", 3 | "lockfileVersion": 2, 4 | "requires": true, 5 | "packages": { 6 | "": { 7 | "name": "my first r2 script", 8 | "devDependencies": { 9 | "@types/node": "^20.9.0", 10 | "r2papi": "^0.3.2", 11 | "typescript": "^5.3.3" 12 | } 13 | }, 14 | "node_modules/@types/node": { 15 | "version": "20.9.0", 16 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 17 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 18 | "dev": true, 19 | "dependencies": { 20 | "undici-types": "~5.26.4" 21 | } 22 | }, 23 | "node_modules/r2papi": { 24 | "version": "0.3.2", 25 | "resolved": "https://registry.npmjs.org/r2papi/-/r2papi-0.3.2.tgz", 26 | "integrity": "sha512-PKRdMXsl4lCKO/V1LmNypAwMOyp16IyrrJNRHoYKVwIsXvLkM34MjIdmOl0zNr41NpaoMaFs1EzkuakvekRWNw==", 27 | "dev": true 28 | }, 29 | "node_modules/typescript": { 30 | "version": "5.3.3", 31 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", 32 | "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", 33 | "dev": true, 34 | "bin": { 35 | "tsc": "bin/tsc", 36 | "tsserver": "bin/tsserver" 37 | }, 38 | "engines": { 39 | "node": ">=14.17" 40 | } 41 | }, 42 | "node_modules/undici-types": { 43 | "version": "5.26.5", 44 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 45 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 46 | "dev": true 47 | } 48 | }, 49 | "dependencies": { 50 | "@types/node": { 51 | "version": "20.9.0", 52 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 53 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 54 | "dev": true, 55 | "requires": { 56 | "undici-types": "~5.26.4" 57 | } 58 | }, 59 | "r2papi": { 60 | "version": "0.3.2", 61 | "resolved": "https://registry.npmjs.org/r2papi/-/r2papi-0.3.2.tgz", 62 | "integrity": "sha512-PKRdMXsl4lCKO/V1LmNypAwMOyp16IyrrJNRHoYKVwIsXvLkM34MjIdmOl0zNr41NpaoMaFs1EzkuakvekRWNw==", 63 | "dev": true 64 | }, 65 | "typescript": { 66 | "version": "5.3.3", 67 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", 68 | "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", 69 | "dev": true 70 | }, 71 | "undici-types": { 72 | "version": "5.26.5", 73 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 74 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 75 | "dev": true 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /r2-plugin-core-swift/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version: 5.9 2 | import PackageDescription 3 | import Foundation 4 | 5 | let env = ProcessInfo.processInfo.environment 6 | 7 | var includePrefixes: [String] = [] 8 | if let r2Prefix = env["R2_PREFIX"], !r2Prefix.isEmpty { 9 | includePrefixes.append(r2Prefix) 10 | } 11 | if let prefix = env["PREFIX"], !prefix.isEmpty { 12 | includePrefixes.append(prefix) 13 | } 14 | includePrefixes.append(contentsOf: [ 15 | "/usr/local", 16 | "/usr", 17 | "/opt/homebrew" 18 | ]) 19 | 20 | let includeSubdirs = [ 21 | "include", 22 | "include/libr", 23 | "include/libr/sdb", 24 | "include/libr/socket", 25 | "include/libr/util" 26 | ] 27 | 28 | let fileManager = FileManager.default 29 | let includeDirs = Array( 30 | Set( 31 | includePrefixes.flatMap { prefix in 32 | includeSubdirs.map { "\(prefix)/\($0)" } 33 | } 34 | ) 35 | ) 36 | .filter { fileManager.fileExists(atPath: $0) } 37 | .sorted() 38 | 39 | let cSettings: [CSetting] = [ 40 | .define("R_LOG_ORIGIN", to: "\"core.hello\""), 41 | .headerSearchPath("."), 42 | ] + includeDirs.map { .unsafeFlags(["-I", $0]) } 43 | 44 | let package = Package( 45 | name: "r2-plugin-core-swift", 46 | products: [ 47 | .library( 48 | name: "CoreHello", 49 | type: .dynamic, 50 | targets: ["CoreHello"] 51 | ), 52 | ], 53 | targets: [ 54 | .systemLibrary( 55 | name: "CRadare2", 56 | path: "Sources/CRadare2", 57 | pkgConfig: "r_core", 58 | providers: [ 59 | .apt(["libr2-dev"]), 60 | .brew(["radare2"]) 61 | ] 62 | ), 63 | .target( 64 | name: "CoreHello", 65 | dependencies: ["CRadare2"], 66 | path: "Sources/CoreHello", 67 | linkerSettings: [ 68 | .linkedLibrary("r_core"), 69 | .linkedLibrary("r_config"), 70 | .linkedLibrary("r_debug"), 71 | .linkedLibrary("r_bin"), 72 | .linkedLibrary("r_lang"), 73 | .linkedLibrary("r_anal"), 74 | .linkedLibrary("r_bp"), 75 | .linkedLibrary("r_egg"), 76 | .linkedLibrary("r_asm"), 77 | .linkedLibrary("r_arch"), 78 | .linkedLibrary("r_esil"), 79 | .linkedLibrary("r_flag"), 80 | .linkedLibrary("r_reg"), 81 | .linkedLibrary("r_search"), 82 | .linkedLibrary("r_syscall"), 83 | .linkedLibrary("r_fs"), 84 | .linkedLibrary("r_io"), 85 | .linkedLibrary("r_socket"), 86 | .linkedLibrary("r_cons"), 87 | .linkedLibrary("r_magic"), 88 | .linkedLibrary("r_muta"), 89 | .linkedLibrary("r_util"), 90 | .linkedLibrary("dl"), 91 | ] 92 | ), 93 | ] 94 | ) 95 | -------------------------------------------------------------------------------- /r2-script-r2pipe-rust/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "itoa" 7 | version = "1.0.11" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" 10 | 11 | [[package]] 12 | name = "libc" 13 | version = "0.2.153" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" 16 | 17 | [[package]] 18 | name = "proc-macro2" 19 | version = "1.0.79" 20 | source = "registry+https://github.com/rust-lang/crates.io-index" 21 | checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" 22 | dependencies = [ 23 | "unicode-ident", 24 | ] 25 | 26 | [[package]] 27 | name = "quote" 28 | version = "1.0.35" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" 31 | dependencies = [ 32 | "proc-macro2", 33 | ] 34 | 35 | [[package]] 36 | name = "r2pipe" 37 | version = "0.7.0" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "63443078dfdb83f59820ed161863e38df38e8c6a2c3b85733ebac1bb65b4af2b" 40 | dependencies = [ 41 | "libc", 42 | "serde", 43 | "serde_derive", 44 | "serde_json", 45 | "thiserror", 46 | ] 47 | 48 | [[package]] 49 | name = "r2pipe-example" 50 | version = "0.1.0" 51 | dependencies = [ 52 | "r2pipe", 53 | "serde", 54 | "serde_derive", 55 | "serde_json", 56 | ] 57 | 58 | [[package]] 59 | name = "ryu" 60 | version = "1.0.17" 61 | source = "registry+https://github.com/rust-lang/crates.io-index" 62 | checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" 63 | 64 | [[package]] 65 | name = "serde" 66 | version = "1.0.197" 67 | source = "registry+https://github.com/rust-lang/crates.io-index" 68 | checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" 69 | dependencies = [ 70 | "serde_derive", 71 | ] 72 | 73 | [[package]] 74 | name = "serde_derive" 75 | version = "1.0.197" 76 | source = "registry+https://github.com/rust-lang/crates.io-index" 77 | checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" 78 | dependencies = [ 79 | "proc-macro2", 80 | "quote", 81 | "syn", 82 | ] 83 | 84 | [[package]] 85 | name = "serde_json" 86 | version = "1.0.115" 87 | source = "registry+https://github.com/rust-lang/crates.io-index" 88 | checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" 89 | dependencies = [ 90 | "itoa", 91 | "ryu", 92 | "serde", 93 | ] 94 | 95 | [[package]] 96 | name = "syn" 97 | version = "2.0.58" 98 | source = "registry+https://github.com/rust-lang/crates.io-index" 99 | checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" 100 | dependencies = [ 101 | "proc-macro2", 102 | "quote", 103 | "unicode-ident", 104 | ] 105 | 106 | [[package]] 107 | name = "thiserror" 108 | version = "1.0.58" 109 | source = "registry+https://github.com/rust-lang/crates.io-index" 110 | checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" 111 | dependencies = [ 112 | "thiserror-impl", 113 | ] 114 | 115 | [[package]] 116 | name = "thiserror-impl" 117 | version = "1.0.58" 118 | source = "registry+https://github.com/rust-lang/crates.io-index" 119 | checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" 120 | dependencies = [ 121 | "proc-macro2", 122 | "quote", 123 | "syn", 124 | ] 125 | 126 | [[package]] 127 | name = "unicode-ident" 128 | version = "1.0.12" 129 | source = "registry+https://github.com/rust-lang/crates.io-index" 130 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 131 | -------------------------------------------------------------------------------- /r2-plugin-core-go/src/core_hello_shim.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | /* 4 | #cgo CFLAGS: -I/usr/local/include/libr 5 | #cgo LDFLAGS: -L/usr/local/lib -lr_core -lr_config -lr_debug -lr_bin -lr_lang -lr_anal -lr_bp -lr_egg -lr_asm -lr_arch -lr_esil -lr_flag -lr_reg -lr_search -lr_syscall -lr_fs -lr_io -lr_socket -lr_cons -lr_magic -lr_muta -lr_util -ldl 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | extern int goHelloCall(RCorePluginSession *cps, char *input); 14 | extern int goHelloInit(RCorePluginSession *cps); 15 | extern int goHelloFini(RCorePluginSession *cps); 16 | 17 | static inline bool hello_call(RCorePluginSession *cps, const char *input) { 18 | return goHelloCall(cps, (char *)input) != 0; 19 | } 20 | 21 | static inline bool hello_init(RCorePluginSession *cps) { 22 | return goHelloInit(cps) != 0; 23 | } 24 | 25 | static inline bool hello_fini(RCorePluginSession *cps) { 26 | return goHelloFini(cps) != 0; 27 | } 28 | 29 | static inline void cps_set_handle(RCorePluginSession *cps, uintptr_t handle) { 30 | cps->data = (void *)handle; 31 | } 32 | 33 | static inline uintptr_t cps_get_handle(RCorePluginSession *cps) { 34 | return (uintptr_t)cps->data; 35 | } 36 | 37 | static inline RCons *cps_cons(RCorePluginSession *cps) { 38 | return cps && cps->core ? cps->core->cons : NULL; 39 | } 40 | 41 | RCorePlugin r_core_plugin_hello __attribute__((weak, used)) = { 42 | .meta = { 43 | .name = "core-hello", 44 | .desc = "hello world from an r2core plugin", 45 | .author = "pancake", 46 | .license = "MIT", 47 | }, 48 | .call = hello_call, 49 | .init = hello_init, 50 | .fini = hello_fini, 51 | }; 52 | 53 | #ifndef R2_PLUGIN_INCORE 54 | RLibStruct radare_plugin __attribute__((weak, used)) = { 55 | .type = R_LIB_TYPE_CORE, 56 | .data = &r_core_plugin_hello, 57 | .version = R2_VERSION, 58 | .abiversion = R2_ABIVERSION 59 | }; 60 | #endif 61 | */ 62 | import "C" 63 | import ( 64 | "runtime/cgo" 65 | "unsafe" 66 | ) 67 | 68 | func setSessionHandle(cps *C.RCorePluginSession, h cgo.Handle) { 69 | C.cps_set_handle(cps, C.uintptr_t(h)) 70 | } 71 | 72 | func clearSessionHandle(cps *C.RCorePluginSession) { 73 | C.cps_set_handle(cps, 0) 74 | } 75 | 76 | func sessionHandle(cps *C.RCorePluginSession) (cgo.Handle, bool) { 77 | handleID := uintptr(C.cps_get_handle(cps)) 78 | if handleID == 0 { 79 | return 0, false 80 | } 81 | return cgo.Handle(handleID), true 82 | } 83 | 84 | func sessionData(cps *C.RCorePluginSession) (*helloSession, bool) { 85 | handle, ok := sessionHandle(cps) 86 | if !ok { 87 | return nil, false 88 | } 89 | value := handle.Value() 90 | if value == nil { 91 | return nil, false 92 | } 93 | data, ok := value.(*helloSession) 94 | return data, ok 95 | } 96 | 97 | //export goHelloCall 98 | func goHelloCall(cps *C.RCorePluginSession, input *C.char) C.int { 99 | if cps == nil || input == nil { 100 | return 0 101 | } 102 | 103 | session, ok := sessionData(cps) 104 | if !ok { 105 | return 0 106 | } 107 | 108 | message, handled := handleHelloCommand(session, C.GoString(input), newCoreCommander(cps)) 109 | if !handled { 110 | return 0 111 | } 112 | 113 | cons := C.cps_cons(cps) 114 | if cons == nil { 115 | return 0 116 | } 117 | 118 | cMessage := C.CString(message) 119 | defer C.free(unsafe.Pointer(cMessage)) 120 | 121 | C.r_cons_print(cons, cMessage) 122 | return 1 123 | } 124 | 125 | //export goHelloInit 126 | func goHelloInit(cps *C.RCorePluginSession) C.int { 127 | if cps == nil { 128 | return 0 129 | } 130 | 131 | session := newHelloSession() 132 | handle := cgo.NewHandle(session) 133 | setSessionHandle(cps, handle) 134 | return 1 135 | } 136 | 137 | //export goHelloFini 138 | func goHelloFini(cps *C.RCorePluginSession) C.int { 139 | if cps == nil { 140 | return 0 141 | } 142 | 143 | if session, ok := sessionData(cps); ok { 144 | releaseHelloSession(session) 145 | } 146 | 147 | if handle, ok := sessionHandle(cps); ok { 148 | handle.Delete() 149 | } 150 | 151 | clearSessionHandle(cps) 152 | return 1 153 | } 154 | -------------------------------------------------------------------------------- /r2-plugin-core-swift/Sources/CoreHello/CoreHello.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | private struct HelloData { 4 | var greeting: String 5 | } 6 | 7 | @_cdecl("swift_hello_call") 8 | func hello_call(_ cps: OpaquePointer, _ input: UnsafePointer) -> Bool { 9 | let command = String(cString: input) 10 | guard command.hasPrefix("hello") else { 11 | return false 12 | } 13 | 14 | let core = get_core(cps) 15 | let cons = get_cons(core) 16 | 17 | let sessionGreeting = sessionData(in: cps)?.pointee.greeting ?? "Swift" 18 | printLine(cons, "Hello \(sessionGreeting)! Fetching binary info...") 19 | 20 | guard let jsonString = commandOutput(from: core, command: "ij") else { 21 | printLine(cons, "Failed to read JSON from `ij` command") 22 | return true 23 | } 24 | 25 | switch parseBinaryInfo(from: jsonString) { 26 | case let .success(info): 27 | printLine(cons, info) 28 | case let .failure(error): 29 | printLine(cons, "Failed to parse JSON: \(error.localizedDescription)") 30 | } 31 | 32 | return true 33 | } 34 | 35 | @_cdecl("swift_hello_init") 36 | func hello_init(_ cps: OpaquePointer) -> Bool { 37 | let dataPointer = UnsafeMutablePointer.allocate(capacity: 1) 38 | dataPointer.initialize(to: HelloData(greeting: "from Swift")) 39 | set_session_data(cps, UnsafeMutableRawPointer(dataPointer)) 40 | return true 41 | } 42 | 43 | @_cdecl("swift_hello_fini") 44 | func hello_fini(_ cps: OpaquePointer) -> Bool { 45 | if let raw = get_session_data(cps) { 46 | let pointer = raw.assumingMemoryBound(to: HelloData.self) 47 | pointer.deinitialize(count: 1) 48 | pointer.deallocate() 49 | set_session_data(cps, nil) 50 | } 51 | return true 52 | } 53 | 54 | // MARK: - Helpers 55 | 56 | private func sessionData(in cps: OpaquePointer) -> UnsafeMutablePointer? { 57 | guard let raw = get_session_data(cps) else { 58 | return nil 59 | } 60 | return raw.assumingMemoryBound(to: HelloData.self) 61 | } 62 | 63 | private func commandOutput(from core: OpaquePointer, command: String) -> String? { 64 | command.withCString { cString in 65 | guard let outputPtr = r_core_cmd_str(core, cString) else { 66 | return nil 67 | } 68 | defer { outputPtr.deallocate() } 69 | return String(cString: outputPtr) 70 | } 71 | } 72 | 73 | private func parseBinaryInfo(from jsonString: String) -> Result { 74 | guard let data = jsonString.data(using: .utf8) else { 75 | return .failure(JSONError.encoding) 76 | } 77 | 78 | do { 79 | let object = try JSONSerialization.jsonObject(with: data, options: []) 80 | if let dict = object as? [String: Any], 81 | let bin = dict["bin"] as? [String: Any], 82 | let arch = bin["arch"] as? String, 83 | let bits = bin["bits"] as? Int { 84 | return .success("Binary arch: \(arch) (\(bits) bits)") 85 | } 86 | return .success("ij JSON: \(object)") 87 | } catch { 88 | return .failure(error) 89 | } 90 | } 91 | 92 | private func printLine(_ cons: OpaquePointer, _ message: String) { 93 | (message + "\n").withCString { cString in 94 | r_cons_print(cons, cString) 95 | } 96 | } 97 | 98 | private enum JSONError: Error { 99 | case encoding 100 | } 101 | 102 | // MARK: - C Symbols 103 | 104 | @_silgen_name("get_core") 105 | func get_core(_ cps: OpaquePointer) -> OpaquePointer 106 | 107 | @_silgen_name("get_cons") 108 | func get_cons(_ core: OpaquePointer) -> OpaquePointer 109 | 110 | @_silgen_name("get_session_data") 111 | func get_session_data(_ cps: OpaquePointer) -> UnsafeMutableRawPointer? 112 | 113 | @_silgen_name("set_session_data") 114 | func set_session_data(_ cps: OpaquePointer, _ data: UnsafeMutableRawPointer?) 115 | 116 | @_silgen_name("r_core_cmd_str") 117 | func r_core_cmd_str(_ core: OpaquePointer, _ cmd: UnsafePointer) -> UnsafeMutablePointer? 118 | 119 | @_silgen_name("r_cons_print") 120 | func r_cons_print(_ cons: OpaquePointer, _ str: UnsafePointer) 121 | 122 | 123 | -------------------------------------------------------------------------------- /r2-plugin-core-go/src/core_hello.h: -------------------------------------------------------------------------------- 1 | /* Code generated by cmd/cgo; DO NOT EDIT. */ 2 | 3 | /* package _/Users/pancake/prg/radare2-skel/r2-plugin-core-go/src */ 4 | 5 | 6 | #line 1 "cgo-builtin-export-prolog" 7 | 8 | #include 9 | 10 | #ifndef GO_CGO_EXPORT_PROLOGUE_H 11 | #define GO_CGO_EXPORT_PROLOGUE_H 12 | 13 | #ifndef GO_CGO_GOSTRING_TYPEDEF 14 | typedef struct { const char *p; ptrdiff_t n; } _GoString_; 15 | extern size_t _GoStringLen(_GoString_ s); 16 | extern const char *_GoStringPtr(_GoString_ s); 17 | #endif 18 | 19 | #endif 20 | 21 | /* Start of preamble from import "C" comments. */ 22 | 23 | 24 | #line 3 "core_hello_shim.go" 25 | 26 | 27 | 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | extern int goHelloCall(RCorePluginSession *cps, char *input); 36 | extern int goHelloInit(RCorePluginSession *cps); 37 | extern int goHelloFini(RCorePluginSession *cps); 38 | 39 | static inline bool hello_call(RCorePluginSession *cps, const char *input) { 40 | return goHelloCall(cps, (char *)input) != 0; 41 | } 42 | 43 | static inline bool hello_init(RCorePluginSession *cps) { 44 | return goHelloInit(cps) != 0; 45 | } 46 | 47 | static inline bool hello_fini(RCorePluginSession *cps) { 48 | return goHelloFini(cps) != 0; 49 | } 50 | 51 | static inline void cps_set_handle(RCorePluginSession *cps, uintptr_t handle) { 52 | cps->data = (void *)handle; 53 | } 54 | 55 | static inline uintptr_t cps_get_handle(RCorePluginSession *cps) { 56 | return (uintptr_t)cps->data; 57 | } 58 | 59 | static inline RCons *cps_cons(RCorePluginSession *cps) { 60 | return cps && cps->core ? cps->core->cons : NULL; 61 | } 62 | 63 | RCorePlugin r_core_plugin_hello __attribute__((weak, used)) = { 64 | .meta = { 65 | .name = "core-hello", 66 | .desc = "hello world from an r2core plugin", 67 | .author = "pancake", 68 | .license = "MIT", 69 | }, 70 | .call = hello_call, 71 | .init = hello_init, 72 | .fini = hello_fini, 73 | }; 74 | 75 | #ifndef R2_PLUGIN_INCORE 76 | RLibStruct radare_plugin __attribute__((weak, used)) = { 77 | .type = R_LIB_TYPE_CORE, 78 | .data = &r_core_plugin_hello, 79 | .version = R2_VERSION, 80 | .abiversion = R2_ABIVERSION 81 | }; 82 | #endif 83 | 84 | #line 1 "cgo-generated-wrapper" 85 | 86 | 87 | /* End of preamble from import "C" comments. */ 88 | 89 | 90 | /* Start of boilerplate cgo prologue. */ 91 | #line 1 "cgo-gcc-export-header-prolog" 92 | 93 | #ifndef GO_CGO_PROLOGUE_H 94 | #define GO_CGO_PROLOGUE_H 95 | 96 | typedef signed char GoInt8; 97 | typedef unsigned char GoUint8; 98 | typedef short GoInt16; 99 | typedef unsigned short GoUint16; 100 | typedef int GoInt32; 101 | typedef unsigned int GoUint32; 102 | typedef long long GoInt64; 103 | typedef unsigned long long GoUint64; 104 | typedef GoInt64 GoInt; 105 | typedef GoUint64 GoUint; 106 | typedef size_t GoUintptr; 107 | typedef float GoFloat32; 108 | typedef double GoFloat64; 109 | #ifdef _MSC_VER 110 | #if !defined(__cplusplus) || _MSVC_LANG <= 201402L 111 | #include 112 | typedef _Fcomplex GoComplex64; 113 | typedef _Dcomplex GoComplex128; 114 | #else 115 | #include 116 | typedef std::complex GoComplex64; 117 | typedef std::complex GoComplex128; 118 | #endif 119 | #else 120 | typedef float _Complex GoComplex64; 121 | typedef double _Complex GoComplex128; 122 | #endif 123 | 124 | /* 125 | static assertion to make sure the file is being used on architecture 126 | at least with matching size of GoInt. 127 | */ 128 | typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; 129 | 130 | #ifndef GO_CGO_GOSTRING_TYPEDEF 131 | typedef _GoString_ GoString; 132 | #endif 133 | typedef void *GoMap; 134 | typedef void *GoChan; 135 | typedef struct { void *t; void *v; } GoInterface; 136 | typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; 137 | 138 | #endif 139 | 140 | /* End of boilerplate cgo prologue. */ 141 | 142 | #ifdef __cplusplus 143 | extern "C" { 144 | #endif 145 | 146 | extern int goHelloCall(RCorePluginSession* cps, char* input); 147 | extern int goHelloInit(RCorePluginSession* cps); 148 | extern int goHelloFini(RCorePluginSession* cps); 149 | 150 | #ifdef __cplusplus 151 | } 152 | #endif 153 | -------------------------------------------------------------------------------- /r2-plugin-arch-py/archplug.py: -------------------------------------------------------------------------------- 1 | # Example Python Arch plugin written in Python 2 | # ============================================ 3 | # 4 | # -- astuder 5 | # 6 | # To locad the plugin launch radare2 with 'r2 -i test-py-arch.py ..' 7 | # or run '#!python test-py-arch.py' on the radare2 console 8 | 9 | import r2lang 10 | from r2lang import R 11 | 12 | def pyarch(a): 13 | # called when arch is activated in radare2, useful to run r2 commands 14 | # with rlang.cmd() to set variables or create IO maps 15 | def init(): 16 | r2lang.cmd("e asm.syntax=intel") 17 | return 18 | 19 | # describes layout of register file for the architecture 20 | # return: string with layout of the register file 21 | def regs(): 22 | return "=PC pc\n" + \ 23 | "=SP sp\n" + \ 24 | "=A0 r0\n" + \ 25 | "gpr r0 .32 0 0\n" + \ 26 | "gpr r1 .32 4 0\n" + \ 27 | "gpr r2 .32 8 0\n" + \ 28 | "gpr r3 .32 12 0\n" + \ 29 | "gpr r4 .32 16 0\n" + \ 30 | "gpr r5 .32 20 0\n" + \ 31 | "gpr sp .32 24 0\n" + \ 32 | "gpr pc .32 28 0\n" 33 | 34 | # provides radare2 with information about instruction size and memory alignment 35 | # query: attribute requested 36 | # return: value of requested attribute 37 | def info(query): 38 | arch_info = { 39 | R.R_ARCH_INFO_MINOP_SIZE: 1, 40 | R.R_ARCH_INFO_MAXOP_SIZE: 2, 41 | R.R_ARCH_INFO_INVOP_SIZE: 1, # invalid op size 42 | R.R_ARCH_INFO_CODE_ALIGN: 1, 43 | R.R_ARCH_INFO_DATA_ALIGN: 1, 44 | R.R_ARCH_INFO_DATA2_ALIGN: 2, 45 | R.R_ARCH_INFO_DATA4_ALIGN: 4, 46 | R.R_ARCH_INFO_DATA8_ALIGN: 8 47 | } 48 | res = arch_info.get(query) 49 | if res is None: 50 | return 0 51 | else: 52 | return res 53 | 54 | # decodes machine code and returns information about the instruction 55 | # buf: buffer with bytes to decode 56 | # pc: memory address where the buffer came from 57 | # mask: information requested by radare, use is optional for better performance 58 | # see radare2/libr/include/r_arch.h for documentation 59 | # return: list object with: 60 | # number of bytes processed in from buf to decode instruction 61 | # dict with disassembly and metadata about the instruction, most important fields are: 62 | # mnemonic: string with disassembled instruction, as shown to user 63 | # type: type of instruction 64 | # jump: target address for branch instructions 65 | # ptr: address for instructions that access memory 66 | # see radare2/libr/include/r_anal/op.h for more details and complete list of fields 67 | def decode(buf, pc, mask): 68 | ops = { 69 | 0: { 70 | "op": { 71 | "mnemonic" : "nop", 72 | "type" : R.R_ANAL_OP_TYPE_NOP, 73 | "cycles" : 1, 74 | }, 75 | "size": 1 76 | }, 77 | 1: { 78 | "op": { 79 | "mnemonic" : "mov r{}, 0x{:02x}".format(buf[1], buf[2]), 80 | "type" : R.R_ANAL_OP_TYPE_MOV, 81 | "cycles" : 2, 82 | "ptr" : buf[2], 83 | "direction" : R.R_ANAL_OP_DIR_READ, 84 | }, 85 | "size": 3 86 | }, 87 | 2: { 88 | "op": { 89 | "mnemonic" : "fadd r{}, 0x{:02x}".format(buf[1], buf[2]), 90 | "type" : R.R_ANAL_OP_TYPE_ADD, 91 | "family" : R.R_ANAL_OP_FAMILY_FPU, 92 | "cycles" : 2, 93 | "val" : buf[2], 94 | }, 95 | "size": 3 96 | }, 97 | 3: { 98 | "op": { 99 | "mnemonic" : "jne 0x{:04x}".format((buf[1] << 8) | buf[2]), 100 | "type" : R.R_ANAL_OP_TYPE_CJMP, 101 | "cycles" : 2, 102 | "jump" : (buf[1] << 8) | buf[2], 103 | "fail" : pc+3, 104 | "cond" : R.R_ANAL_COND_NE, 105 | "eob" : True 106 | }, 107 | "size": 3 108 | } 109 | } 110 | decoded_op = ops.get(buf[0]) 111 | if decoded_op is None: 112 | return [ 2, None ] 113 | return [ decoded_op.get("size"), decoded_op.get("op") ] 114 | 115 | # assembles provided string into machine code 116 | # addr: memory address where assembled instruction will be located 117 | # str: line of code to assemble 118 | # return: bytes of assembled code, or None on error 119 | def encode(addr, str): 120 | import pyparsing as pp 121 | p = pp.Word(pp.alphanums) + pp.Optional( pp.Word(pp.alphanums) + pp.Optional(',' + pp.Word(pp.alphanums))) 122 | asm = p.parseString(str) 123 | if asm[0] == "nop": 124 | return b'\x00' 125 | elif asm[0] == "mov" and len(asm) == 4: 126 | if asm[1].startswith("r"): 127 | if asm[3].isdigit(): 128 | return bytes([1, int(asm[1][1:]), int(asm[3])]) 129 | if asm[3].startswith("0x"): 130 | return bytes([1, int(asm[1][1:]), int(asm[3], 16)]) 131 | return None 132 | 133 | # definition of the architecture this plugin implements 134 | # return: dict with metadata about the plugin, and the functions that implement the plugin 135 | # name: pretty name of the plugin 136 | # arch: identifier used for referencing architecture in radare, e.g. via: e asm.arch=x 137 | # bits: bits of this architecture 138 | # regs: layout of register file 139 | # info: info about instruction size and memory alignment 140 | # decode: disassemble code 141 | # encode: assemble code 142 | return { 143 | "name": "MyPyArch", 144 | "arch": "pyarch", 145 | "bits": 32, 146 | "license": "GPL", 147 | "desc": "arch plugin in python", 148 | "init": init, 149 | "regs": regs, 150 | "info": info, 151 | "decode": decode, 152 | "encode": encode, 153 | } 154 | 155 | # The r2lang.plugin function registers the plugin with radare2 156 | if not r2lang.plugin("arch", pyarch): 157 | print("Failed to register the python arch plugin.") 158 | -------------------------------------------------------------------------------- /r2-script-r2pipe-nodejs/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my first r2 script", 3 | "lockfileVersion": 2, 4 | "requires": true, 5 | "packages": { 6 | "": { 7 | "name": "my first r2 script", 8 | "dependencies": { 9 | "r2pipe-promise": "^1.6.1" 10 | }, 11 | "devDependencies": { 12 | "@types/node": "^20.9.0", 13 | "r2pipe": "^2.8.4" 14 | } 15 | }, 16 | "node_modules/@types/node": { 17 | "version": "20.9.0", 18 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 19 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 20 | "dev": true, 21 | "dependencies": { 22 | "undici-types": "~5.26.4" 23 | } 24 | }, 25 | "node_modules/acorn": { 26 | "version": "6.4.2", 27 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", 28 | "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", 29 | "bin": { 30 | "acorn": "bin/acorn" 31 | }, 32 | "engines": { 33 | "node": ">=0.4.0" 34 | } 35 | }, 36 | "node_modules/acorn-loose": { 37 | "version": "6.1.0", 38 | "resolved": "https://registry.npmjs.org/acorn-loose/-/acorn-loose-6.1.0.tgz", 39 | "integrity": "sha512-FHhXoiF0Uch3IqsrnPpWwCtiv5PYvipTpT1k9lDMgQVVYc9iDuSl5zdJV358aI8twfHCYMFBRVYvAVki9wC/ng==", 40 | "dependencies": { 41 | "acorn": "^6.2.0" 42 | }, 43 | "engines": { 44 | "node": ">=0.4.0" 45 | } 46 | }, 47 | "node_modules/acorn-walk": { 48 | "version": "6.2.0", 49 | "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", 50 | "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", 51 | "engines": { 52 | "node": ">=0.4.0" 53 | } 54 | }, 55 | "node_modules/balanced-match": { 56 | "version": "1.0.2", 57 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", 58 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" 59 | }, 60 | "node_modules/brace-expansion": { 61 | "version": "1.1.11", 62 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 63 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 64 | "dependencies": { 65 | "balanced-match": "^1.0.0", 66 | "concat-map": "0.0.1" 67 | } 68 | }, 69 | "node_modules/concat-map": { 70 | "version": "0.0.1", 71 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 72 | "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" 73 | }, 74 | "node_modules/core-util-is": { 75 | "version": "1.0.3", 76 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", 77 | "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" 78 | }, 79 | "node_modules/enhanced-resolve": { 80 | "version": "2.3.0", 81 | "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-2.3.0.tgz", 82 | "integrity": "sha512-n6e4bsCpzsP0OB76X+vEWhySUQI8GHPVFVK+3QkX35tbryy2WoeGeK5kQ+oxzgDVHjIZyz5fyS60Mi3EpQLc0Q==", 83 | "dependencies": { 84 | "graceful-fs": "^4.1.2", 85 | "memory-fs": "^0.3.0", 86 | "object-assign": "^4.0.1", 87 | "tapable": "^0.2.3" 88 | }, 89 | "engines": { 90 | "node": ">=0.6" 91 | } 92 | }, 93 | "node_modules/errno": { 94 | "version": "0.1.8", 95 | "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", 96 | "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", 97 | "dependencies": { 98 | "prr": "~1.0.1" 99 | }, 100 | "bin": { 101 | "errno": "cli.js" 102 | } 103 | }, 104 | "node_modules/fs.realpath": { 105 | "version": "1.0.0", 106 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 107 | "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" 108 | }, 109 | "node_modules/glob": { 110 | "version": "7.2.3", 111 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", 112 | "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", 113 | "dependencies": { 114 | "fs.realpath": "^1.0.0", 115 | "inflight": "^1.0.4", 116 | "inherits": "2", 117 | "minimatch": "^3.1.1", 118 | "once": "^1.3.0", 119 | "path-is-absolute": "^1.0.0" 120 | }, 121 | "engines": { 122 | "node": "*" 123 | }, 124 | "funding": { 125 | "url": "https://github.com/sponsors/isaacs" 126 | } 127 | }, 128 | "node_modules/graceful-fs": { 129 | "version": "4.2.11", 130 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", 131 | "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" 132 | }, 133 | "node_modules/inflight": { 134 | "version": "1.0.6", 135 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 136 | "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", 137 | "dependencies": { 138 | "once": "^1.3.0", 139 | "wrappy": "1" 140 | } 141 | }, 142 | "node_modules/inherits": { 143 | "version": "2.0.4", 144 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 145 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 146 | }, 147 | "node_modules/isarray": { 148 | "version": "1.0.0", 149 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 150 | "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" 151 | }, 152 | "node_modules/memory-fs": { 153 | "version": "0.3.0", 154 | "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.3.0.tgz", 155 | "integrity": "sha512-QTNXnl79X97kZ9jJk/meJrtDuvgvRakX5LU7HZW1L7MsXHuSTwoMIzN9tOLLH3Xfsj/gbsSqX/ovnsqz246zKQ==", 156 | "dependencies": { 157 | "errno": "^0.1.3", 158 | "readable-stream": "^2.0.1" 159 | } 160 | }, 161 | "node_modules/minimatch": { 162 | "version": "3.1.2", 163 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 164 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 165 | "dependencies": { 166 | "brace-expansion": "^1.1.7" 167 | }, 168 | "engines": { 169 | "node": "*" 170 | } 171 | }, 172 | "node_modules/object-assign": { 173 | "version": "4.1.1", 174 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 175 | "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", 176 | "engines": { 177 | "node": ">=0.10.0" 178 | } 179 | }, 180 | "node_modules/once": { 181 | "version": "1.4.0", 182 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 183 | "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", 184 | "dependencies": { 185 | "wrappy": "1" 186 | } 187 | }, 188 | "node_modules/path-is-absolute": { 189 | "version": "1.0.1", 190 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 191 | "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", 192 | "engines": { 193 | "node": ">=0.10.0" 194 | } 195 | }, 196 | "node_modules/process-nextick-args": { 197 | "version": "2.0.1", 198 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 199 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" 200 | }, 201 | "node_modules/prr": { 202 | "version": "1.0.1", 203 | "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", 204 | "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==" 205 | }, 206 | "node_modules/r2pipe": { 207 | "version": "2.8.4", 208 | "resolved": "https://registry.npmjs.org/r2pipe/-/r2pipe-2.8.4.tgz", 209 | "integrity": "sha512-NsGGaowBIM0PVDQL7nmIf2C3shBkBzQONXJHM3Mh5Zzn/dRl8VCRXSu8mThMfYqtIgeqS4alQFYKploCc5VBYQ==", 210 | "dependencies": { 211 | "tern": "^0.24.2" 212 | }, 213 | "engines": { 214 | "iojs": ">= 1.0.0", 215 | "node": ">= 4.2.0" 216 | } 217 | }, 218 | "node_modules/r2pipe-promise": { 219 | "version": "1.6.1", 220 | "resolved": "https://registry.npmjs.org/r2pipe-promise/-/r2pipe-promise-1.6.1.tgz", 221 | "integrity": "sha512-wpIBh4OCKdthQNmd4I6GPIN1MP+L/FytvOTBXUqskNEXvKE8Jwe15/xogDdc483exiRwZFF62WYf0h0R+WZM6Q==", 222 | "dependencies": { 223 | "r2pipe": "^2.8.0" 224 | } 225 | }, 226 | "node_modules/readable-stream": { 227 | "version": "2.3.8", 228 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", 229 | "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", 230 | "dependencies": { 231 | "core-util-is": "~1.0.0", 232 | "inherits": "~2.0.3", 233 | "isarray": "~1.0.0", 234 | "process-nextick-args": "~2.0.0", 235 | "safe-buffer": "~5.1.1", 236 | "string_decoder": "~1.1.1", 237 | "util-deprecate": "~1.0.1" 238 | } 239 | }, 240 | "node_modules/resolve-from": { 241 | "version": "2.0.0", 242 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", 243 | "integrity": "sha512-qpFcKaXsq8+oRoLilkwyc7zHGF5i9Q2/25NIgLQQ/+VVv9rU4qvr6nXVAw1DsnXJyQkZsR4Ytfbtg5ehfcUssQ==", 244 | "engines": { 245 | "node": ">=0.10.0" 246 | } 247 | }, 248 | "node_modules/safe-buffer": { 249 | "version": "5.1.2", 250 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 251 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 252 | }, 253 | "node_modules/string_decoder": { 254 | "version": "1.1.1", 255 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 256 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 257 | "dependencies": { 258 | "safe-buffer": "~5.1.0" 259 | } 260 | }, 261 | "node_modules/tapable": { 262 | "version": "0.2.9", 263 | "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.9.tgz", 264 | "integrity": "sha512-2wsvQ+4GwBvLPLWsNfLCDYGsW6xb7aeC6utq2Qh0PFwgEy7K7dsma9Jsmb2zSQj7GvYAyUGSntLtsv++GmgL1A==", 265 | "engines": { 266 | "node": ">=0.6" 267 | } 268 | }, 269 | "node_modules/tern": { 270 | "version": "0.24.3", 271 | "resolved": "https://registry.npmjs.org/tern/-/tern-0.24.3.tgz", 272 | "integrity": "sha512-Z8uvtdWIlFn1GWy0HW5FhZ8VDryZwoJUdnjZU25C7/PBOltLIn1uv+WF3rVq6S1761YbsmbZYRP/l0ZJBCkvrw==", 273 | "dependencies": { 274 | "acorn": "^6.0.0", 275 | "acorn-loose": "^6.0.0", 276 | "acorn-walk": "^6.0.0", 277 | "enhanced-resolve": "^2.2.2", 278 | "glob": "^7.1.1", 279 | "minimatch": "^3.0.3", 280 | "resolve-from": "2.0.0" 281 | }, 282 | "bin": { 283 | "tern": "bin/tern" 284 | } 285 | }, 286 | "node_modules/undici-types": { 287 | "version": "5.26.5", 288 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 289 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 290 | "dev": true 291 | }, 292 | "node_modules/util-deprecate": { 293 | "version": "1.0.2", 294 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 295 | "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" 296 | }, 297 | "node_modules/wrappy": { 298 | "version": "1.0.2", 299 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 300 | "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" 301 | } 302 | }, 303 | "dependencies": { 304 | "@types/node": { 305 | "version": "20.9.0", 306 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", 307 | "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", 308 | "dev": true, 309 | "requires": { 310 | "undici-types": "~5.26.4" 311 | } 312 | }, 313 | "acorn": { 314 | "version": "6.4.2", 315 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", 316 | "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==" 317 | }, 318 | "acorn-loose": { 319 | "version": "6.1.0", 320 | "resolved": "https://registry.npmjs.org/acorn-loose/-/acorn-loose-6.1.0.tgz", 321 | "integrity": "sha512-FHhXoiF0Uch3IqsrnPpWwCtiv5PYvipTpT1k9lDMgQVVYc9iDuSl5zdJV358aI8twfHCYMFBRVYvAVki9wC/ng==", 322 | "requires": { 323 | "acorn": "^6.2.0" 324 | } 325 | }, 326 | "acorn-walk": { 327 | "version": "6.2.0", 328 | "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", 329 | "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==" 330 | }, 331 | "balanced-match": { 332 | "version": "1.0.2", 333 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", 334 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" 335 | }, 336 | "brace-expansion": { 337 | "version": "1.1.11", 338 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 339 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 340 | "requires": { 341 | "balanced-match": "^1.0.0", 342 | "concat-map": "0.0.1" 343 | } 344 | }, 345 | "concat-map": { 346 | "version": "0.0.1", 347 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 348 | "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" 349 | }, 350 | "core-util-is": { 351 | "version": "1.0.3", 352 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", 353 | "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" 354 | }, 355 | "enhanced-resolve": { 356 | "version": "2.3.0", 357 | "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-2.3.0.tgz", 358 | "integrity": "sha512-n6e4bsCpzsP0OB76X+vEWhySUQI8GHPVFVK+3QkX35tbryy2WoeGeK5kQ+oxzgDVHjIZyz5fyS60Mi3EpQLc0Q==", 359 | "requires": { 360 | "graceful-fs": "^4.1.2", 361 | "memory-fs": "^0.3.0", 362 | "object-assign": "^4.0.1", 363 | "tapable": "^0.2.3" 364 | } 365 | }, 366 | "errno": { 367 | "version": "0.1.8", 368 | "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", 369 | "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", 370 | "requires": { 371 | "prr": "~1.0.1" 372 | } 373 | }, 374 | "fs.realpath": { 375 | "version": "1.0.0", 376 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 377 | "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" 378 | }, 379 | "glob": { 380 | "version": "7.2.3", 381 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", 382 | "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", 383 | "requires": { 384 | "fs.realpath": "^1.0.0", 385 | "inflight": "^1.0.4", 386 | "inherits": "2", 387 | "minimatch": "^3.1.1", 388 | "once": "^1.3.0", 389 | "path-is-absolute": "^1.0.0" 390 | } 391 | }, 392 | "graceful-fs": { 393 | "version": "4.2.11", 394 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", 395 | "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" 396 | }, 397 | "inflight": { 398 | "version": "1.0.6", 399 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 400 | "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", 401 | "requires": { 402 | "once": "^1.3.0", 403 | "wrappy": "1" 404 | } 405 | }, 406 | "inherits": { 407 | "version": "2.0.4", 408 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 409 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 410 | }, 411 | "isarray": { 412 | "version": "1.0.0", 413 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 414 | "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" 415 | }, 416 | "memory-fs": { 417 | "version": "0.3.0", 418 | "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.3.0.tgz", 419 | "integrity": "sha512-QTNXnl79X97kZ9jJk/meJrtDuvgvRakX5LU7HZW1L7MsXHuSTwoMIzN9tOLLH3Xfsj/gbsSqX/ovnsqz246zKQ==", 420 | "requires": { 421 | "errno": "^0.1.3", 422 | "readable-stream": "^2.0.1" 423 | } 424 | }, 425 | "minimatch": { 426 | "version": "3.1.2", 427 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 428 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 429 | "requires": { 430 | "brace-expansion": "^1.1.7" 431 | } 432 | }, 433 | "object-assign": { 434 | "version": "4.1.1", 435 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 436 | "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" 437 | }, 438 | "once": { 439 | "version": "1.4.0", 440 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 441 | "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", 442 | "requires": { 443 | "wrappy": "1" 444 | } 445 | }, 446 | "path-is-absolute": { 447 | "version": "1.0.1", 448 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 449 | "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" 450 | }, 451 | "process-nextick-args": { 452 | "version": "2.0.1", 453 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 454 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" 455 | }, 456 | "prr": { 457 | "version": "1.0.1", 458 | "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", 459 | "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==" 460 | }, 461 | "r2pipe": { 462 | "version": "2.8.4", 463 | "resolved": "https://registry.npmjs.org/r2pipe/-/r2pipe-2.8.4.tgz", 464 | "integrity": "sha512-NsGGaowBIM0PVDQL7nmIf2C3shBkBzQONXJHM3Mh5Zzn/dRl8VCRXSu8mThMfYqtIgeqS4alQFYKploCc5VBYQ==", 465 | "requires": { 466 | "tern": "^0.24.2" 467 | } 468 | }, 469 | "r2pipe-promise": { 470 | "version": "1.6.1", 471 | "resolved": "https://registry.npmjs.org/r2pipe-promise/-/r2pipe-promise-1.6.1.tgz", 472 | "integrity": "sha512-wpIBh4OCKdthQNmd4I6GPIN1MP+L/FytvOTBXUqskNEXvKE8Jwe15/xogDdc483exiRwZFF62WYf0h0R+WZM6Q==", 473 | "requires": { 474 | "r2pipe": "^2.8.0" 475 | } 476 | }, 477 | "readable-stream": { 478 | "version": "2.3.8", 479 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", 480 | "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", 481 | "requires": { 482 | "core-util-is": "~1.0.0", 483 | "inherits": "~2.0.3", 484 | "isarray": "~1.0.0", 485 | "process-nextick-args": "~2.0.0", 486 | "safe-buffer": "~5.1.1", 487 | "string_decoder": "~1.1.1", 488 | "util-deprecate": "~1.0.1" 489 | } 490 | }, 491 | "resolve-from": { 492 | "version": "2.0.0", 493 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", 494 | "integrity": "sha512-qpFcKaXsq8+oRoLilkwyc7zHGF5i9Q2/25NIgLQQ/+VVv9rU4qvr6nXVAw1DsnXJyQkZsR4Ytfbtg5ehfcUssQ==" 495 | }, 496 | "safe-buffer": { 497 | "version": "5.1.2", 498 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 499 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 500 | }, 501 | "string_decoder": { 502 | "version": "1.1.1", 503 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 504 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 505 | "requires": { 506 | "safe-buffer": "~5.1.0" 507 | } 508 | }, 509 | "tapable": { 510 | "version": "0.2.9", 511 | "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.9.tgz", 512 | "integrity": "sha512-2wsvQ+4GwBvLPLWsNfLCDYGsW6xb7aeC6utq2Qh0PFwgEy7K7dsma9Jsmb2zSQj7GvYAyUGSntLtsv++GmgL1A==" 513 | }, 514 | "tern": { 515 | "version": "0.24.3", 516 | "resolved": "https://registry.npmjs.org/tern/-/tern-0.24.3.tgz", 517 | "integrity": "sha512-Z8uvtdWIlFn1GWy0HW5FhZ8VDryZwoJUdnjZU25C7/PBOltLIn1uv+WF3rVq6S1761YbsmbZYRP/l0ZJBCkvrw==", 518 | "requires": { 519 | "acorn": "^6.0.0", 520 | "acorn-loose": "^6.0.0", 521 | "acorn-walk": "^6.0.0", 522 | "enhanced-resolve": "^2.2.2", 523 | "glob": "^7.1.1", 524 | "minimatch": "^3.0.3", 525 | "resolve-from": "2.0.0" 526 | } 527 | }, 528 | "undici-types": { 529 | "version": "5.26.5", 530 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 531 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 532 | "dev": true 533 | }, 534 | "util-deprecate": { 535 | "version": "1.0.2", 536 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 537 | "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" 538 | }, 539 | "wrappy": { 540 | "version": "1.0.2", 541 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 542 | "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" 543 | } 544 | } 545 | } 546 | --------------------------------------------------------------------------------