ronin 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +95 -0
- data/Manifest.txt +55 -25
- data/README.txt +64 -52
- data/Rakefile +21 -14
- data/bin/ronin +1 -1
- data/bin/ronin-add +1 -1
- data/bin/ronin-console +1 -1
- data/bin/ronin-help +1 -1
- data/bin/ronin-install +1 -1
- data/bin/ronin-list +1 -1
- data/bin/ronin-remove +1 -1
- data/bin/ronin-uninstall +1 -1
- data/bin/ronin-update +1 -1
- data/lib/ronin.rb +2 -4
- data/lib/ronin/arch.rb +66 -21
- data/lib/ronin/author.rb +27 -18
- data/lib/ronin/cacheable.rb +63 -23
- data/lib/ronin/code/emittable.rb +1 -4
- data/lib/ronin/code/reference.rb +2 -5
- data/lib/ronin/code/symbol_table.rb +1 -4
- data/lib/ronin/code/token.rb +1 -4
- data/lib/ronin/config.rb +31 -10
- data/lib/ronin/database.rb +1 -4
- data/lib/ronin/database/database.rb +42 -23
- data/lib/ronin/database/exceptions.rb +1 -4
- data/lib/ronin/database/exceptions/invalid_config.rb +1 -4
- data/lib/ronin/environment.rb +1 -5
- data/lib/ronin/extensions.rb +1 -5
- data/lib/ronin/extensions/array.rb +8 -6
- data/lib/ronin/extensions/file.rb +9 -4
- data/lib/ronin/extensions/ip_addr.rb +33 -13
- data/lib/ronin/extensions/kernel.rb +44 -9
- data/lib/ronin/extensions/meta.rb +1 -4
- data/lib/ronin/extensions/string.rb +8 -7
- data/lib/ronin/extensions/uri.rb +1 -4
- data/lib/ronin/extensions/uri/http.rb +1 -48
- data/lib/ronin/extensions/uri/query_params.rb +27 -8
- data/lib/ronin/formatting.rb +1 -4
- data/lib/ronin/formatting/binary.rb +1 -4
- data/lib/ronin/formatting/digest.rb +1 -4
- data/lib/ronin/formatting/extensions.rb +1 -4
- data/lib/ronin/formatting/extensions/binary.rb +1 -4
- data/lib/ronin/formatting/extensions/binary/file.rb +3 -28
- data/lib/ronin/formatting/extensions/binary/integer.rb +31 -12
- data/lib/ronin/formatting/extensions/binary/string.rb +59 -36
- data/lib/ronin/formatting/extensions/digest.rb +1 -4
- data/lib/ronin/formatting/extensions/digest/string.rb +31 -9
- data/lib/ronin/formatting/extensions/http.rb +1 -4
- data/lib/ronin/formatting/extensions/http/string.rb +16 -9
- data/lib/ronin/formatting/extensions/text.rb +1 -4
- data/lib/ronin/formatting/extensions/text/array.rb +17 -7
- data/lib/ronin/formatting/extensions/text/string.rb +70 -27
- data/lib/ronin/formatting/http.rb +1 -4
- data/lib/ronin/formatting/text.rb +1 -4
- data/lib/ronin/license.rb +72 -65
- data/lib/ronin/model.rb +1 -4
- data/lib/ronin/model/has_description.rb +37 -8
- data/lib/ronin/model/has_license.rb +12 -8
- data/lib/ronin/model/has_name.rb +10 -7
- data/lib/ronin/model/has_version.rb +14 -4
- data/lib/ronin/model/model.rb +71 -14
- data/lib/ronin/network.rb +1 -4
- data/lib/ronin/network/esmtp.rb +1 -4
- data/lib/ronin/network/extensions.rb +1 -4
- data/lib/ronin/network/extensions/esmtp.rb +1 -4
- data/lib/ronin/network/extensions/esmtp/net.rb +49 -21
- data/lib/ronin/network/extensions/http.rb +1 -4
- data/lib/ronin/network/extensions/http/net.rb +319 -531
- data/lib/ronin/network/extensions/imap.rb +1 -4
- data/lib/ronin/network/extensions/imap/net.rb +50 -23
- data/lib/ronin/network/extensions/pop3.rb +1 -4
- data/lib/ronin/network/extensions/pop3/net.rb +40 -17
- data/lib/ronin/network/extensions/smtp.rb +1 -4
- data/lib/ronin/network/extensions/smtp/net.rb +49 -21
- data/lib/ronin/network/extensions/tcp.rb +1 -4
- data/lib/ronin/network/extensions/tcp/net.rb +234 -31
- data/lib/ronin/network/extensions/telnet.rb +1 -4
- data/lib/ronin/network/extensions/telnet/net.rb +83 -51
- data/lib/ronin/network/extensions/udp.rb +1 -4
- data/lib/ronin/network/extensions/udp/net.rb +164 -27
- data/lib/ronin/{sessions.rb → network/helpers.rb} +10 -13
- data/lib/ronin/network/helpers/esmtp.rb +129 -0
- data/lib/ronin/{sessions/session.rb → network/helpers/helper.rb} +25 -17
- data/lib/ronin/network/helpers/http.rb +444 -0
- data/lib/ronin/network/helpers/imap.rb +115 -0
- data/lib/ronin/network/helpers/pop3.rb +110 -0
- data/lib/ronin/network/helpers/smtp.rb +123 -0
- data/lib/ronin/network/helpers/tcp.rb +309 -0
- data/lib/ronin/network/helpers/telnet.rb +158 -0
- data/lib/ronin/network/helpers/udp.rb +197 -0
- data/lib/ronin/network/http.rb +3 -156
- data/lib/ronin/network/http/exceptions.rb +1 -4
- data/lib/ronin/network/http/exceptions/unknown_request.rb +1 -4
- data/lib/ronin/network/http/http.rb +214 -0
- data/lib/ronin/network/http/proxy.rb +308 -0
- data/lib/ronin/network/imap.rb +7 -6
- data/lib/ronin/network/pop3.rb +7 -6
- data/lib/ronin/network/smtp.rb +1 -4
- data/lib/ronin/network/smtp/email.rb +34 -18
- data/lib/ronin/network/smtp/smtp.rb +19 -7
- data/lib/ronin/network/tcp.rb +1 -4
- data/lib/ronin/network/telnet.rb +25 -12
- data/lib/ronin/network/udp.rb +1 -4
- data/lib/ronin/os.rb +43 -21
- data/lib/ronin/path.rb +29 -9
- data/lib/ronin/platform.rb +1 -4
- data/lib/ronin/platform/exceptions.rb +1 -4
- data/lib/ronin/platform/exceptions/extension_not_found.rb +1 -4
- data/lib/ronin/platform/exceptions/overlay_cached.rb +1 -4
- data/lib/ronin/platform/exceptions/overlay_not_found.rb +1 -4
- data/lib/ronin/platform/extension.rb +195 -52
- data/lib/ronin/platform/extension_cache.rb +60 -24
- data/lib/ronin/platform/maintainer.rb +15 -8
- data/lib/ronin/platform/object_cache.rb +29 -8
- data/lib/ronin/platform/overlay.rb +82 -26
- data/lib/ronin/platform/overlay_cache.rb +179 -56
- data/lib/ronin/platform/platform.rb +154 -58
- data/lib/ronin/platform/ronin.rb +38 -11
- data/lib/ronin/product.rb +17 -17
- data/lib/ronin/rpc.rb +1 -4
- data/lib/ronin/rpc/call.rb +1 -4
- data/lib/ronin/rpc/client.rb +1 -4
- data/lib/ronin/rpc/console.rb +1 -4
- data/lib/ronin/rpc/exceptions.rb +1 -4
- data/lib/ronin/rpc/exceptions/not_implemented.rb +1 -4
- data/lib/ronin/rpc/exceptions/response_missing.rb +1 -4
- data/lib/ronin/rpc/response.rb +1 -4
- data/lib/ronin/rpc/service.rb +1 -4
- data/lib/ronin/rpc/shell.rb +1 -4
- data/lib/ronin/scanners.rb +1 -4
- data/lib/ronin/scanners/exceptions.rb +1 -4
- data/lib/ronin/scanners/exceptions/unknown_category.rb +1 -4
- data/lib/ronin/scanners/scanner.rb +82 -26
- data/lib/ronin/static.rb +1 -4
- data/lib/ronin/static/finders.rb +1 -4
- data/lib/ronin/static/static.rb +16 -7
- data/lib/ronin/templates.rb +2 -4
- data/lib/ronin/templates/erb.rb +24 -10
- data/lib/ronin/templates/template.rb +130 -0
- data/lib/ronin/ui.rb +2 -6
- data/lib/ronin/ui/command_line.rb +1 -4
- data/lib/ronin/ui/command_line/command.rb +137 -68
- data/lib/ronin/ui/command_line/command_line.rb +52 -29
- data/lib/ronin/ui/command_line/commands/add.rb +39 -67
- data/lib/ronin/ui/command_line/commands/console.rb +23 -27
- data/lib/ronin/ui/command_line/commands/help.rb +10 -29
- data/lib/ronin/ui/command_line/commands/install.rb +31 -56
- data/lib/ronin/ui/command_line/commands/list.rb +34 -52
- data/lib/ronin/ui/command_line/commands/remove.rb +12 -32
- data/lib/ronin/ui/command_line/commands/uninstall.rb +11 -31
- data/lib/ronin/ui/command_line/commands/update.rb +15 -35
- data/lib/ronin/ui/command_line/exceptions.rb +1 -4
- data/lib/ronin/ui/command_line/exceptions/unknown_command.rb +1 -4
- data/lib/ronin/ui/console.rb +54 -23
- data/lib/ronin/ui/hexdump.rb +1 -4
- data/lib/ronin/ui/hexdump/extensions.rb +1 -4
- data/lib/ronin/ui/hexdump/extensions/file.rb +8 -6
- data/lib/ronin/ui/hexdump/extensions/kernel.rb +4 -5
- data/lib/ronin/ui/hexdump/hexdump.rb +8 -5
- data/lib/ronin/{sessions/exceptions.rb → ui/output.rb} +3 -5
- data/lib/ronin/ui/output/handler.rb +121 -0
- data/lib/ronin/ui/output/helpers.rb +110 -0
- data/lib/ronin/ui/output/output.rb +144 -0
- data/lib/ronin/ui/shell.rb +38 -12
- data/lib/ronin/version.rb +2 -5
- data/lib/ronin/{sessions/exceptions/variable_missing.rb → yard.rb} +2 -10
- data/lib/ronin/{ronin.rb → yard/handlers.rb} +5 -15
- data/lib/ronin/yard/handlers/ruby.rb +27 -0
- data/lib/ronin/yard/handlers/ruby/base.rb +27 -0
- data/lib/ronin/yard/handlers/ruby/belongs_to_handler.rb +45 -0
- data/lib/ronin/yard/handlers/ruby/eval_block_handler.rb +18 -0
- data/lib/ronin/yard/handlers/ruby/has_handler.rb +49 -0
- data/lib/ronin/yard/handlers/ruby/legacy.rb +26 -0
- data/lib/ronin/yard/handlers/ruby/legacy/belongs_to_handler.rb +41 -0
- data/lib/ronin/yard/handlers/ruby/legacy/eval_block_handler.rb +19 -0
- data/lib/ronin/yard/handlers/ruby/legacy/has_handler.rb +34 -0
- data/lib/ronin/yard/handlers/ruby/legacy/metaclass_eval_handler.rb +21 -0
- data/lib/ronin/yard/handlers/ruby/legacy/property_handler.rb +41 -0
- data/lib/ronin/yard/handlers/ruby/legacy/scanner_handler.rb +61 -0
- data/lib/ronin/yard/handlers/ruby/metaclass_eval_handler.rb +18 -0
- data/lib/ronin/yard/handlers/ruby/property_handler.rb +45 -0
- data/lib/ronin/yard/handlers/ruby/scanner_handler.rb +66 -0
- data/spec/author_spec.rb +3 -3
- data/spec/extensions/classes/some_class.rb +2 -0
- data/spec/extensions/kernel_spec.rb +17 -0
- data/spec/extensions/uri/http_spec.rb +0 -31
- data/spec/formatting/binary/integer_spec.rb +4 -0
- data/spec/formatting/text/string_spec.rb +96 -0
- data/spec/license_spec.rb +6 -6
- data/spec/model/classes/basic_model.rb +13 -0
- data/spec/model/classes/custom_model.rb +17 -0
- data/spec/model/classes/described_model.rb +10 -0
- data/spec/model/has_description_spec.rb +42 -0
- data/spec/model/has_license_spec.rb +18 -4
- data/spec/model/model_spec.rb +68 -0
- data/spec/network/helpers/classes/test_helper.rb +11 -0
- data/spec/network/helpers/classes/uses_test_helper.rb +10 -0
- data/spec/network/helpers/helper_spec.rb +25 -0
- data/spec/network/{http_spec.rb → http/http_spec.rb} +0 -0
- data/spec/network/http/proxy_spec.rb +116 -0
- data/spec/os_spec.rb +4 -4
- data/spec/platform/extension_cache_spec.rb +14 -0
- data/spec/platform/extension_spec.rb +11 -0
- data/spec/platform/platform_spec.rb +8 -0
- data/spec/product_spec.rb +9 -9
- data/spec/spec_helper.rb +1 -1
- data/spec/templates/classes/{uses_erb.rb → example_erb.rb} +1 -1
- data/spec/templates/classes/example_template.rb +21 -0
- data/spec/templates/erb_spec.rb +2 -2
- data/spec/templates/helpers/static.rb +5 -0
- data/spec/templates/helpers/static/templates/_relative.erb +1 -0
- data/spec/templates/helpers/static/templates/example.erb +1 -0
- data/spec/templates/template_spec.rb +41 -0
- data/spec/ui/command_line/classes/test_command.rb +23 -0
- data/spec/ui/command_line/command_spec.rb +31 -0
- data/spec/ui/output_spec.rb +29 -0
- data/static/ronin/platform/overlay.xsl +135 -114
- data/tasks/spec.rb +1 -0
- data/tasks/yard.rb +18 -0
- metadata +98 -59
- metadata.gz.sig +0 -0
- data/TODO.txt +0 -15
- data/lib/ronin/extensions/hash.rb +0 -62
- data/lib/ronin/sessions/esmtp.rb +0 -57
- data/lib/ronin/sessions/http.rb +0 -678
- data/lib/ronin/sessions/imap.rb +0 -54
- data/lib/ronin/sessions/pop3.rb +0 -52
- data/lib/ronin/sessions/smtp.rb +0 -57
- data/lib/ronin/sessions/tcp.rb +0 -100
- data/lib/ronin/sessions/telnet.rb +0 -55
- data/lib/ronin/sessions/udp.rb +0 -73
- data/lib/ronin/ui/command_line/options.rb +0 -136
- data/lib/ronin/ui/diagnostics.rb +0 -66
- data/lib/ronin/ui/verbose.rb +0 -58
- data/spec/extensions/hash_spec.rb +0 -38
- data/spec/sessions/classes/test_session.rb +0 -11
- data/spec/sessions/classes/uses_test_session.rb +0 -10
- data/spec/sessions/session_spec.rb +0 -25
- data/spec/ui/verbose_spec.rb +0 -17
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,7 +16,6 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/extensions/imap/net'
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,7 +16,6 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/imap'
|
@@ -27,22 +24,39 @@ require 'net/imap'
|
|
27
24
|
|
28
25
|
module Net
|
29
26
|
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
27
|
+
# Creates a connection to the IMAP server.
|
28
|
+
#
|
29
|
+
# @param [String] host
|
30
|
+
# The host to connect to.
|
31
|
+
#
|
32
|
+
# @param [Hash] options
|
33
|
+
# Additional options.
|
34
|
+
#
|
35
|
+
# @option options [Integer] :port (IMAP.default_port)
|
36
|
+
# The port the IMAP server is running on.
|
37
|
+
#
|
38
|
+
# @option options [String] :certs
|
39
|
+
# The path to the file containing CA certs of the server.
|
40
|
+
#
|
41
|
+
# @option options [Symbol] :auth
|
42
|
+
# The type of authentication to perform when connecting to the server.
|
43
|
+
# May be either +:login+ or +:cram_md5+.
|
44
|
+
#
|
45
|
+
# @option options [String] :user
|
46
|
+
# The user to authenticate as when connecting to the server.
|
47
|
+
#
|
48
|
+
# @option options [String] :password
|
49
|
+
# The password to authenticate with when connecting to the server.
|
50
|
+
#
|
51
|
+
# @yield [session]
|
52
|
+
# If a _block_ is given, it will be passed the newly created IMAP
|
53
|
+
# session.
|
54
|
+
#
|
55
|
+
# @yieldparam [Net::IMAP] session
|
56
|
+
# The newly created IMAP session object.
|
57
|
+
#
|
58
|
+
# @return [Net::IMAP]
|
59
|
+
# The newly created IMAP session object.
|
46
60
|
#
|
47
61
|
def Net.imap_connect(host,options={},&block)
|
48
62
|
port = (options[:port] || Ronin::Net::IMAP.default_port)
|
@@ -75,9 +89,22 @@ module Net
|
|
75
89
|
end
|
76
90
|
|
77
91
|
#
|
78
|
-
# Starts an IMAP session with the IMAP server
|
79
|
-
#
|
80
|
-
#
|
92
|
+
# Starts an IMAP session with the IMAP server.
|
93
|
+
#
|
94
|
+
# @param [String] host
|
95
|
+
# The host to connect to.
|
96
|
+
#
|
97
|
+
# @param [Hash] options
|
98
|
+
# Additional options.
|
99
|
+
#
|
100
|
+
# @yield [session]
|
101
|
+
# If a _block_ is given, it will be passed the newly created IMAP
|
102
|
+
# session. After the _block_ has returned, the session will be closed.
|
103
|
+
#
|
104
|
+
# @yieldparam [Net::IMAP] session
|
105
|
+
# The newly created IMAP session object.
|
106
|
+
#
|
107
|
+
# @see Net.imap_connect
|
81
108
|
#
|
82
109
|
def Net.imap_session(host,options={},&block)
|
83
110
|
Net.imap_connect(host,options) do |sess|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,7 +16,6 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/extensions/pop3/net'
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,7 +16,6 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/pop3'
|
@@ -27,17 +24,32 @@ require 'net/pop'
|
|
27
24
|
|
28
25
|
module Net
|
29
26
|
#
|
30
|
-
#
|
31
|
-
# _options_. If a _block_ is given, it will be passed the newly created
|
32
|
-
# <tt>Net::POP3</tt> object.
|
27
|
+
# Creates a connection to the POP3 server.
|
33
28
|
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
29
|
+
# @param [String] host
|
30
|
+
# The host to connect to.
|
31
|
+
#
|
32
|
+
# @param [Hash] options
|
33
|
+
# Additional options.
|
34
|
+
#
|
35
|
+
# @option options [Integer] :port (Ronin::Network::POP3.default_port)
|
36
|
+
# The port the POP3 server is running on.
|
37
|
+
#
|
38
|
+
# @option options [String] :user
|
39
|
+
# The user to authenticate with when connecting to the POP3 server.
|
40
|
+
#
|
41
|
+
# @option options [String] :password
|
42
|
+
# The password to authenticate with when connecting to the POP3 server.
|
43
|
+
#
|
44
|
+
# @yield [session]
|
45
|
+
# If a _block_ is given, it will be passed the newly created POP3
|
46
|
+
# session.
|
47
|
+
#
|
48
|
+
# @yieldparam [Net::POP3] session
|
49
|
+
# The newly created POP3 session.
|
50
|
+
#
|
51
|
+
# @return [Net::POP3]
|
52
|
+
# The newly created POP3 session.
|
41
53
|
#
|
42
54
|
def Net.pop3_connect(host,options={},&block)
|
43
55
|
port = (options[:port] || Ronin::Network::POP3.default_port)
|
@@ -50,9 +62,20 @@ module Net
|
|
50
62
|
end
|
51
63
|
|
52
64
|
#
|
53
|
-
# Starts a session with the POP3 server
|
54
|
-
#
|
55
|
-
#
|
65
|
+
# Starts a session with the POP3 server.
|
66
|
+
#
|
67
|
+
# @param [String] host
|
68
|
+
# The host to connect to.
|
69
|
+
#
|
70
|
+
# @param [Hash] options
|
71
|
+
# Additional options.
|
72
|
+
#
|
73
|
+
# @yield [session]
|
74
|
+
# If a _block_ is given, it will be passed the newly created POP3
|
75
|
+
# session. After the _block_ has returned, the session will be closed.
|
76
|
+
#
|
77
|
+
# @yieldparam [Net::POP3] session
|
78
|
+
# The newly created POP3 session.
|
56
79
|
#
|
57
80
|
def Net.pop3_session(host,options={},&block)
|
58
81
|
Net.pop3_connect(host,options) do |sess|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,7 +16,6 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/extensions/smtp/net'
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,7 +16,6 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/smtp/email'
|
@@ -27,26 +24,45 @@ require 'net/smtp'
|
|
27
24
|
|
28
25
|
module Net
|
29
26
|
#
|
30
|
-
#
|
27
|
+
# @see Ronin::Network::SMTP.message
|
31
28
|
#
|
32
29
|
def Net.smtp_message(options={},&block)
|
33
30
|
Ronin::Network::SMTP.message(options,&block)
|
34
31
|
end
|
35
32
|
|
36
33
|
#
|
37
|
-
#
|
38
|
-
# _options_. If a _block_ is given it will be passed the newly created
|
39
|
-
# <tt>Net::SMTP</tt> object.
|
34
|
+
# Creates a connection to the SMTP server.
|
40
35
|
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
36
|
+
# @param [String] host
|
37
|
+
# The host to connect to.
|
38
|
+
#
|
39
|
+
# @param [Hash] options
|
40
|
+
# Additional options.
|
41
|
+
#
|
42
|
+
# @option options [Integer] :port (Ronin::Network::SMTP.default_port)
|
43
|
+
# The port to connect to.
|
44
|
+
#
|
45
|
+
# @option options [String] :helo
|
46
|
+
# The HELO domain.
|
47
|
+
#
|
48
|
+
# @option options [Symbol] :auth
|
49
|
+
# The type of authentication to use. Can be either +:login+, +:plain+,
|
50
|
+
# or +:cram_md5+.
|
51
|
+
#
|
52
|
+
# @option options [String] :user
|
53
|
+
# The user-name to authenticate with.
|
54
|
+
#
|
55
|
+
# @option options [String] :password
|
56
|
+
# The password to authenticate with.
|
57
|
+
#
|
58
|
+
# @yield [session]
|
59
|
+
# If a block is given, it will be passed an SMTP session object.
|
60
|
+
#
|
61
|
+
# @yieldparam [Net::SMTP] session
|
62
|
+
# The SMTP session.
|
63
|
+
#
|
64
|
+
# @return [Net::SMTP]
|
65
|
+
# The SMTP session.
|
50
66
|
#
|
51
67
|
def Net.smtp_connect(host,options={},&block)
|
52
68
|
port = (options[:port] || Ronin::Network::SMTP.default_port)
|
@@ -64,10 +80,22 @@ module Net
|
|
64
80
|
end
|
65
81
|
|
66
82
|
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
83
|
+
# Starts a session with the SMTP server.
|
84
|
+
#
|
85
|
+
# @param [String] host
|
86
|
+
# The host to connect to.
|
87
|
+
#
|
88
|
+
# @param [Hash] options
|
89
|
+
# Additional options.
|
90
|
+
#
|
91
|
+
# @yield [session]
|
92
|
+
# If a block is given, it will be passed an SMTP session object.
|
93
|
+
# After the block has returned, the session will be closed.
|
94
|
+
#
|
95
|
+
# @yieldparam [Net::SMTP] session
|
96
|
+
# The SMTP session.
|
97
|
+
#
|
98
|
+
# @see Net.smtp_connect
|
71
99
|
#
|
72
100
|
def Net.smtp_session(host,options={},&block)
|
73
101
|
Net.smtp_connect(host,options) do |sess|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,7 +16,6 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'ronin/network/extensions/tcp/net'
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
4
|
-
# exploration tasks.
|
2
|
+
# Ronin - A Ruby platform for exploit development and security research.
|
5
3
|
#
|
6
4
|
# Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
|
7
5
|
#
|
@@ -18,40 +16,81 @@
|
|
18
16
|
# You should have received a copy of the GNU General Public License
|
19
17
|
# along with this program; if not, write to the Free Software
|
20
18
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#++
|
22
19
|
#
|
23
20
|
|
24
21
|
require 'socket'
|
25
22
|
|
26
23
|
module Net
|
27
24
|
#
|
28
|
-
# Creates a new TCPSocket object with the specified
|
29
|
-
# and the given
|
30
|
-
# passed the newly created TCPSocket object.
|
25
|
+
# Creates a new TCPSocket object with the specified _host_, _port_
|
26
|
+
# and the given _local_host_ and _local_port_.
|
31
27
|
#
|
28
|
+
# @param [String] host
|
29
|
+
# The host to connect to.
|
30
|
+
#
|
31
|
+
# @param [Integer] port
|
32
|
+
# The port to connect to.
|
33
|
+
#
|
34
|
+
# @param [String] local_host
|
35
|
+
# The local host to bind to.
|
36
|
+
#
|
37
|
+
# @param [Integer] local_port
|
38
|
+
# The local port to bind to.
|
39
|
+
#
|
40
|
+
# @yield [socket]
|
41
|
+
# If a block is given, it will be passed the newly created socket.
|
42
|
+
#
|
43
|
+
# @yieldparam [TCPsocket] socket
|
44
|
+
# The newly created TCPSocket object.
|
45
|
+
#
|
46
|
+
# @return [TCPSocket]
|
47
|
+
# The newly created TCPSocket object.
|
48
|
+
#
|
49
|
+
# @example
|
32
50
|
# Net.tcp_connect('www.hackety.org',80) # => TCPSocket
|
33
51
|
#
|
52
|
+
# @example
|
34
53
|
# Net.tcp_connect('www.wired.com',80) do |sock|
|
35
54
|
# sock.write("GET /\n\n")
|
36
55
|
# puts sock.readlines
|
37
56
|
# sock.close
|
38
57
|
# end
|
39
58
|
#
|
40
|
-
def Net.tcp_connect(
|
41
|
-
sock = TCPSocket.new(
|
59
|
+
def Net.tcp_connect(host,port,local_host=nil,local_port=nil,&block)
|
60
|
+
sock = TCPSocket.new(host,port,local_host,local_port)
|
42
61
|
block.call(sock) if block
|
43
62
|
|
44
63
|
return sock
|
45
64
|
end
|
46
65
|
|
47
66
|
#
|
48
|
-
# Creates a new TCPSocket object with the specified
|
49
|
-
#
|
50
|
-
# then be written to the newly created TCPSocket.
|
51
|
-
#
|
67
|
+
# Creates a new TCPSocket object with the specified _host_, _port_, and
|
68
|
+
# the given _local_host_ and _local_port_. The specified _data_ will
|
69
|
+
# then be written to the newly created TCPSocket.
|
70
|
+
#
|
71
|
+
# @param [String] data
|
72
|
+
# The data to send through the connection.
|
73
|
+
#
|
74
|
+
# @param [String] host
|
75
|
+
# The host to connect to.
|
76
|
+
#
|
77
|
+
# @param [Integer] port
|
78
|
+
# The port to connect to.
|
52
79
|
#
|
53
|
-
|
54
|
-
|
80
|
+
# @param [String] local_host
|
81
|
+
# The local host to bind to.
|
82
|
+
#
|
83
|
+
# @param [Integer] local_port
|
84
|
+
# The local port to bind to.
|
85
|
+
#
|
86
|
+
# @yield [socket]
|
87
|
+
# If a block is given, it will be passed the newly created socket.
|
88
|
+
#
|
89
|
+
# @yieldparam [TCPsocket] socket
|
90
|
+
# The newly created TCPSocket object.
|
91
|
+
#
|
92
|
+
def Net.tcp_connect_and_send(data,host,port,local_host=nil,local_port=nil,&block)
|
93
|
+
Net.tcp_connect(host,port,local_host,local_port) do |sock|
|
55
94
|
sock.write(data)
|
56
95
|
|
57
96
|
block.call(sock) if block
|
@@ -59,13 +98,32 @@ module Net
|
|
59
98
|
end
|
60
99
|
|
61
100
|
#
|
62
|
-
# Creates a new TCPSocket object with the specified
|
63
|
-
# and the given
|
64
|
-
# passed the newly created TCPSocket object. After the TCPSocket
|
65
|
-
# has been passed to the given _block_ it will be closed.
|
101
|
+
# Creates a new TCPSocket object with the specified _host_, _port_
|
102
|
+
# and the given _local_host_ and _local_port_. If _block_ is given, it
|
103
|
+
# will be passed the newly created TCPSocket object. After the TCPSocket
|
104
|
+
# object has been passed to the given _block_ it will be closed.
|
105
|
+
#
|
106
|
+
# @param [String] host
|
107
|
+
# The host to connect to.
|
108
|
+
#
|
109
|
+
# @param [Integer] port
|
110
|
+
# The port to connect to.
|
111
|
+
#
|
112
|
+
# @param [String] local_host
|
113
|
+
# The local host to bind to.
|
114
|
+
#
|
115
|
+
# @param [Integer] local_port
|
116
|
+
# The local port to bind to.
|
117
|
+
#
|
118
|
+
# @yield [socket]
|
119
|
+
# If a block is given, it will be passed the newly created socket.
|
120
|
+
# After the block has returned, the socket will then be closed.
|
66
121
|
#
|
67
|
-
|
68
|
-
|
122
|
+
# @yieldparam [TCPsocket] socket
|
123
|
+
# The newly created TCPSocket object.
|
124
|
+
#
|
125
|
+
def Net.tcp_session(host,port,local_host=nil,local_port=nil,&block)
|
126
|
+
Net.tcp_connect(host,port,local_host,local_port) do |sock|
|
69
127
|
block.call(sock) if block
|
70
128
|
sock.close
|
71
129
|
end
|
@@ -74,17 +132,39 @@ module Net
|
|
74
132
|
end
|
75
133
|
|
76
134
|
#
|
77
|
-
# Connects to the specified
|
78
|
-
# and
|
79
|
-
#
|
135
|
+
# Connects to the specified _host_ and _port_ with the given
|
136
|
+
# _local_host_ and _local_port_, reads the banner then closes the
|
137
|
+
# connection.
|
138
|
+
#
|
139
|
+
# @param [String] host
|
140
|
+
# The host to connect to.
|
141
|
+
#
|
142
|
+
# @param [Integer] port
|
143
|
+
# The port to connect to.
|
144
|
+
#
|
145
|
+
# @param [String] local_host
|
146
|
+
# The local host to bind to.
|
147
|
+
#
|
148
|
+
# @param [Integer] local_port
|
149
|
+
# The local port to bind to.
|
80
150
|
#
|
151
|
+
# @yield [banner]
|
152
|
+
# If a block is given, it will be passed the grabbed banner.
|
153
|
+
#
|
154
|
+
# @yieldparam [String] banner
|
155
|
+
# The grabbed banner.
|
156
|
+
#
|
157
|
+
# @return [String]
|
158
|
+
# The grabbed banner.
|
159
|
+
#
|
160
|
+
# @example
|
81
161
|
# Net.tcp_banner('pop.gmail.com',25)
|
82
162
|
# # => "220 mx.google.com ESMTP c20sm3096959rvf.1"
|
83
163
|
#
|
84
|
-
def Net.tcp_banner(
|
164
|
+
def Net.tcp_banner(host,port,local_host=nil,local_port=nil,&block)
|
85
165
|
banner = nil
|
86
166
|
|
87
|
-
Net.tcp_session(
|
167
|
+
Net.tcp_session(host,port,local_host,local_port) do |sock|
|
88
168
|
banner = sock.readline.strip
|
89
169
|
end
|
90
170
|
|
@@ -93,18 +173,141 @@ module Net
|
|
93
173
|
end
|
94
174
|
|
95
175
|
#
|
96
|
-
# Connects to the specified
|
97
|
-
# and
|
98
|
-
#
|
176
|
+
# Connects to the specified _host_ and _port_ with the given _local_host_
|
177
|
+
# and _local_port_, sends the specified _data_ and then closes the
|
178
|
+
# connection.
|
179
|
+
#
|
180
|
+
# @param [String] data
|
181
|
+
# The data to send through the connection.
|
99
182
|
#
|
183
|
+
# @param [String] host
|
184
|
+
# The host to connect to.
|
185
|
+
#
|
186
|
+
# @param [Integer] port
|
187
|
+
# The port to connect to.
|
188
|
+
#
|
189
|
+
# @param [String] local_host
|
190
|
+
# The local host to bind to.
|
191
|
+
#
|
192
|
+
# @param [Integer] local_port
|
193
|
+
# The local port to bind to.
|
194
|
+
#
|
195
|
+
# @return [true]
|
196
|
+
# The data was successfully sent.
|
197
|
+
#
|
198
|
+
# @example
|
100
199
|
# buffer = "GET /" + ('A' * 4096) + "\n\r"
|
101
200
|
# Net.tcp_send(buffer,'victim.com',80)
|
201
|
+
# # => true
|
102
202
|
#
|
103
|
-
def Net.tcp_send(data,
|
104
|
-
Net.tcp_session(
|
203
|
+
def Net.tcp_send(data,host,port,local_host=nil,local_port=nil)
|
204
|
+
Net.tcp_session(host,port,local_host,local_port) do |sock|
|
105
205
|
sock.write(data)
|
106
206
|
end
|
107
207
|
|
108
208
|
return true
|
109
209
|
end
|
210
|
+
|
211
|
+
#
|
212
|
+
# Creates a new TCPServer listening on the specified _host_ and _port_.
|
213
|
+
#
|
214
|
+
# @param [Integer] port
|
215
|
+
# The local port to listen on.
|
216
|
+
#
|
217
|
+
# @param [String] host
|
218
|
+
# The host to bind to.
|
219
|
+
#
|
220
|
+
# @return [TCPServer]
|
221
|
+
# The new TCP server.
|
222
|
+
#
|
223
|
+
# @example
|
224
|
+
# Net.tcp_server(1337)
|
225
|
+
#
|
226
|
+
# @since 0.3.0
|
227
|
+
#
|
228
|
+
def Net.tcp_server(port,host='0.0.0.0',&block)
|
229
|
+
server = TCPServer.new(host,port)
|
230
|
+
server.listen(3)
|
231
|
+
|
232
|
+
block.call(server) if block
|
233
|
+
return server
|
234
|
+
end
|
235
|
+
|
236
|
+
#
|
237
|
+
# Creates a new TCPServer listening on the specified _host_ and _port_,
|
238
|
+
# passing it to the given _block_ and then closing the server.
|
239
|
+
#
|
240
|
+
# @param [Integer] port
|
241
|
+
# The local port to bind to.
|
242
|
+
#
|
243
|
+
# @param [String] host
|
244
|
+
# The host to bind to.
|
245
|
+
#
|
246
|
+
# @yield [server]
|
247
|
+
# The block which will be called after the _server_ has been created.
|
248
|
+
# After the block has finished, the _server_ will be closed.
|
249
|
+
#
|
250
|
+
# @yieldparam [TCPServer] server
|
251
|
+
# The newly created TCP server.
|
252
|
+
#
|
253
|
+
# @return [nil]
|
254
|
+
#
|
255
|
+
# @example
|
256
|
+
# Net.tcp_server_session(1337) do |server|
|
257
|
+
# client1 = server.accept
|
258
|
+
# client2 = server.accept
|
259
|
+
#
|
260
|
+
# client2.write(server.read_line)
|
261
|
+
#
|
262
|
+
# client1.close
|
263
|
+
# client2.close
|
264
|
+
# end
|
265
|
+
#
|
266
|
+
# @since 0.3.0
|
267
|
+
#
|
268
|
+
def Net.tcp_server_session(port,host='0.0.0.0',&block)
|
269
|
+
server = Net.tcp_server(port,host,&block)
|
270
|
+
server.close()
|
271
|
+
return nil
|
272
|
+
end
|
273
|
+
|
274
|
+
#
|
275
|
+
# Creates a new TCPServer listening on the specified _host_ and _port_,
|
276
|
+
# then accepts only one client.
|
277
|
+
#
|
278
|
+
# @param [Integer] port
|
279
|
+
# The local port to listen on.
|
280
|
+
#
|
281
|
+
# @param [String] host
|
282
|
+
# The host to bind to.
|
283
|
+
#
|
284
|
+
# @yield [client]
|
285
|
+
# The block which will be passed the newly connected _client_.
|
286
|
+
# After the block has finished, the _client_ and the server will be
|
287
|
+
# closed.
|
288
|
+
#
|
289
|
+
# @yieldparam [TCPSocket] client
|
290
|
+
# The newly connected client.
|
291
|
+
#
|
292
|
+
# @return [nil]
|
293
|
+
#
|
294
|
+
# @example
|
295
|
+
# Net.tcp_single_server(1337) do |client|
|
296
|
+
# client.puts 'lol'
|
297
|
+
# end
|
298
|
+
#
|
299
|
+
# @since 0.3.0
|
300
|
+
#
|
301
|
+
def Net.tcp_single_server(port,host='0.0.0.0',&block)
|
302
|
+
server = TCPServer.new(host,port)
|
303
|
+
server.listen(1)
|
304
|
+
|
305
|
+
client = server.accept
|
306
|
+
|
307
|
+
block.call(client) if block
|
308
|
+
|
309
|
+
client.close
|
310
|
+
server.close
|
311
|
+
return nil
|
312
|
+
end
|
110
313
|
end
|