ronin-support 0.4.0.rc1 → 0.4.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +1 -0
- data/ChangeLog.md +10 -0
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/Rakefile +8 -0
- data/gemspec.yml +2 -1
- data/lib/ronin/extensions.rb +1 -1
- data/lib/ronin/extensions/enumerable.rb +1 -1
- data/lib/ronin/extensions/file.rb +1 -1
- data/lib/ronin/extensions/ip_addr.rb +1 -1
- data/lib/ronin/extensions/kernel.rb +1 -1
- data/lib/ronin/extensions/meta.rb +1 -1
- data/lib/ronin/extensions/regexp.rb +1 -1
- data/lib/ronin/extensions/resolv.rb +1 -1
- data/lib/ronin/extensions/string.rb +1 -1
- data/lib/ronin/formatting.rb +1 -1
- data/lib/ronin/formatting/binary.rb +1 -1
- data/lib/ronin/formatting/digest.rb +1 -1
- data/lib/ronin/formatting/extensions.rb +1 -1
- data/lib/ronin/formatting/extensions/binary.rb +1 -1
- data/lib/ronin/formatting/extensions/binary/file.rb +1 -1
- data/lib/ronin/formatting/extensions/binary/integer.rb +1 -1
- data/lib/ronin/formatting/extensions/binary/string.rb +1 -1
- data/lib/ronin/formatting/extensions/digest.rb +1 -1
- data/lib/ronin/formatting/extensions/digest/file.rb +1 -1
- data/lib/ronin/formatting/extensions/digest/string.rb +1 -1
- data/lib/ronin/formatting/extensions/html.rb +1 -1
- data/lib/ronin/formatting/extensions/html/integer.rb +1 -1
- data/lib/ronin/formatting/extensions/html/string.rb +1 -1
- data/lib/ronin/formatting/extensions/http.rb +1 -1
- data/lib/ronin/formatting/extensions/http/integer.rb +1 -1
- data/lib/ronin/formatting/extensions/http/string.rb +1 -1
- data/lib/ronin/formatting/extensions/sql.rb +1 -1
- data/lib/ronin/formatting/extensions/sql/string.rb +1 -1
- data/lib/ronin/formatting/extensions/text.rb +1 -1
- data/lib/ronin/formatting/extensions/text/array.rb +1 -1
- data/lib/ronin/formatting/extensions/text/string.rb +1 -1
- data/lib/ronin/formatting/html.rb +1 -1
- data/lib/ronin/formatting/http.rb +1 -1
- data/lib/ronin/formatting/sql.rb +1 -1
- data/lib/ronin/formatting/text.rb +1 -1
- data/lib/ronin/fuzzing.rb +1 -1
- data/lib/ronin/fuzzing/extensions.rb +1 -1
- data/lib/ronin/fuzzing/extensions/string.rb +1 -1
- data/lib/ronin/fuzzing/fuzzing.rb +1 -1
- data/lib/ronin/mixin.rb +1 -1
- data/lib/ronin/network.rb +1 -1
- data/lib/ronin/network/esmtp.rb +1 -1
- data/lib/ronin/network/extensions.rb +1 -1
- data/lib/ronin/network/extensions/esmtp.rb +1 -1
- data/lib/ronin/network/extensions/esmtp/net.rb +1 -1
- data/lib/ronin/network/extensions/http.rb +1 -1
- data/lib/ronin/network/extensions/http/net.rb +1 -1
- data/lib/ronin/network/extensions/http/uri/http.rb +1 -1
- data/lib/ronin/network/extensions/imap.rb +1 -1
- data/lib/ronin/network/extensions/imap/net.rb +1 -1
- data/lib/ronin/network/extensions/pop3.rb +1 -1
- data/lib/ronin/network/extensions/pop3/net.rb +1 -1
- data/lib/ronin/network/extensions/smtp.rb +1 -1
- data/lib/ronin/network/extensions/smtp/net.rb +1 -1
- data/lib/ronin/network/extensions/ssl.rb +1 -1
- data/lib/ronin/network/extensions/ssl/net.rb +1 -1
- data/lib/ronin/network/extensions/tcp.rb +1 -1
- data/lib/ronin/network/extensions/tcp/net.rb +1 -1
- data/lib/ronin/network/extensions/telnet.rb +1 -1
- data/lib/ronin/network/extensions/telnet/net.rb +1 -1
- data/lib/ronin/network/extensions/udp.rb +1 -1
- data/lib/ronin/network/extensions/udp/net.rb +1 -1
- data/lib/ronin/network/http.rb +1 -1
- data/lib/ronin/network/http/exceptions.rb +1 -1
- data/lib/ronin/network/http/exceptions/unknown_request.rb +1 -1
- data/lib/ronin/network/http/http.rb +103 -72
- data/lib/ronin/network/http/proxy.rb +1 -1
- data/lib/ronin/network/imap.rb +1 -1
- data/lib/ronin/network/mixins.rb +1 -1
- data/lib/ronin/network/mixins/esmtp.rb +1 -1
- data/lib/ronin/network/mixins/http.rb +3 -3
- data/lib/ronin/network/mixins/imap.rb +1 -1
- data/lib/ronin/network/mixins/mixin.rb +1 -1
- data/lib/ronin/network/mixins/pop3.rb +1 -1
- data/lib/ronin/network/mixins/smtp.rb +1 -1
- data/lib/ronin/network/mixins/ssl.rb +144 -0
- data/lib/ronin/network/mixins/tcp.rb +6 -5
- data/lib/ronin/network/mixins/telnet.rb +1 -1
- data/lib/ronin/network/mixins/udp.rb +29 -3
- data/lib/ronin/network/network.rb +1 -1
- data/lib/ronin/network/pop3.rb +1 -1
- data/lib/ronin/network/smtp.rb +1 -1
- data/lib/ronin/network/smtp/email.rb +1 -1
- data/lib/ronin/network/smtp/smtp.rb +1 -1
- data/lib/ronin/network/ssl.rb +3 -6
- data/lib/ronin/network/tcp.rb +27 -28
- data/lib/ronin/network/telnet.rb +1 -1
- data/lib/ronin/network/udp.rb +56 -19
- data/lib/ronin/path.rb +1 -1
- data/lib/ronin/spec/ui/output.rb +1 -1
- data/lib/ronin/support.rb +1 -1
- data/lib/ronin/support/inflector.rb +1 -1
- data/lib/ronin/support/support.rb +1 -1
- data/lib/ronin/support/version.rb +2 -2
- data/lib/ronin/templates.rb +1 -1
- data/lib/ronin/templates/erb.rb +1 -1
- data/lib/ronin/templates/template.rb +1 -1
- data/lib/ronin/ui/output.rb +1 -1
- data/lib/ronin/ui/output/helpers.rb +1 -1
- data/lib/ronin/ui/output/output.rb +1 -1
- data/lib/ronin/ui/output/terminal.rb +1 -1
- data/lib/ronin/ui/output/terminal/color.rb +1 -1
- data/lib/ronin/ui/output/terminal/raw.rb +1 -1
- data/lib/ronin/ui/shell.rb +67 -7
- data/lib/ronin/wordlist.rb +51 -1
- data/spec/extensions/ip_addr_spec.rb +1 -1
- data/spec/network/http/http_spec.rb +193 -0
- data/spec/network/tcp_spec.rb +244 -0
- data/spec/network/udp_spec.rb +245 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/ui/shell_spec.rb +7 -3
- data/spec/wordlist_spec.rb +25 -0
- metadata +35 -19
data/lib/ronin/network/imap.rb
CHANGED
data/lib/ronin/network/mixins.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
4
|
# This file is part of Ronin Support.
|
5
5
|
#
|
@@ -122,9 +122,9 @@ module Ronin
|
|
122
122
|
print_info "Starting HTTP Session with #{host_port}"
|
123
123
|
|
124
124
|
if block.arity == 2
|
125
|
-
block.call(
|
125
|
+
block.call(http,expanded_options)
|
126
126
|
else
|
127
|
-
block.call(
|
127
|
+
block.call(http)
|
128
128
|
end
|
129
129
|
|
130
130
|
print_info "Closing HTTP Session with #{host_port}"
|
@@ -0,0 +1,144 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
#
|
4
|
+
# This file is part of Ronin Support.
|
5
|
+
#
|
6
|
+
# Ronin Support is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU Lesser General Public License as published
|
8
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# Ronin Support is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Lesser General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License
|
17
|
+
# along with Ronin Support. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'ronin/network/mixins/mixin'
|
21
|
+
require 'ronin/network/ssl'
|
22
|
+
|
23
|
+
module Ronin
|
24
|
+
module Network
|
25
|
+
module Mixins
|
26
|
+
#
|
27
|
+
# Adds SSL convenience methods and connection parameters to a class.
|
28
|
+
#
|
29
|
+
# Defines the following parameters:
|
30
|
+
#
|
31
|
+
# * `host` (`String`) - SSL host.
|
32
|
+
# * `port` (`Integer`) - SSL port.
|
33
|
+
# * `local_host` (`String`) - SSL local host.
|
34
|
+
# * `local_port` (`Integer`) - SSL local port.
|
35
|
+
#
|
36
|
+
# @since 0.4.0
|
37
|
+
#
|
38
|
+
module SSL
|
39
|
+
include Mixin, Network::SSL
|
40
|
+
|
41
|
+
# SSL host
|
42
|
+
parameter :host, :type => String,
|
43
|
+
:description => 'SSL host'
|
44
|
+
|
45
|
+
# SSL port
|
46
|
+
parameter :port, :type => Integer,
|
47
|
+
:description => 'SSL port'
|
48
|
+
|
49
|
+
# SSL local host
|
50
|
+
parameter :local_host, :type => String,
|
51
|
+
:description => 'SSL local host'
|
52
|
+
|
53
|
+
# SSL local port
|
54
|
+
parameter :local_port, :type => Integer,
|
55
|
+
:description => 'SSL local port'
|
56
|
+
|
57
|
+
protected
|
58
|
+
|
59
|
+
#
|
60
|
+
# Establishes a SSL connection.
|
61
|
+
#
|
62
|
+
# @option options [Symbol] :verify
|
63
|
+
# Specifies whether to verify the SSL certificate.
|
64
|
+
# May be one of the following:
|
65
|
+
#
|
66
|
+
# * `:none`
|
67
|
+
# * `:peer`
|
68
|
+
# * `:client_once`
|
69
|
+
# * `:fail_if_no_peer_cert`
|
70
|
+
#
|
71
|
+
# @option options [String] :cert
|
72
|
+
# The path to the SSL certificate.
|
73
|
+
#
|
74
|
+
# @option options [String] :key
|
75
|
+
# The path to the SSL key.
|
76
|
+
#
|
77
|
+
# @yield [ssl_socket]
|
78
|
+
# The given block will be passed the new SSL Socket.
|
79
|
+
#
|
80
|
+
# @yieldparam [OpenSSL::SSL::SSLSocket] ssl_socket
|
81
|
+
# The new SSL Socket.
|
82
|
+
#
|
83
|
+
# @return [OpenSSL::SSL::SSLSocket]
|
84
|
+
# the new SSL Socket.
|
85
|
+
#
|
86
|
+
# @example
|
87
|
+
# socket = ssl_connect
|
88
|
+
#
|
89
|
+
# @api public
|
90
|
+
#
|
91
|
+
def ssl_connect(host,port,options={},&block)
|
92
|
+
options = options.merge(
|
93
|
+
:local_host => self.local_host,
|
94
|
+
:local_port => self.local_port
|
95
|
+
)
|
96
|
+
|
97
|
+
super(self.host,self.port,options,&block)
|
98
|
+
end
|
99
|
+
|
100
|
+
#
|
101
|
+
# Creates a new temporary SSL connection.
|
102
|
+
#
|
103
|
+
# @param [Hash] options
|
104
|
+
# Additional options.
|
105
|
+
#
|
106
|
+
# @option options [String] :local_host
|
107
|
+
# The local host to bind to.
|
108
|
+
#
|
109
|
+
# @option options [Integer] :local_port
|
110
|
+
# The local port to bind to.
|
111
|
+
#
|
112
|
+
# @option options [Symbol] :verify
|
113
|
+
# Specifies whether to verify the SSL certificate.
|
114
|
+
#
|
115
|
+
# @option options [String] :cert
|
116
|
+
# The path to the SSL certificate.
|
117
|
+
#
|
118
|
+
# @option options [String] :key
|
119
|
+
# The path to the SSL key.
|
120
|
+
#
|
121
|
+
# @yield [ssl_socket]
|
122
|
+
# The given block will be passed the temporary SSL Socket.
|
123
|
+
#
|
124
|
+
# @yieldparam [OpenSSL::SSL::SSLSocket] ssl_socket
|
125
|
+
# The temporary SSL Socket.
|
126
|
+
#
|
127
|
+
# @return [nil]
|
128
|
+
#
|
129
|
+
# @example
|
130
|
+
# ssl_session do |socket|
|
131
|
+
# socket.write("GET /\n\n")
|
132
|
+
#
|
133
|
+
# socket.each_line { |line| puts line }
|
134
|
+
# end
|
135
|
+
#
|
136
|
+
# @api public
|
137
|
+
#
|
138
|
+
def ssl_session(options={},&block)
|
139
|
+
super(self.host,self.port,options,&block)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
4
|
# This file is part of Ronin Support.
|
5
5
|
#
|
@@ -83,10 +83,11 @@ module Ronin
|
|
83
83
|
# tcp_connect # => TCPSocket
|
84
84
|
#
|
85
85
|
# @example
|
86
|
-
# tcp_connect do |
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
86
|
+
# tcp_connect do |socket|
|
87
|
+
# socket.write("GET /\n\n")
|
88
|
+
#
|
89
|
+
# puts socket.readlines
|
90
|
+
# socket.close
|
90
91
|
# end
|
91
92
|
#
|
92
93
|
# @api public
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
4
|
# This file is part of Ronin Support.
|
5
5
|
#
|
@@ -84,8 +84,8 @@ module Ronin
|
|
84
84
|
# # => UDPSocket
|
85
85
|
#
|
86
86
|
# @example
|
87
|
-
# udp_connect do |
|
88
|
-
# puts
|
87
|
+
# udp_connect do |socket|
|
88
|
+
# puts socket.readlines
|
89
89
|
# end
|
90
90
|
#
|
91
91
|
# @api public
|
@@ -149,6 +149,32 @@ module Ronin
|
|
149
149
|
return nil
|
150
150
|
end
|
151
151
|
|
152
|
+
#
|
153
|
+
# Connects to the host and port specified by the `host` and `port`
|
154
|
+
# parameters, sends the given data and then disconnects.
|
155
|
+
#
|
156
|
+
# @return [true]
|
157
|
+
# The data was successfully sent.
|
158
|
+
#
|
159
|
+
# @example
|
160
|
+
# buffer = "GET /" + ('A' * 4096) + "\n\r"
|
161
|
+
# Net.udp_send(buffer)
|
162
|
+
# # => true
|
163
|
+
#
|
164
|
+
# @api public
|
165
|
+
#
|
166
|
+
# @since 0.4.0
|
167
|
+
#
|
168
|
+
def udp_send(data)
|
169
|
+
print_info "Connecting to #{host_port} ..."
|
170
|
+
print_debug "Sending data: #{data.inspect}"
|
171
|
+
|
172
|
+
super(data,self.host,self.port,self.local_host,self.local_port)
|
173
|
+
|
174
|
+
print_info "Disconnected from #{host_port}"
|
175
|
+
return true
|
176
|
+
end
|
177
|
+
|
152
178
|
#
|
153
179
|
# Creates a new UDPServer object listening on `server_host` and
|
154
180
|
# `server_port` parameters.
|
data/lib/ronin/network/pop3.rb
CHANGED
data/lib/ronin/network/smtp.rb
CHANGED
data/lib/ronin/network/ssl.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
4
|
# This file is part of Ronin Support.
|
5
5
|
#
|
@@ -173,11 +173,8 @@ module Ronin
|
|
173
173
|
#
|
174
174
|
# @api public
|
175
175
|
#
|
176
|
-
def ssl_session(host,port)
|
177
|
-
ssl_socket = ssl_connect(host,port)
|
178
|
-
|
179
|
-
yield ssl_socket if block_given?
|
180
|
-
|
176
|
+
def ssl_session(host,port,options={},&block)
|
177
|
+
ssl_socket = ssl_connect(host,port,options,&block)
|
181
178
|
ssl_socket.close
|
182
179
|
return nil
|
183
180
|
end
|
data/lib/ronin/network/tcp.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
4
|
# This file is part of Ronin Support.
|
5
5
|
#
|
@@ -34,7 +34,7 @@ module Ronin
|
|
34
34
|
# @param [Integer] port
|
35
35
|
# The port to connect to.
|
36
36
|
#
|
37
|
-
# @param [String] local_host (
|
37
|
+
# @param [String] local_host ('0.0.0.0')
|
38
38
|
# The local host to bind to.
|
39
39
|
#
|
40
40
|
# @param [Integer] local_port (nil)
|
@@ -53,24 +53,23 @@ module Ronin
|
|
53
53
|
# tcp_connect('www.hackety.org',80) # => TCPSocket
|
54
54
|
#
|
55
55
|
# @example
|
56
|
-
# tcp_connect('www.wired.com',80) do |
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
56
|
+
# tcp_connect('www.wired.com',80) do |socket|
|
57
|
+
# socket.write("GET /\n\n")
|
58
|
+
#
|
59
|
+
# puts socket.readlines
|
60
|
+
# socket.close
|
60
61
|
# end
|
61
62
|
#
|
62
63
|
# @api public
|
63
64
|
#
|
64
65
|
def tcp_connect(host,port,local_host=nil,local_port=nil)
|
65
|
-
host
|
66
|
-
local_host =
|
67
|
-
local_host.to_s
|
68
|
-
end
|
66
|
+
host = host.to_s
|
67
|
+
local_host = (local_host || '0.0.0.0').to_s
|
69
68
|
|
70
|
-
|
69
|
+
socket = TCPSocket.new(host,port,local_host,local_port)
|
71
70
|
|
72
|
-
yield
|
73
|
-
return
|
71
|
+
yield socket if block_given?
|
72
|
+
return socket
|
74
73
|
end
|
75
74
|
|
76
75
|
#
|
@@ -101,11 +100,11 @@ module Ronin
|
|
101
100
|
# @api public
|
102
101
|
#
|
103
102
|
def tcp_connect_and_send(data,host,port,local_host=nil,local_port=nil)
|
104
|
-
|
105
|
-
|
103
|
+
socket = tcp_connect(host,port,local_host,local_port)
|
104
|
+
socket.write(data)
|
106
105
|
|
107
|
-
yield
|
108
|
-
return
|
106
|
+
yield socket if block_given?
|
107
|
+
return socket
|
109
108
|
end
|
110
109
|
|
111
110
|
#
|
@@ -136,11 +135,11 @@ module Ronin
|
|
136
135
|
# @api public
|
137
136
|
#
|
138
137
|
def tcp_session(host,port,local_host=nil,local_port=nil)
|
139
|
-
|
138
|
+
socket = tcp_connect(host,port,local_host,local_port)
|
140
139
|
|
141
|
-
yield
|
140
|
+
yield socket if block_given?
|
142
141
|
|
143
|
-
|
142
|
+
socket.close
|
144
143
|
return nil
|
145
144
|
end
|
146
145
|
|
@@ -177,8 +176,8 @@ module Ronin
|
|
177
176
|
def tcp_banner(host,port,local_host=nil,local_port=nil)
|
178
177
|
banner = nil
|
179
178
|
|
180
|
-
tcp_session(host,port,local_host,local_port) do |
|
181
|
-
banner =
|
179
|
+
tcp_session(host,port,local_host,local_port) do |socket|
|
180
|
+
banner = socket.readline.strip
|
182
181
|
end
|
183
182
|
|
184
183
|
yield banner if block_given?
|
@@ -215,8 +214,8 @@ module Ronin
|
|
215
214
|
# @api public
|
216
215
|
#
|
217
216
|
def tcp_send(data,host,port,local_host=nil,local_port=nil)
|
218
|
-
tcp_session(host,port,local_host,local_port) do |
|
219
|
-
|
217
|
+
tcp_session(host,port,local_host,local_port) do |socket|
|
218
|
+
socket.write(data)
|
220
219
|
end
|
221
220
|
|
222
221
|
return true
|
@@ -239,8 +238,8 @@ module Ronin
|
|
239
238
|
#
|
240
239
|
# @api public
|
241
240
|
#
|
242
|
-
def tcp_server(port,host=
|
243
|
-
host = host.to_s
|
241
|
+
def tcp_server(port=nil,host=nil)
|
242
|
+
host = (host || '0.0.0.0').to_s
|
244
243
|
|
245
244
|
server = TCPServer.new(host,port)
|
246
245
|
server.listen(3)
|
@@ -280,7 +279,7 @@ module Ronin
|
|
280
279
|
#
|
281
280
|
# @api public
|
282
281
|
#
|
283
|
-
def tcp_server_session(port,host=
|
282
|
+
def tcp_server_session(port=nil,host=nil,&block)
|
284
283
|
server = tcp_server(port,host,&block)
|
285
284
|
server.close()
|
286
285
|
return nil
|
@@ -306,7 +305,7 @@ module Ronin
|
|
306
305
|
#
|
307
306
|
# @api public
|
308
307
|
#
|
309
|
-
def tcp_single_server(port,host=
|
308
|
+
def tcp_single_server(port=nil,host=nil)
|
310
309
|
host = host.to_s
|
311
310
|
|
312
311
|
server = TCPServer.new(host,port)
|