rubypwn 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/exec.rb +70 -0
  3. data/lib/netcat.rb +7 -0
  4. data/lib/rubypwn.rb +1 -69
  5. metadata +3 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a4860a1c451dbeacfdfe8442d7f8886d07609b8
4
- data.tar.gz: 40df592c1734fa3e1a69be9cb58fd968cd906ac1
3
+ metadata.gz: 9962b7cffbe5ccc0ed33633318562a04d8546423
4
+ data.tar.gz: 65b62ac0d97b32d7f38d66312e4739cae6213bb0
5
5
  SHA512:
6
- metadata.gz: 3c5043d1b33b4ac58b9d2bbe3f561361ee66a549e3b1eca8907e25384ab2667c8278e983f52afab110456268759f23c3b70e9139ea9bcb40090208e83e90964e
7
- data.tar.gz: 7a8a3e144f100d0130fa33a6f2cab22b99cd0c3ae002f57e34131204f679c6a1eb50e6758c3ec2e21d0c79a988bbe23df036f4809e514bce28fafce4b709c39a
6
+ metadata.gz: 7d96c8c5befd905cb66f4093285838c039594a60b81c4294103374d2360352092c6d01adb5469c304a5d44fc2045db52fbc3e26b8645031dd3aeca2b0a63ac12
7
+ data.tar.gz: f3ca9531138e226d40d4185d7c70909d0f6244cc414994f6779123f3bd6ce7a398d2c6ad73f423efaba2a99c366d6562f590656411b890338d1c561f5f222658
data/lib/exec.rb ADDED
@@ -0,0 +1,70 @@
1
+ require 'open3'
2
+
3
+ class Exec
4
+ public
5
+ def initialize(cmd)
6
+ handle_exception
7
+ @@i, @@o, s = Open3.popen2(cmd)
8
+ end
9
+
10
+ def read(size)
11
+ data = @@o.read size
12
+ write_flush $stdout, data
13
+ data
14
+ end
15
+
16
+ def readpartial(size)
17
+ data = @@o.readpartial size
18
+ write_flush $stdout, data
19
+ data
20
+ end
21
+
22
+ def write(data)
23
+ write_flush $stdout, data
24
+ write_flush @@i, data
25
+ end
26
+
27
+ def puts(data)
28
+ write "#{data}\n"
29
+ end
30
+
31
+ def gets
32
+ read_until "\n"
33
+ end
34
+
35
+ def read_until(str)
36
+ result = ""
37
+ loop do
38
+ result << @@o.read(1)
39
+ if result.end_with? str
40
+ write_flush $stdout, result
41
+ return result
42
+ end
43
+ end
44
+ end
45
+
46
+ def interactive
47
+ loop do
48
+ r = IO.select [@@o, $stdin]
49
+ if r[0].include? @@o
50
+ read 1
51
+ elsif r[0].include? $stdin
52
+ @@i.write $stdin.read(1)
53
+ end
54
+ end
55
+ end
56
+
57
+ private
58
+ def write_flush(fd, data)
59
+ fd.write data
60
+ fd.flush
61
+ end
62
+
63
+ def handle_exception
64
+ trap "SIGINT" do
65
+ $stdout.puts
66
+ $stdout.puts "interrupted"
67
+ exit -1
68
+ end
69
+ end
70
+ end
data/lib/netcat.rb ADDED
@@ -0,0 +1,7 @@
1
+ require_relative 'exec'
2
+
3
+ class Netcat < Exec
4
+ def initialize(ip, port)
5
+ super("nc #{ip} #{port}")
6
+ end
7
+ end
data/lib/rubypwn.rb CHANGED
@@ -1,71 +1,3 @@
1
- require 'open3'
2
1
  require_relative 'basic'
2
+ require_relative 'netcat'
3
3
 
4
- class Shell
5
- public
6
- def initialize(cmd)
7
- handle_exception
8
- @@i, @@o, s = Open3.popen2(cmd)
9
- end
10
-
11
- def read(size)
12
- data = @@o.read size
13
- write_flush $stdout, data
14
- data
15
- end
16
-
17
- def readpartial(size)
18
- data = @@o.readpartial size
19
- write_flush $stdout, data
20
- data
21
- end
22
-
23
- def write(data)
24
- write_flush $stdout, data
25
- write_flush @@i, data
26
- end
27
-
28
- def puts(data)
29
- write "#{data}\n"
30
- end
31
-
32
- def gets
33
- read_until "\n"
34
- end
35
-
36
- def read_until(str)
37
- result = ""
38
- loop do
39
- result << @@o.read(1)
40
- if result.end_with? str
41
- write_flush $stdout, result
42
- return result
43
- end
44
- end
45
- end
46
-
47
- def interactive
48
- loop do
49
- r = IO.select [@@o, $stdin]
50
- if r[0].include? @@o
51
- read 1
52
- elsif r[0].include? $stdin
53
- @@i.write $stdin.read(1)
54
- end
55
- end
56
- end
57
-
58
- private
59
- def write_flush(fd, data)
60
- fd.write data
61
- fd.flush
62
- end
63
-
64
- def handle_exception
65
- trap "SIGINT" do
66
- $stdout.puts
67
- $stdout.puts "interrupted"
68
- exit -1
69
- end
70
- end
71
- end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubypwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - atdog
@@ -17,6 +17,8 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - lib/basic.rb
20
+ - lib/exec.rb
21
+ - lib/netcat.rb
20
22
  - lib/rubypwn.rb
21
23
  homepage: http://rubygems.org/gems/rubypwn
22
24
  licenses: