Skip to content

Commit ae7299a

Browse files
committed
Bump node-ffi to 0.1 and fix some visual mode glitches
- npm install radare2.js - examples in r2-bindings/node-ffi/examples - Vn/N now moves between blocks - VG fixed for io.va - autoblocksize disabled forces visual screen clear
1 parent 5eeab22 commit ae7299a

File tree

8 files changed

+49
-40
lines changed

8 files changed

+49
-40
lines changed

node-ffi/Makefile

+2-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ LANG=node-ffi
22
LANG_EXT=js
33
LIBS_PFX=
44
FORCE_SOEXT=1
5-
SAVED=test.js test2.js test3.js
5+
SAVED=index.js
66

77
.PHONY: bar all
88
bar: node_modules all
@@ -12,12 +12,6 @@ include ../rules.mk
1212
node_modules:
1313
npm install
1414

15-
npm:
16-
rm -rf node_modules/r2
17-
mkdir -p node_modules/r2
15+
npm: clean
1816
${MAKE}
19-
cp package.json node_modules/r2/
20-
cp r_core.js node_modules/r2/index.js
21-
sed -e 's,./r_asm,r2,' test.js > node_modules/r2/test.js
22-
sed -e 's,./r_core,r2,' test2.js > node_modules/r2/test2.js
2317
npm publish

node-ffi/README.md

-7
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,3 @@ This directory contains the bindings of the r2 api for NodeJS
66
Install dependencies:
77
---------------------
88
`$ npm install`
9-
10-
11-
Test examples
12-
-------------
13-
`$ node test`
14-
`$ node test2`
15-
`$ node test3`

node-ffi/test.js node-ffi/examples/asm.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const r2 = require ('./r_asm');
1+
const r2 = require ('../r_asm');
22

33
/* Using the RAsm API */
44
function Assembler(arch, bits) {

node-ffi/examples/bin.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
var r2 = require('../r_bin')
2+
3+
var b = new r2.RBin()
4+
b.load(process.argv[2] || '/bin/ls', false);
5+
6+
console.log('Base address:', b.get_baddr().toString(16));
7+
console.log('Sections:');
8+
b.get_sections().forEach(function(x) {
9+
console.log(' %s: size=%d vsize=%d rva=%d offset=%s srwx=%s',
10+
x.name, x.size, x.vsize, x.rva,
11+
x.offset.toString(16), x.srwx.toString(16));
12+
});
13+
console.log('Symbols:');
14+
b.get_symbols().forEach (function(x) {
15+
console.log (' %s: fw=%s bind=%s type=%s rva=%d offset=%s size=%d ordinal=%d',
16+
x.name, x.forwarder, x.bind, x.type, x.rva,
17+
x.offset.toString(16), x.size, x.ordinal);
18+
});
19+
console.log('Imports:');
20+
b.get_imports().forEach(function(x) {
21+
console.log(' %s: bind=%s type=%s rva=%d offset=%s ordinal=%d hint=%d',
22+
x.name, x.bind, x.type, x.rva,
23+
x.offset.toString(16), x.ordinal, x.hint);
24+
});
25+
console.log('Strings:');
26+
b.get_strings().forEach(function(x) {
27+
console.log(' %s rva=%d offset=%s ordinal=%d size=%d',
28+
JSON.stringify(x.string), x.rva,
29+
x.offset.toString(16), x.ordinal, x.size);
30+
});

node-ffi/test2.js node-ffi/examples/core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var r2 = require ('./r_core');
1+
var r2 = require ('../r_core');
22

33
var core = new r2.RCore(), cons = r2.RCons;
44

node-ffi/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./r_core')

node-ffi/package.json

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
{ "name": "radare2.js",
2-
"version": "0.0.2",
2+
"version": "0.1.1",
33
"url": "http://www.radare.org",
44
"description": "radare2 valabind-ffi bindings for nodejs",
55
"dependencies": {
66
"ffi": "*",
77
"ref": "*",
88
"ref-struct": "*"
99
},
10+
"files": [
11+
"Makefile",
12+
"README.md",
13+
"examples",
14+
"examples/asm.js",
15+
"examples/bin.js",
16+
"examples/core.js",
17+
"index.js",
18+
"package.json",
19+
"r_asm.js",
20+
"r_bin.js",
21+
"r_core.js"
22+
],
1023
"keywords": [
1124
"reversing",
1225
"disassembler",

node-ffi/test3.js

-22
This file was deleted.

0 commit comments

Comments
 (0)