ronin 0.0.9
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/COPYING.txt +339 -0
- data/History.txt +34 -0
- data/Manifest.txt +157 -0
- data/README.txt +131 -0
- data/Rakefile +23 -0
- data/TODO.txt +6 -0
- data/bin/ronin +12 -0
- data/lib/ronin.rb +35 -0
- data/lib/ronin/arch.rb +86 -0
- data/lib/ronin/author.rb +88 -0
- data/lib/ronin/cache.rb +27 -0
- data/lib/ronin/cache/config.rb +34 -0
- data/lib/ronin/cache/exceptions.rb +25 -0
- data/lib/ronin/cache/exceptions/extension_not_found.rb +29 -0
- data/lib/ronin/cache/exceptions/overlay_cached.rb +29 -0
- data/lib/ronin/cache/exceptions/overlay_not_found.rb +29 -0
- data/lib/ronin/cache/extension.rb +706 -0
- data/lib/ronin/cache/extension_cache.rb +108 -0
- data/lib/ronin/cache/overlay.rb +418 -0
- data/lib/ronin/cache/overlay_cache.rb +228 -0
- data/lib/ronin/cache/ronin.rb +50 -0
- data/lib/ronin/chars.rb +25 -0
- data/lib/ronin/chars/char_set.rb +121 -0
- data/lib/ronin/chars/chars.rb +180 -0
- data/lib/ronin/config.rb +31 -0
- data/lib/ronin/console.rb +127 -0
- data/lib/ronin/context.rb +233 -0
- data/lib/ronin/database.rb +122 -0
- data/lib/ronin/environment.rb +39 -0
- data/lib/ronin/exceptions/context_not_found.rb +27 -0
- data/lib/ronin/exceptions/invalid_database_config.rb +27 -0
- data/lib/ronin/exceptions/object_context_not_found.rb +27 -0
- data/lib/ronin/exceptions/unknown_context.rb +27 -0
- data/lib/ronin/exceptions/unknown_object_context.rb +27 -0
- data/lib/ronin/extensions.rb +28 -0
- data/lib/ronin/extensions/hash.rb +62 -0
- data/lib/ronin/extensions/kernel.rb +34 -0
- data/lib/ronin/extensions/meta.rb +24 -0
- data/lib/ronin/extensions/meta/object.rb +24 -0
- data/lib/ronin/extensions/string.rb +37 -0
- data/lib/ronin/extensions/uri.rb +24 -0
- data/lib/ronin/extensions/uri/http.rb +78 -0
- data/lib/ronin/extensions/uri/query_params.rb +97 -0
- data/lib/ronin/formatting.rb +29 -0
- data/lib/ronin/formatting/binary.rb +24 -0
- data/lib/ronin/formatting/digest.rb +24 -0
- data/lib/ronin/formatting/extensions.rb +26 -0
- data/lib/ronin/formatting/extensions/binary.rb +25 -0
- data/lib/ronin/formatting/extensions/binary/integer.rb +59 -0
- data/lib/ronin/formatting/extensions/binary/string.rb +73 -0
- data/lib/ronin/formatting/extensions/digest.rb +24 -0
- data/lib/ronin/formatting/extensions/digest/string.rb +65 -0
- data/lib/ronin/formatting/extensions/html.rb +24 -0
- data/lib/ronin/formatting/extensions/html/string.rb +75 -0
- data/lib/ronin/formatting/extensions/http.rb +24 -0
- data/lib/ronin/formatting/extensions/http/string.rb +69 -0
- data/lib/ronin/formatting/extensions/text.rb +24 -0
- data/lib/ronin/formatting/extensions/text/string.rb +96 -0
- data/lib/ronin/formatting/html.rb +24 -0
- data/lib/ronin/formatting/http.rb +24 -0
- data/lib/ronin/formatting/text.rb +24 -0
- data/lib/ronin/license.rb +87 -0
- data/lib/ronin/model.rb +44 -0
- data/lib/ronin/models.rb +34 -0
- data/lib/ronin/network.rb +31 -0
- data/lib/ronin/network/esmtp.rb +24 -0
- data/lib/ronin/network/extensions.rb +31 -0
- data/lib/ronin/network/extensions/esmtp.rb +24 -0
- data/lib/ronin/network/extensions/esmtp/net.rb +68 -0
- data/lib/ronin/network/extensions/http.rb +24 -0
- data/lib/ronin/network/extensions/http/net.rb +303 -0
- data/lib/ronin/network/extensions/imap.rb +24 -0
- data/lib/ronin/network/extensions/imap/net.rb +92 -0
- data/lib/ronin/network/extensions/pop3.rb +24 -0
- data/lib/ronin/network/extensions/pop3/net.rb +65 -0
- data/lib/ronin/network/extensions/smtp.rb +24 -0
- data/lib/ronin/network/extensions/smtp/net.rb +80 -0
- data/lib/ronin/network/extensions/tcp.rb +24 -0
- data/lib/ronin/network/extensions/tcp/net.rb +94 -0
- data/lib/ronin/network/extensions/telnet.rb +24 -0
- data/lib/ronin/network/extensions/telnet/net.rb +132 -0
- data/lib/ronin/network/extensions/udp.rb +24 -0
- data/lib/ronin/network/extensions/udp/net.rb +99 -0
- data/lib/ronin/network/http.rb +128 -0
- data/lib/ronin/network/http/exceptions.rb +24 -0
- data/lib/ronin/network/http/exceptions/unknown_request.rb +31 -0
- data/lib/ronin/network/imap.rb +47 -0
- data/lib/ronin/network/pop3.rb +47 -0
- data/lib/ronin/network/smtp.rb +26 -0
- data/lib/ronin/network/smtp/email.rb +126 -0
- data/lib/ronin/network/smtp/smtp.rb +55 -0
- data/lib/ronin/network/tcp.rb +24 -0
- data/lib/ronin/network/telnet.rb +95 -0
- data/lib/ronin/network/udp.rb +24 -0
- data/lib/ronin/object_context.rb +257 -0
- data/lib/ronin/objects.rb +29 -0
- data/lib/ronin/parameters.rb +27 -0
- data/lib/ronin/parameters/class_param.rb +45 -0
- data/lib/ronin/parameters/exceptions.rb +25 -0
- data/lib/ronin/parameters/exceptions/missing_param.rb +29 -0
- data/lib/ronin/parameters/exceptions/param_not_found.rb +29 -0
- data/lib/ronin/parameters/instance_param.rb +57 -0
- data/lib/ronin/parameters/param.rb +45 -0
- data/lib/ronin/parameters/parameters.rb +275 -0
- data/lib/ronin/path.rb +70 -0
- data/lib/ronin/pending_context.rb +42 -0
- data/lib/ronin/persistence.rb +32 -0
- data/lib/ronin/platform.rb +95 -0
- data/lib/ronin/product.rb +56 -0
- data/lib/ronin/ronin.rb +49 -0
- data/lib/ronin/rpc.rb +27 -0
- data/lib/ronin/rpc/call.rb +75 -0
- data/lib/ronin/rpc/client.rb +91 -0
- data/lib/ronin/rpc/console.rb +79 -0
- data/lib/ronin/rpc/exceptions.rb +25 -0
- data/lib/ronin/rpc/exceptions/not_implemented.rb +29 -0
- data/lib/ronin/rpc/exceptions/response_missing.rb +29 -0
- data/lib/ronin/rpc/interactive.rb +55 -0
- data/lib/ronin/rpc/interactive_console.rb +58 -0
- data/lib/ronin/rpc/interactive_shell.rb +59 -0
- data/lib/ronin/rpc/response.rb +57 -0
- data/lib/ronin/rpc/service.rb +69 -0
- data/lib/ronin/rpc/shell.rb +66 -0
- data/lib/ronin/runner.rb +24 -0
- data/lib/ronin/runner/program.rb +26 -0
- data/lib/ronin/runner/program/command.rb +204 -0
- data/lib/ronin/runner/program/commands.rb +33 -0
- data/lib/ronin/runner/program/commands/add.rb +73 -0
- data/lib/ronin/runner/program/commands/help.rb +52 -0
- data/lib/ronin/runner/program/commands/install.rb +65 -0
- data/lib/ronin/runner/program/commands/list.rb +81 -0
- data/lib/ronin/runner/program/commands/remove.rb +57 -0
- data/lib/ronin/runner/program/commands/uninstall.rb +57 -0
- data/lib/ronin/runner/program/commands/update.rb +55 -0
- data/lib/ronin/runner/program/exceptions.rb +24 -0
- data/lib/ronin/runner/program/exceptions/unknown_command.rb +31 -0
- data/lib/ronin/runner/program/options.rb +205 -0
- data/lib/ronin/runner/program/program.rb +173 -0
- data/lib/ronin/runner/program/runner.rb +35 -0
- data/lib/ronin/sessions.rb +32 -0
- data/lib/ronin/sessions/esmtp.rb +76 -0
- data/lib/ronin/sessions/imap.rb +73 -0
- data/lib/ronin/sessions/pop3.rb +70 -0
- data/lib/ronin/sessions/session.rb +52 -0
- data/lib/ronin/sessions/smtp.rb +76 -0
- data/lib/ronin/sessions/tcp.rb +111 -0
- data/lib/ronin/sessions/telnet.rb +76 -0
- data/lib/ronin/sessions/udp.rb +99 -0
- data/lib/ronin/sessions/web.rb +83 -0
- data/lib/ronin/shell.rb +81 -0
- data/lib/ronin/target.rb +40 -0
- data/lib/ronin/version.rb +27 -0
- data/lib/ronin/web.rb +24 -0
- data/lib/ronin/web/web.rb +265 -0
- data/spec/spec_helper.rb +9 -0
- data/tasks/spec.rb +7 -0
- metadata +324 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
|
4
|
+
# exploration tasks.
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
|
+
#
|
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
11
|
+
# (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
# GNU General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# You should have received a copy of the GNU General Public License
|
|
19
|
+
# along with this program; if not, write to the Free Software
|
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
21
|
+
#++
|
|
22
|
+
#
|
|
23
|
+
|
|
24
|
+
require 'ronin/network/telnet'
|
|
25
|
+
|
|
26
|
+
require 'net/telnet'
|
|
27
|
+
require 'net/telnets'
|
|
28
|
+
|
|
29
|
+
module Net
|
|
30
|
+
#
|
|
31
|
+
# Creates a new Telnet object with the specified _host_, given port
|
|
32
|
+
# and the given _options_. If a _block_ is given, it will be passed
|
|
33
|
+
# the newly created Telnet object.
|
|
34
|
+
#
|
|
35
|
+
# _options_ may contain the following keys:
|
|
36
|
+
# <tt>:port</tt>:: The port to connect to. Defaults to +DEFAULT_PORT+,
|
|
37
|
+
# if not given.
|
|
38
|
+
# <tt>:binmode</tt>:: Indicates that newline substitution shall not
|
|
39
|
+
# be performed.
|
|
40
|
+
# <tt>:output_log</tt>:: The name of the file to write connection
|
|
41
|
+
# status messages and all received traffic to.
|
|
42
|
+
# <tt>:dump_log</tt>:: Similar to the <tt>:output_log</tt> option,
|
|
43
|
+
# but connection output is also written in
|
|
44
|
+
# hexdump format.
|
|
45
|
+
# <tt>:prompt</tt>:: A regular expression matching the host's
|
|
46
|
+
# command-line prompt sequence, used to determine
|
|
47
|
+
# when a command has finished. Defaults to
|
|
48
|
+
# +DEFAULT_PROMPT+, if not given.
|
|
49
|
+
# <tt>:telnet</tt>:: Indicates that the connection shall behave as a
|
|
50
|
+
# telnet connection. Defaults to +true+.
|
|
51
|
+
# <tt>:plain</tt>:: Indicates that the connection shall behave as a
|
|
52
|
+
# normal TCP connection.
|
|
53
|
+
# <tt>:timeout</tt>:: The number of seconds to wait before timing out
|
|
54
|
+
# both the initial attempt to connect to host,
|
|
55
|
+
# and all attempts to read data from the host.
|
|
56
|
+
# Defaults to +DEFAULT_TIMEOUT+, if not given.
|
|
57
|
+
# <tt>:wait_time</tt>:: The amount of time to wait after seeing what
|
|
58
|
+
# looks like a prompt.
|
|
59
|
+
# <tt>:proxy</tt>:: A proxy object to used instead of opening a
|
|
60
|
+
# direct connection to the host. Must be either
|
|
61
|
+
# another telnet object or an IO object.
|
|
62
|
+
# Defaults to Telnet.proxy, if not given.
|
|
63
|
+
# <tt>:user</tt>:: The user to login with.
|
|
64
|
+
# <tt>:password</tt>:: The password to login with.
|
|
65
|
+
# <tt>:ssl</tt>:: A +Hash+ of SSL information to use for a SSLed
|
|
66
|
+
# Telnet session. This hash must contain the following
|
|
67
|
+
# keys.
|
|
68
|
+
# <tt>:certfile</tt>:: The SSL Certfile to use.
|
|
69
|
+
# <tt>:keyfile</tt>:: The SSL Key file to use.
|
|
70
|
+
# <tt>:cafile</tt>:: The SSL CAFile to use.
|
|
71
|
+
# <tt>:capath</tt>:: The SSL CAPath to use.
|
|
72
|
+
#
|
|
73
|
+
# Telnet.connect('towel.blinkenlights.nl') # => Telnet
|
|
74
|
+
#
|
|
75
|
+
def Net.telnet_connect(host,options={},&block)
|
|
76
|
+
sess_opts = {}
|
|
77
|
+
sess_opts['Host'] = host
|
|
78
|
+
sess_opts['Port'] = (options[:port] || Ronin::Network::Telnet.default_port)
|
|
79
|
+
sess_opts['Binmode'] = options[:binmode]
|
|
80
|
+
sess_opts['Output_log'] = options[:output_log]
|
|
81
|
+
sess_opts['Dump_log'] = options[:dump_log]
|
|
82
|
+
sess_opts['Prompt'] = (options[:prompt] || Ronin::Network::Telnet.default_prompt)
|
|
83
|
+
|
|
84
|
+
if (options[:telnet] && !options[:plain])
|
|
85
|
+
sess_opts['Telnetmode'] = true
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
sess_opts['Timeout'] = (options[:timeout] || Ronin::Network::Telnet.default_timeout)
|
|
89
|
+
sess_opts['Waittime'] = options[:wait_time]
|
|
90
|
+
sess_opts['Proxy'] = (options[:proxy] || Ronin::Network::Telnet.proxy)
|
|
91
|
+
|
|
92
|
+
user = options[:user]
|
|
93
|
+
passwd = options[:passwd]
|
|
94
|
+
|
|
95
|
+
if options[:ssl]
|
|
96
|
+
sess_opts['CertFile'] = options[:ssl][:certfile]
|
|
97
|
+
sess_opts['KeyFile'] = options[:ssl][:keyfile]
|
|
98
|
+
sess_opts['CAFile'] = options[:ssl][:cafile]
|
|
99
|
+
sess_opts['CAPath'] = options[:ssl][:capath]
|
|
100
|
+
sess_opts['VerifyMode'] = (options[:ssl][:verify] || SSL::VERIFY_PEER)
|
|
101
|
+
sess_opts['VerifyCallback'] = options[:ssl][:verify_callback]
|
|
102
|
+
sess_opts['VerifyDepth'] = options[:ssl][:verify_depth]
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
sess = Net::Telnet.new(sess_opts)
|
|
106
|
+
sess.login(user,passwd) if user
|
|
107
|
+
|
|
108
|
+
block.call(sess) if block
|
|
109
|
+
return sess
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
#
|
|
113
|
+
# Creates a new Telnet object with the specified _host, given port
|
|
114
|
+
# and the given _options_. See telnet for a complete listing the
|
|
115
|
+
# _options_. If a _block_ is given, it will be passed the newly
|
|
116
|
+
# created Telnet object. After the telnet connection has been
|
|
117
|
+
# established, and the given _block_ has completed, the connection
|
|
118
|
+
# is then closed.
|
|
119
|
+
#
|
|
120
|
+
# Net.telnet_session('towel.blinkenlights.nl') do |movie|
|
|
121
|
+
# movie.each_line { |line| puts line }
|
|
122
|
+
# end
|
|
123
|
+
#
|
|
124
|
+
def Net.telnet_session(host,options={},&block)
|
|
125
|
+
Net.telnet_connect(host,options) do |sess|
|
|
126
|
+
block.call(sess) if block
|
|
127
|
+
sess.close
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
return nil
|
|
131
|
+
end
|
|
132
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
|
4
|
+
# exploration tasks.
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
|
+
#
|
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
11
|
+
# (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
# GNU General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# You should have received a copy of the GNU General Public License
|
|
19
|
+
# along with this program; if not, write to the Free Software
|
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
21
|
+
#++
|
|
22
|
+
#
|
|
23
|
+
|
|
24
|
+
require 'ronin/network/extensions/udp/net'
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
|
4
|
+
# exploration tasks.
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
|
+
#
|
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
11
|
+
# (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
# GNU General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# You should have received a copy of the GNU General Public License
|
|
19
|
+
# along with this program; if not, write to the Free Software
|
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
21
|
+
#++
|
|
22
|
+
#
|
|
23
|
+
|
|
24
|
+
require 'socket'
|
|
25
|
+
|
|
26
|
+
module Net
|
|
27
|
+
#
|
|
28
|
+
# Creates a new UDPSocket object with the specified _rhost_, _rport_
|
|
29
|
+
# and the given _lhost_ and _lport_. If _block_ is given, it will be
|
|
30
|
+
# passed the newly created UDPSocket object.
|
|
31
|
+
#
|
|
32
|
+
# Net.udp_connect('www.hackety.org',80) # => UDPSocket
|
|
33
|
+
#
|
|
34
|
+
# Net.udp_connect('www.wired.com',80) do |sock|
|
|
35
|
+
# puts sock.readlines
|
|
36
|
+
# end
|
|
37
|
+
#
|
|
38
|
+
def Net.udp_connect(rhost,rport,lhost=nil,lport=nil,&block)
|
|
39
|
+
sock = UDPSocket.new(@rhost,@rport,@lhost,@lport)
|
|
40
|
+
block.call(sock) if block
|
|
41
|
+
|
|
42
|
+
return sock
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
#
|
|
46
|
+
# Creates a new UDPSocket object with the specified _rhost_
|
|
47
|
+
# _rport_, and the given _lhost_ and _lport_. The specified _block_
|
|
48
|
+
# will be passed the first line received from the UDPSocket object.
|
|
49
|
+
# The newly created UDPSocket object will be returned.
|
|
50
|
+
#
|
|
51
|
+
def Net.udp_connect_and_recv(rhost,rport,lhost=nil,lport=nil,&block)
|
|
52
|
+
Net.udp_connect(rhost,rport,lhost,lport) do |sock|
|
|
53
|
+
block.call(sock.read) if block
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
#
|
|
58
|
+
# Creates a new UDPSocket object with the specified _rhost_
|
|
59
|
+
# _rport_, and the given _lhost_ and _lport_. The specified _data_ will
|
|
60
|
+
# then be written to the newly created UDPSocket. If a _block_ is given
|
|
61
|
+
# it will be passed the UDPSocket object.
|
|
62
|
+
#
|
|
63
|
+
def Net.udp_connect_and_send(data,rhost,rport,lhost=nil,lport=nil,&block)
|
|
64
|
+
Net.udp_connect(rhost,rport,lhost,lport) do |sock|
|
|
65
|
+
sock.write(data)
|
|
66
|
+
|
|
67
|
+
block.call(sock) if block
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
#
|
|
72
|
+
# Creates a new UDPSocket object with the specified _rhost_, _rport_
|
|
73
|
+
# and the given _lhost_ and _lport_. If _block_ is given, it will be
|
|
74
|
+
# passed the newly created UDPSocket object. After the UDPSocket object
|
|
75
|
+
# has been passed to the given _block_ it will be closed.
|
|
76
|
+
#
|
|
77
|
+
def Net.udp_session(rhost,rport,lhost=nil,lport=nil,&block)
|
|
78
|
+
Net.udp_connect(rhost,rport,lhost,lport) do |sock|
|
|
79
|
+
block.call(sock) if block
|
|
80
|
+
sock.close
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
return nil
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
#
|
|
87
|
+
# Connects to the specified _rhost_ and _rport_ with the given _lhost_
|
|
88
|
+
# and _lport_, reads the banner then closes the connection, returning the
|
|
89
|
+
# received banner. If a _block_ is given it will be passed the banner.
|
|
90
|
+
#
|
|
91
|
+
def Net.udp_banner(rhost,rport,lhost=nil,lport=nil,&block)
|
|
92
|
+
Net.udp_session(rhost,rport,lhost,lport) do |sock|
|
|
93
|
+
banner = sock.readline
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
block.call(banner) if block
|
|
97
|
+
return banner
|
|
98
|
+
end
|
|
99
|
+
end
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
|
4
|
+
# exploration tasks.
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
|
+
#
|
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
11
|
+
# (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
# GNU General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# You should have received a copy of the GNU General Public License
|
|
19
|
+
# along with this program; if not, write to the Free Software
|
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
21
|
+
#++
|
|
22
|
+
#
|
|
23
|
+
|
|
24
|
+
require 'ronin/network/extensions/http'
|
|
25
|
+
require 'ronin/network/http/exceptions/unknown_request'
|
|
26
|
+
|
|
27
|
+
module Ronin
|
|
28
|
+
module Network
|
|
29
|
+
module HTTP
|
|
30
|
+
# Common HTTP proxy port
|
|
31
|
+
COMMON_PROXY_PORT = 8080
|
|
32
|
+
|
|
33
|
+
#
|
|
34
|
+
# Returns the default Ronin HTTP proxy port to use for HTTP proxies.
|
|
35
|
+
#
|
|
36
|
+
def HTTP.default_proxy_port
|
|
37
|
+
@@http_default_proxy_port ||= COMMON_PROXY_PORT
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
#
|
|
41
|
+
# Sets the default Ronin HTTP proxy port to the specified _port_.
|
|
42
|
+
#
|
|
43
|
+
def HTTP.default_proxy_port=(port)
|
|
44
|
+
@@http_default_proxy_port = port
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
#
|
|
48
|
+
# Returns the default Ronin HTTP proxy hash.
|
|
49
|
+
#
|
|
50
|
+
def HTTP.default_proxy
|
|
51
|
+
{:host => nil, :port => HTTP.default_proxy_port, :user => nil, :pass => nil}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
#
|
|
55
|
+
# Returns the Ronin HTTP proxy hash.
|
|
56
|
+
#
|
|
57
|
+
def HTTP.proxy
|
|
58
|
+
@@http_proxy ||= default_proxy
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
#
|
|
62
|
+
# Resets the Ronin HTTP proxy setting.
|
|
63
|
+
#
|
|
64
|
+
def HTTP.disable_proxy
|
|
65
|
+
@@http_proxy = default_proxy
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
#
|
|
69
|
+
# Returns the default Ronin HTTP User-Agent.
|
|
70
|
+
#
|
|
71
|
+
def HTTP.user_agent
|
|
72
|
+
@@http_user_agent ||= nil
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
#
|
|
76
|
+
# Sets the default Ronin HTTP User-Agent to the specified _agent_.
|
|
77
|
+
#
|
|
78
|
+
def HTTP.user_agent=(agent)
|
|
79
|
+
@@http_user_agent = agent
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
#
|
|
83
|
+
# Returns Ronin HTTP headers created from the given _options_.
|
|
84
|
+
#
|
|
85
|
+
def HTTP.headers(options={})
|
|
86
|
+
headers = {}
|
|
87
|
+
|
|
88
|
+
if HTTP.user_agent
|
|
89
|
+
headers['User-Agent'] = HTTP.user_agent
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
if options
|
|
93
|
+
options.each do |name,value|
|
|
94
|
+
header_name = name.to_s.split('_').map { |word|
|
|
95
|
+
word.capitalize
|
|
96
|
+
}.join('-')
|
|
97
|
+
|
|
98
|
+
headers[header_name] = value.to_s
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
return headers
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
#
|
|
106
|
+
# Creates an HTTP request object with the specified _type_ and
|
|
107
|
+
# given _options_. If type does not represent the name of an Net:HTTP
|
|
108
|
+
# Request Class an UnknownRequest exception will be raised.
|
|
109
|
+
#
|
|
110
|
+
def HTTP.request(type,options={})
|
|
111
|
+
name = type.to_s.capitalize
|
|
112
|
+
|
|
113
|
+
unless Net::HTTP.const_defined?(name)
|
|
114
|
+
raise(UnknownRequest,"unknown HTTP request type #{name.dump}",caller)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
headers = HTTP.headers(options[:headers])
|
|
118
|
+
request = Net::HTTP.const_get(name).new(options[:path].to_s,headers)
|
|
119
|
+
|
|
120
|
+
if options[:user]
|
|
121
|
+
request.basic_auth(options[:user].to_s,options[:password].to_s)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
return request
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
|
4
|
+
# exploration tasks.
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
|
+
#
|
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
11
|
+
# (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
# GNU General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# You should have received a copy of the GNU General Public License
|
|
19
|
+
# along with this program; if not, write to the Free Software
|
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
21
|
+
#++
|
|
22
|
+
#
|
|
23
|
+
|
|
24
|
+
require 'ronin/network/http/exceptions/unknown_request'
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
|
4
|
+
# exploration tasks.
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
|
+
#
|
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
11
|
+
# (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
# GNU General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# You should have received a copy of the GNU General Public License
|
|
19
|
+
# along with this program; if not, write to the Free Software
|
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
21
|
+
#++
|
|
22
|
+
#
|
|
23
|
+
|
|
24
|
+
module Ronin
|
|
25
|
+
module Network
|
|
26
|
+
module HTTP
|
|
27
|
+
class UnknownRequest < RuntimeError
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
# Ronin - A Ruby platform designed for information security and data
|
|
4
|
+
# exploration tasks.
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
|
+
#
|
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
11
|
+
# (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
# GNU General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# You should have received a copy of the GNU General Public License
|
|
19
|
+
# along with this program; if not, write to the Free Software
|
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
21
|
+
#++
|
|
22
|
+
#
|
|
23
|
+
|
|
24
|
+
require 'ronin/network/extensions/imap'
|
|
25
|
+
|
|
26
|
+
module Ronin
|
|
27
|
+
module Network
|
|
28
|
+
module IMAP
|
|
29
|
+
# Default imap port
|
|
30
|
+
DEFAULT_PORT = 143
|
|
31
|
+
|
|
32
|
+
#
|
|
33
|
+
# Returns the default Ronin IMAP port.
|
|
34
|
+
#
|
|
35
|
+
def IMAP.default_port
|
|
36
|
+
@@imap_default_port ||= DEFAULT_PORT
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
#
|
|
40
|
+
# Sets the default Ronin IMAP port to the specified _port_.
|
|
41
|
+
#
|
|
42
|
+
def IMAP.default_port=(port)
|
|
43
|
+
@@imap_default_port = port
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|