r2pipe 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e704f13a7167821d211d8719a13a7ea52f3dfacc
4
- data.tar.gz: fe52e28dc67357ae80cfef586efa9519fbe70f0c
3
+ metadata.gz: 5815400a10873eee220bb59709c3b33c0b507bc3
4
+ data.tar.gz: a3d828c7554e137e3091f923b1e348c0b9d8ae3b
5
5
  SHA512:
6
- metadata.gz: 1042254c44fc987d15f3caf9da81652d123c75c1ad34d4cd7f69e4c5f0789c6a966518fac82aa432087e706441041b929d1124b5f5bd9c6293ba40fa673aacad
7
- data.tar.gz: 2095d822db51d872a512ad84cbcaa214de99d10914648157d652dab4c9b8ad9e251ad9cc43ef7604306f2f2210c4567438574aebda52ffedffb4871762630ee3
6
+ metadata.gz: 6cc2d21f5ad3b466fd382b3da39f8b2599ae9544c661a9e92b4dce62e830a173db6ef263bc9bd3d27d243f0ed91ca6c3c94f62904127bdf55a07bed2c535ccad
7
+ data.tar.gz: 36fd14b1bea6bd8e46de3cd26e640a896f3e9f4c7be4e111bd7fff5713c9c1c511d5fbdf3196db9d96fda31f7721fd1db532df15bb6f3cd7a839082fd7991720
data/README.md CHANGED
@@ -46,7 +46,7 @@ puts '===================='
46
46
  r2p = R2Pipe.new '/bin/ls'
47
47
  puts r2p.cmd 'pi 5'
48
48
  puts r2p.cmd 'pij 1'
49
- puts r2p.json(r2p.cmd 'pij 1')
49
+ puts r2p.cmdj 'pij 1'
50
50
  puts r2p.cmd 'px 64'
51
51
  r2p.quit
52
52
  ```
@@ -1,5 +1,8 @@
1
- require 'r2pipe/version'
2
- require 'pty'
1
+ #!/usr/bin/env ruby
2
+
3
+ # author pancake@nopcode.org
4
+
5
+ require 'open3'
3
6
  require 'json'
4
7
  require 'shellwords'
5
8
 
@@ -17,13 +20,12 @@ class R2Pipe
17
20
  @write = IO.new(fdOut, 'w')
18
21
  @pid = -1
19
22
  else
20
- exec = "r2 -q0 #{Shellwords.shellescape file} 2>/dev/null"
21
- PTY.spawn(exec) do |read, write, pid|
22
- @read = read
23
- @write = write
24
- @pid = pid
25
- @read.gets("\0")
26
- end
23
+ exec = "radare2 -q0 #{Shellwords.shellescape file} 2>/dev/null"
24
+ write, read, wait_thr = Open3.popen2(exec)
25
+ @read = read
26
+ @write = write
27
+ @pid = wait_thr.pid
28
+ @read.gets("\0")
27
29
  end
28
30
  end
29
31
 
@@ -47,7 +49,7 @@ class R2Pipe
47
49
  end
48
50
 
49
51
  def json(str)
50
- if !str.nil?
52
+ if str != nil
51
53
  JSON.parse str.sub("\n", '').sub("\r", '')
52
54
  end
53
55
  end
@@ -1,3 +1,3 @@
1
1
  module R2pipe
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
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.3
4
+ version: 0.1.4
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: 2017-11-06 00:00:00.000000000 Z
12
+ date: 2018-11-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 2.6.12
85
+ rubygems_version: 2.6.14
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Communicate with Radare2 via pipes.