r2pipe 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/r2pipe.rb +24 -26
- data/lib/r2pipe/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cd0ed01cd73d94e861c4df971e7971faeb17b94
|
4
|
+
data.tar.gz: 5e8a47c903624fa129119d3de4a1b9583d5b1d52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07189412b734239a5da651065dd5d3e906ac580f0daffe98222ce942d61cbc132ea40c622fe20ee9b076b44c744c3f2322b10f2c4f8fc9df3a174148800c4867
|
7
|
+
data.tar.gz: 8ea3c34421fd1c87c11a718b2e689f5108b7865faf12eb81703f3d45afc311ca0d9b6d0fa292ed6a733c66fcca0d26c6bfcbe9e88e63dce7d740f4f69afbd577
|
data/README.md
CHANGED
data/lib/r2pipe.rb
CHANGED
@@ -3,35 +3,33 @@ require 'pty'
|
|
3
3
|
require 'json'
|
4
4
|
require 'shellwords'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
@read.gets("\0")
|
17
|
-
end
|
6
|
+
# R2Pipe is an easy way to communicate with an r2 core through ruby
|
7
|
+
class R2Pipe
|
8
|
+
def initialize(file)
|
9
|
+
@file = file
|
10
|
+
exec = "r2 -q0 #{Shellwords.shellescape file} 2>/dev/null"
|
11
|
+
PTY.spawn(exec) do |read, write, pid|
|
12
|
+
@read = read
|
13
|
+
@write = write
|
14
|
+
@pid = pid
|
15
|
+
@read.gets("\0")
|
18
16
|
end
|
17
|
+
end
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
# runs a command on the radare2 core
|
20
|
+
def cmd(str)
|
21
|
+
@write.print "#{str}\n"
|
22
|
+
@read.gets("\0")[0..-2]
|
23
|
+
end
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
# closes the radare2 core and quits
|
26
|
+
def quit
|
27
|
+
cmd('q!')
|
28
|
+
::Process.wait @pid
|
29
|
+
end
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
31
|
+
# returns a parsed json string
|
32
|
+
def json(str)
|
33
|
+
JSON.parse str.sub("\n", '').sub("\r", '')
|
36
34
|
end
|
37
35
|
end
|
data/lib/r2pipe/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r2pipe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey Crowell
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|