mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 11:43:39 +00:00
Node-ffi bindings: minor fixes in the examples.
This commit is contained in:
parent
0ecca40e71
commit
41db950d22
@ -2,16 +2,16 @@ const r2 = require ('../r_asm');
|
||||
|
||||
/* Using the RAsm API */
|
||||
function Assembler(arch, bits) {
|
||||
var $this = new r2.RAsm();
|
||||
$this.use(arch);
|
||||
$this.set_bits(bits);
|
||||
var $this = new r2.RAsm();
|
||||
$this.use(arch);
|
||||
$this.set_bits(bits);
|
||||
|
||||
this.assemble = function(x) {
|
||||
return $this.massemble(x).buf_hex;
|
||||
};
|
||||
this.disassemble = function(x) {
|
||||
return $this.mdisassemble_hexstr(x).buf_asm;
|
||||
};
|
||||
this.assemble = function(x) {
|
||||
return $this.massemble(x).buf_hex;
|
||||
};
|
||||
this.disassemble = function(x) {
|
||||
return $this.mdisassemble_hexstr(x).buf_asm;
|
||||
};
|
||||
}
|
||||
|
||||
var asm = new Assembler('x86', 32);
|
||||
|
@ -1,7 +1,8 @@
|
||||
var r2 = require('../r_bin')
|
||||
|
||||
var b = new r2.RBin()
|
||||
b.load(process.argv[2] || '/bin/ls', false);
|
||||
var b = new r2.RBin(), fileName = process.argv[2] || '/bin/ls';
|
||||
if(!b.load(fileName, false))
|
||||
console.error('Cannot open '+fileName), process.exit(1);
|
||||
|
||||
console.log('Base address:', b.get_baddr().toString(16));
|
||||
console.log('Sections:');
|
||||
|
@ -5,8 +5,8 @@ var core = new r2.RCore(), cons = r2.RCons;
|
||||
var fileName = process.argv[2] || '/bin/ls';
|
||||
var file = core.file_open(fileName, 0, 0);
|
||||
|
||||
if(file._pointer.isNull())
|
||||
console.error('Cannot open '+fileName), process.exit(1);
|
||||
if(file == null)
|
||||
console.error('Cannot open '+fileName), process.exit(1);
|
||||
|
||||
//core.bin_load('test.js');
|
||||
//core.seek(0, true); core.block_read(0);
|
||||
|
Loading…
Reference in New Issue
Block a user