ronin-support 0.4.0 → 0.4.1
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.
- data/ChangeLog.md +17 -0
- data/Gemfile +5 -5
- data/README.md +10 -9
- data/Rakefile +1 -0
- data/gemspec.yml +2 -2
- data/lib/ronin/formatting/extensions/binary/string.rb +1 -2
- data/lib/ronin/network.rb +1 -0
- data/lib/ronin/network/extensions.rb +2 -0
- data/lib/ronin/network/extensions/dns.rb +20 -0
- data/lib/ronin/network/extensions/dns/net.rb +24 -0
- data/lib/ronin/network/extensions/http/uri/http.rb +47 -45
- data/lib/ronin/network/http/http.rb +26 -25
- data/lib/ronin/network/mixins/dns.rb +1 -1
- data/lib/ronin/network/mixins/esmtp.rb +3 -1
- data/lib/ronin/network/mixins/http.rb +23 -21
- data/lib/ronin/network/mixins/imap.rb +3 -1
- data/lib/ronin/network/mixins/pop3.rb +3 -1
- data/lib/ronin/network/mixins/smtp.rb +3 -1
- data/lib/ronin/network/mixins/ssl.rb +5 -1
- data/lib/ronin/network/mixins/tcp.rb +17 -1
- data/lib/ronin/network/mixins/telnet.rb +3 -1
- data/lib/ronin/network/mixins/udp.rb +12 -0
- data/lib/ronin/network/smtp/smtp.rb +2 -2
- data/lib/ronin/network/ssl.rb +122 -117
- data/lib/ronin/network/tcp.rb +9 -9
- data/lib/ronin/network/telnet.rb +1 -1
- data/lib/ronin/network/udp.rb +7 -7
- data/lib/ronin/support/support.rb +1 -0
- data/lib/ronin/support/version.rb +1 -1
- data/lib/ronin/ui/output/output.rb +1 -1
- data/lib/ronin/ui/output/terminal/color.rb +5 -5
- data/lib/ronin/ui/output/terminal/raw.rb +5 -5
- data/spec/extensions/string_spec.rb +14 -12
- data/spec/network/dns_spec.rb +6 -6
- data/spec/network/tcp_spec.rb +25 -22
- data/spec/network/udp_spec.rb +24 -21
- metadata +25 -23
@@ -37,7 +37,7 @@ module Ronin
|
|
37
37
|
# @api private
|
38
38
|
#
|
39
39
|
def self.write(data)
|
40
|
-
|
40
|
+
$stdout.write(data)
|
41
41
|
end
|
42
42
|
|
43
43
|
#
|
@@ -51,7 +51,7 @@ module Ronin
|
|
51
51
|
# @api private
|
52
52
|
#
|
53
53
|
def self.print_info(message)
|
54
|
-
puts "[-] #{message}"
|
54
|
+
$stdout.puts "[-] #{message}"
|
55
55
|
end
|
56
56
|
|
57
57
|
#
|
@@ -65,7 +65,7 @@ module Ronin
|
|
65
65
|
# @api private
|
66
66
|
#
|
67
67
|
def self.print_debug(message)
|
68
|
-
puts "[=] #{message}"
|
68
|
+
$stdout.puts "[=] #{message}"
|
69
69
|
end
|
70
70
|
|
71
71
|
#
|
@@ -79,7 +79,7 @@ module Ronin
|
|
79
79
|
# @api private
|
80
80
|
#
|
81
81
|
def self.print_warning(message)
|
82
|
-
puts "[*] #{message}"
|
82
|
+
$stdout.puts "[*] #{message}"
|
83
83
|
end
|
84
84
|
|
85
85
|
#
|
@@ -93,7 +93,7 @@ module Ronin
|
|
93
93
|
# @api private
|
94
94
|
#
|
95
95
|
def self.print_error(message)
|
96
|
-
puts "[!] #{message}"
|
96
|
+
$stdout.puts "[!] #{message}"
|
97
97
|
end
|
98
98
|
|
99
99
|
end
|
@@ -157,21 +157,23 @@ describe String do
|
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
|
-
|
161
|
-
|
162
|
-
"
|
163
|
-
|
160
|
+
if RUBY_VERSION < '1.9'
|
161
|
+
describe "#dump" do
|
162
|
+
it "should dump printable strings" do
|
163
|
+
"hello".dump.should == '"hello"'
|
164
|
+
end
|
164
165
|
|
165
|
-
|
166
|
-
|
167
|
-
|
166
|
+
it "should dump strings containing control characters" do
|
167
|
+
"hello\n\b\a".dump.should == '"hello\n\b\a"'
|
168
|
+
end
|
168
169
|
|
169
|
-
|
170
|
-
|
171
|
-
|
170
|
+
it "should dump strings containing non-printable characters" do
|
171
|
+
"hello\x90\x05\xEF".dump.should == '"hello\x90\x05\xEF"'
|
172
|
+
end
|
172
173
|
|
173
|
-
|
174
|
-
|
174
|
+
it "should dump the string when calling the inspect method" do
|
175
|
+
"hello\x90\x05\xEF".inspect.should == '"hello\x90\x05\xEF"'
|
176
|
+
end
|
175
177
|
end
|
176
178
|
end
|
177
179
|
end
|
data/spec/network/dns_spec.rb
CHANGED
@@ -82,7 +82,7 @@ describe Network::DNS do
|
|
82
82
|
|
83
83
|
describe "#dns_lookup_all" do
|
84
84
|
it "should lookup all addresses for a hostname" do
|
85
|
-
subject.dns_lookup_all(hostname).should
|
85
|
+
subject.dns_lookup_all(hostname).should include(address)
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should return an empty Array for unknown hostnames" do
|
@@ -90,11 +90,11 @@ describe Network::DNS do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
it "should accept non-String hostnames" do
|
93
|
-
subject.dns_lookup_all(hostname.to_sym).should
|
93
|
+
subject.dns_lookup_all(hostname.to_sym).should include(address)
|
94
94
|
end
|
95
95
|
|
96
96
|
it "should accept an additional nameserver argument" do
|
97
|
-
subject.dns_lookup_all(hostname,server).should
|
97
|
+
subject.dns_lookup_all(hostname,server).should include(address)
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -118,7 +118,7 @@ describe Network::DNS do
|
|
118
118
|
|
119
119
|
describe "#dns_reverse_lookup_all" do
|
120
120
|
it "should lookup all addresses for a hostname" do
|
121
|
-
subject.dns_reverse_lookup_all(address).should
|
121
|
+
subject.dns_reverse_lookup_all(address).should include(reverse_hostname)
|
122
122
|
end
|
123
123
|
|
124
124
|
it "should return an empty Array for unknown hostnames" do
|
@@ -126,11 +126,11 @@ describe Network::DNS do
|
|
126
126
|
end
|
127
127
|
|
128
128
|
it "should accept non-String addresses" do
|
129
|
-
subject.dns_reverse_lookup_all(IPAddr.new(address)).should
|
129
|
+
subject.dns_reverse_lookup_all(IPAddr.new(address)).should include(reverse_hostname)
|
130
130
|
end
|
131
131
|
|
132
132
|
it "should accept an additional nameserver argument" do
|
133
|
-
subject.dns_reverse_lookup_all(address,server).should
|
133
|
+
subject.dns_reverse_lookup_all(address,server).should include(reverse_hostname)
|
134
134
|
end
|
135
135
|
end
|
136
136
|
end
|
data/spec/network/tcp_spec.rb
CHANGED
@@ -30,10 +30,10 @@ describe Network::TCP do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should bind to a local host and port" do
|
33
|
-
socket
|
33
|
+
socket = subject.tcp_connect(host,port,nil,local_port)
|
34
|
+
bound_port = socket.addr[1]
|
34
35
|
|
35
|
-
|
36
|
-
local_address.ip_port.should == local_port
|
36
|
+
bound_port.should == local_port
|
37
37
|
|
38
38
|
socket.close
|
39
39
|
end
|
@@ -65,10 +65,10 @@ describe Network::TCP do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should bind to a local host and port" do
|
68
|
-
socket
|
68
|
+
socket = subject.tcp_connect_and_send(data,host,port,nil,local_port)
|
69
|
+
bound_port = socket.addr[1]
|
69
70
|
|
70
|
-
|
71
|
-
local_address.ip_port.should == local_port
|
71
|
+
bound_port.should == local_port
|
72
72
|
|
73
73
|
socket.close
|
74
74
|
end
|
@@ -102,13 +102,13 @@ describe Network::TCP do
|
|
102
102
|
end
|
103
103
|
|
104
104
|
it "should bind to a local host and port" do
|
105
|
-
|
105
|
+
bound_port = nil
|
106
106
|
|
107
107
|
subject.tcp_session(host,port,nil,local_port) do |socket|
|
108
|
-
|
108
|
+
bound_port = socket.addr[1]
|
109
109
|
end
|
110
110
|
|
111
|
-
|
111
|
+
bound_port.should == local_port
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
@@ -142,8 +142,8 @@ describe Network::TCP do
|
|
142
142
|
end
|
143
143
|
|
144
144
|
describe "#tcp_send" do
|
145
|
-
let(:server) { TCPServer.new(server_host,
|
146
|
-
let(:server_port) { server.
|
145
|
+
let(:server) { TCPServer.new(server_host,0) }
|
146
|
+
let(:server_port) { server.addr[1] }
|
147
147
|
|
148
148
|
let(:data) { "hello\n" }
|
149
149
|
let(:local_port) { 1024 + rand(65535 - 1024) }
|
@@ -164,10 +164,10 @@ describe Network::TCP do
|
|
164
164
|
it "should bind to a local host and port" do
|
165
165
|
subject.tcp_send(data,server_host,server_port,nil,local_port)
|
166
166
|
|
167
|
-
client
|
167
|
+
client = server.accept
|
168
|
+
client_port = client.peeraddr[1]
|
168
169
|
|
169
|
-
|
170
|
-
client_address.ip_port.should == local_port
|
170
|
+
client_port.should == local_port
|
171
171
|
|
172
172
|
client.close
|
173
173
|
end
|
@@ -186,11 +186,12 @@ describe Network::TCP do
|
|
186
186
|
end
|
187
187
|
|
188
188
|
it "should bind to a specific port and host" do
|
189
|
-
server
|
189
|
+
server = subject.tcp_server(server_port,server_host)
|
190
|
+
bound_host = server.addr[3]
|
191
|
+
bound_port = server.addr[1]
|
190
192
|
|
191
|
-
|
192
|
-
|
193
|
-
local_address.ip_port.should == server_port
|
193
|
+
bound_host.should == server_ip
|
194
|
+
bound_port.should == server_port
|
194
195
|
|
195
196
|
server.close
|
196
197
|
end
|
@@ -224,14 +225,16 @@ describe Network::TCP do
|
|
224
225
|
end
|
225
226
|
|
226
227
|
it "should bind to a specific port and host" do
|
227
|
-
|
228
|
+
bound_host = nil
|
229
|
+
bound_port = nil
|
228
230
|
|
229
231
|
subject.tcp_server_session(server_port,server_host) do |yielded_server|
|
230
|
-
|
232
|
+
bound_host = yielded_server.addr[3]
|
233
|
+
bound_port = yielded_server.addr[1]
|
231
234
|
end
|
232
235
|
|
233
|
-
|
234
|
-
|
236
|
+
bound_host.should == server_ip
|
237
|
+
bound_port.should == server_port
|
235
238
|
end
|
236
239
|
end
|
237
240
|
|
data/spec/network/udp_spec.rb
CHANGED
@@ -29,11 +29,11 @@ describe Network::UDP do
|
|
29
29
|
socket.close
|
30
30
|
end
|
31
31
|
|
32
|
-
it "should bind to a local
|
33
|
-
socket
|
32
|
+
it "should bind to a local port" do
|
33
|
+
socket = subject.udp_connect(host,port,nil,local_port)
|
34
|
+
bound_port = socket.addr[1]
|
34
35
|
|
35
|
-
|
36
|
-
local_address.ip_port.should == local_port
|
36
|
+
bound_port.should == local_port
|
37
37
|
|
38
38
|
socket.close
|
39
39
|
end
|
@@ -65,11 +65,11 @@ describe Network::UDP do
|
|
65
65
|
socket.close
|
66
66
|
end
|
67
67
|
|
68
|
-
it "should bind to a local
|
69
|
-
socket
|
68
|
+
it "should bind to a local port" do
|
69
|
+
socket = subject.udp_connect_and_send(data,host,port,nil,local_port)
|
70
|
+
bound_port = socket.addr[1]
|
70
71
|
|
71
|
-
|
72
|
-
local_address.ip_port.should == local_port
|
72
|
+
bound_port.should == local_port
|
73
73
|
|
74
74
|
socket.close
|
75
75
|
end
|
@@ -104,13 +104,13 @@ describe Network::UDP do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
it "should bind to a local host and port" do
|
107
|
-
|
107
|
+
bound_port = nil
|
108
108
|
|
109
109
|
subject.udp_session(host,port,nil,local_port) do |socket|
|
110
|
-
|
110
|
+
bound_port = socket.addr[1]
|
111
111
|
end
|
112
112
|
|
113
|
-
|
113
|
+
bound_port.should == local_port
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
@@ -148,10 +148,10 @@ describe Network::UDP do
|
|
148
148
|
describe "#udp_send" do
|
149
149
|
let(:server) do
|
150
150
|
socket = UDPSocket.new
|
151
|
-
socket.bind(server_host,
|
151
|
+
socket.bind(server_host,0)
|
152
152
|
socket
|
153
153
|
end
|
154
|
-
let(:server_port) { server.
|
154
|
+
let(:server_port) { server.addr[1] }
|
155
155
|
|
156
156
|
let(:data) { "hello\n" }
|
157
157
|
let(:local_port) { 1024 + rand(65535 - 1024) }
|
@@ -189,11 +189,12 @@ describe Network::UDP do
|
|
189
189
|
end
|
190
190
|
|
191
191
|
it "should bind to a specific port and host" do
|
192
|
-
server
|
192
|
+
server = subject.udp_server(server_port,server_host)
|
193
|
+
bound_host = server.addr[3]
|
194
|
+
bound_port = server.addr[1]
|
193
195
|
|
194
|
-
|
195
|
-
|
196
|
-
local_address.ip_port.should == server_port
|
196
|
+
bound_host.should == server_ip
|
197
|
+
bound_port.should == server_port
|
197
198
|
|
198
199
|
server.close
|
199
200
|
end
|
@@ -227,14 +228,16 @@ describe Network::UDP do
|
|
227
228
|
end
|
228
229
|
|
229
230
|
it "should bind to a specific port and host" do
|
230
|
-
|
231
|
+
bound_host = nil
|
232
|
+
bound_port = nil
|
231
233
|
|
232
234
|
subject.udp_server_session(server_port,server_host) do |yielded_server|
|
233
|
-
|
235
|
+
bound_host = yielded_server.addr[3]
|
236
|
+
bound_port = yielded_server.addr[1]
|
234
237
|
end
|
235
238
|
|
236
|
-
|
237
|
-
|
239
|
+
bound_host.should == server_ip
|
240
|
+
bound_port.should == server_port
|
238
241
|
end
|
239
242
|
end
|
240
243
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ronin-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02
|
12
|
+
date: 2012-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chars
|
16
|
-
requirement: &
|
16
|
+
requirement: &17665600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *17665600
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hexdump
|
27
|
-
requirement: &
|
27
|
+
requirement: &17664640 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0.1'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *17664640
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: combinatorics
|
38
|
-
requirement: &
|
38
|
+
requirement: &17663420 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0.4'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *17663420
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: uri-query_params
|
49
|
-
requirement: &
|
49
|
+
requirement: &17646180 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0.6'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *17646180
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: data_paths
|
60
|
-
requirement: &
|
60
|
+
requirement: &17645620 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0.3'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *17645620
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: parameters
|
71
|
-
requirement: &
|
71
|
+
requirement: &17645080 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0.4'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *17645080
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: bundler
|
82
|
-
requirement: &
|
82
|
+
requirement: &17644240 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,29 +87,29 @@ dependencies:
|
|
87
87
|
version: '1.0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *17644240
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: yard
|
93
|
-
requirement: &
|
93
|
+
requirement: &17643400 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: 0.7
|
98
|
+
version: '0.7'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *17643400
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: yard-parameters
|
104
|
-
requirement: &
|
104
|
+
requirement: &17642480 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.1
|
109
|
+
version: '0.1'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *17642480
|
113
113
|
description: Ronin Support is a support library for Ronin. Ronin Support contains
|
114
114
|
many of the convenience methods used by Ronin and additional libraries.
|
115
115
|
email: postmodern.mod3@gmail.com
|
@@ -173,6 +173,8 @@ files:
|
|
173
173
|
- lib/ronin/network/dns.rb
|
174
174
|
- lib/ronin/network/esmtp.rb
|
175
175
|
- lib/ronin/network/extensions.rb
|
176
|
+
- lib/ronin/network/extensions/dns.rb
|
177
|
+
- lib/ronin/network/extensions/dns/net.rb
|
176
178
|
- lib/ronin/network/extensions/esmtp.rb
|
177
179
|
- lib/ronin/network/extensions/esmtp/net.rb
|
178
180
|
- lib/ronin/network/extensions/http.rb
|
@@ -322,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
322
324
|
version: '0'
|
323
325
|
requirements: []
|
324
326
|
rubyforge_project:
|
325
|
-
rubygems_version: 1.8.
|
327
|
+
rubygems_version: 1.8.15
|
326
328
|
signing_key:
|
327
329
|
specification_version: 3
|
328
330
|
summary: A support library for Ronin.
|