ronin 0.2.4 → 0.3.0
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.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,21 +16,26 @@
|
|
|
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
|
module Kernel
|
|
25
22
|
#
|
|
26
23
|
# Calls the given _block_ and ignores any raised exceptions.
|
|
27
|
-
# If an exception is raised, +nil+ will be returned.
|
|
28
24
|
#
|
|
25
|
+
# @yield []
|
|
26
|
+
# The block to be called.
|
|
27
|
+
#
|
|
28
|
+
# @return [nil]
|
|
29
|
+
# An exception was ignored, or the block returned nil.
|
|
30
|
+
#
|
|
31
|
+
# @example
|
|
29
32
|
# attempt do
|
|
30
33
|
# Resolv.getaddress('might.not.exist.com')
|
|
31
34
|
# end
|
|
32
35
|
#
|
|
33
36
|
def attempt(&block)
|
|
34
37
|
begin
|
|
35
|
-
block.call if block
|
|
38
|
+
block.call() if block
|
|
36
39
|
rescue Exception
|
|
37
40
|
return nil
|
|
38
41
|
end
|
|
@@ -40,16 +43,26 @@ module Kernel
|
|
|
40
43
|
|
|
41
44
|
#
|
|
42
45
|
# Attempts to run the given _block_ and catches any SyntaxError,
|
|
43
|
-
# RuntimeError or StandardError exceptions.
|
|
44
|
-
#
|
|
46
|
+
# RuntimeError or StandardError exceptions.
|
|
47
|
+
#
|
|
48
|
+
# @param [Boolean] verbose
|
|
49
|
+
# Specifies wether a backtrace will be printed when an exception
|
|
50
|
+
# has been raised.
|
|
51
|
+
#
|
|
52
|
+
# @yield []
|
|
53
|
+
# The block to be called.
|
|
45
54
|
#
|
|
55
|
+
# @return [nil]
|
|
56
|
+
# An exception was ignored, or the block returned nil.
|
|
57
|
+
#
|
|
58
|
+
# @example
|
|
46
59
|
# catch_all do
|
|
47
60
|
# load 'suspicious.rb'
|
|
48
61
|
# end
|
|
49
62
|
#
|
|
50
63
|
def catch_all(verbose=true,&block)
|
|
51
64
|
begin
|
|
52
|
-
block.call if block
|
|
65
|
+
block.call() if block
|
|
53
66
|
rescue Exception => e
|
|
54
67
|
if verbose
|
|
55
68
|
STDERR.puts "#{e.class}: #{e}"
|
|
@@ -59,4 +72,26 @@ module Kernel
|
|
|
59
72
|
return nil
|
|
60
73
|
end
|
|
61
74
|
end
|
|
75
|
+
|
|
76
|
+
#
|
|
77
|
+
# Safely requires the specified _sub_path_ from within the specified
|
|
78
|
+
# _directory_.
|
|
79
|
+
#
|
|
80
|
+
# @param [String] directory
|
|
81
|
+
# The directory to require the _sub_path_ within.
|
|
82
|
+
#
|
|
83
|
+
# @param [String] sub_path
|
|
84
|
+
# The relative path to require, specifically within the specified
|
|
85
|
+
# _directory_.
|
|
86
|
+
#
|
|
87
|
+
# @return [Boolean]
|
|
88
|
+
# Specifies wether or not the _sub_path_ has not been loaded before.
|
|
89
|
+
#
|
|
90
|
+
# @example
|
|
91
|
+
# require_within 'ronin/exploits/helpers', helper_name
|
|
92
|
+
#
|
|
93
|
+
def require_within(directory,sub_path)
|
|
94
|
+
path = File.expand_path(File.join('',sub_path))
|
|
95
|
+
require File.join(directory,path)
|
|
96
|
+
end
|
|
62
97
|
end
|
|
@@ -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/extensions/meta/object'
|
|
@@ -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
|
class String
|
|
@@ -49,8 +46,8 @@ class String
|
|
|
49
46
|
min_length = [length, other.length].min
|
|
50
47
|
|
|
51
48
|
(min_length - 1).times do |i|
|
|
52
|
-
index = (length - i -1)
|
|
53
|
-
other_index = (other.length - i -1)
|
|
49
|
+
index = (length - i - 1)
|
|
50
|
+
other_index = (other.length - i - 1)
|
|
54
51
|
|
|
55
52
|
if self[index] != other[other_index]
|
|
56
53
|
return self[(index + 1)..-1]
|
|
@@ -73,8 +70,12 @@ class String
|
|
|
73
70
|
end
|
|
74
71
|
|
|
75
72
|
#
|
|
76
|
-
# Dumps the string
|
|
73
|
+
# Dumps the string as a C-style string.
|
|
77
74
|
#
|
|
75
|
+
# @return [String]
|
|
76
|
+
# The C-style encoded version of the String.
|
|
77
|
+
#
|
|
78
|
+
# @example
|
|
78
79
|
# "hello\x00\073\x90\r\n".dump
|
|
79
80
|
# # => "hello\0;\x90\r\n"
|
|
80
81
|
#
|
data/lib/ronin/extensions/uri.rb
CHANGED
|
@@ -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/extensions/uri/http'
|
|
@@ -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,11 +16,9 @@
|
|
|
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/extensions/uri/query_params'
|
|
25
|
-
require 'ronin/extensions/hash'
|
|
26
22
|
|
|
27
23
|
require 'uri/http'
|
|
28
24
|
|
|
@@ -31,48 +27,5 @@ module URI
|
|
|
31
27
|
|
|
32
28
|
include QueryParams
|
|
33
29
|
|
|
34
|
-
#
|
|
35
|
-
# Explodes the HTTP URI query_params into a Hash of HTTP URIs using the
|
|
36
|
-
# given _options_, where each HTTP URI has the value of one of the
|
|
37
|
-
# query_params replaced with the specified _value_. If a _block_ is
|
|
38
|
-
# given, it will be passed each query_param and the resulting HTTP URI.
|
|
39
|
-
#
|
|
40
|
-
# url = URI('http://search.dhgate.com/search.do?dkp=1&searchkey=yarn&catalog=')
|
|
41
|
-
# url.explode_query_params("'")
|
|
42
|
-
# # => {"searchkey"=>#<URI::HTTP:0xfdb915e82 URL:http://search.dhgate.com/search.do?searchkey='&catalog=&dkp=1>,
|
|
43
|
-
# # "catalog"=>#<URI::HTTP:0xfdb915e6e URL:http://search.dhgate.com/search.do?searchkey=yarn&catalog='&dkp=1>,
|
|
44
|
-
# # "dkp"=>#<URI::HTTP:0xfdb915e5a URL:http://search.dhgate.com/search.do?searchkey=yarn&catalog=&dkp='>}
|
|
45
|
-
#
|
|
46
|
-
def explode_query_params(value,options={},&block)
|
|
47
|
-
urls = {}
|
|
48
|
-
|
|
49
|
-
@query_params.explode(value,options).each do |param,params|
|
|
50
|
-
new_url = clone
|
|
51
|
-
new_url.query_params = params
|
|
52
|
-
|
|
53
|
-
block.call(param,new_url) if block
|
|
54
|
-
urls[param] = new_url
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
return urls
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
#
|
|
61
|
-
# Explodes the HTTP URI's query_params using the given _options_ and
|
|
62
|
-
# builds a Hash of return-values generated from calling the specified
|
|
63
|
-
# _block_ with each exploded HTTP URI.
|
|
64
|
-
#
|
|
65
|
-
def test_query_params(value,options={},&block)
|
|
66
|
-
results = {}
|
|
67
|
-
|
|
68
|
-
explode_query_params(value,options) do |param,url|
|
|
69
|
-
result = block.call(param,url)
|
|
70
|
-
|
|
71
|
-
results[param] = result if result
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
return results
|
|
75
|
-
end
|
|
76
|
-
|
|
77
30
|
end
|
|
78
31
|
end
|
|
@@ -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 'cgi'
|
|
@@ -41,7 +38,17 @@ module URI
|
|
|
41
38
|
end
|
|
42
39
|
|
|
43
40
|
#
|
|
44
|
-
# Sets the query
|
|
41
|
+
# Sets the query string and updates query_params.
|
|
42
|
+
#
|
|
43
|
+
# @param [String] query_str
|
|
44
|
+
# The new URI query string to use.
|
|
45
|
+
#
|
|
46
|
+
# @return [String]
|
|
47
|
+
# The new URI query string.
|
|
48
|
+
#
|
|
49
|
+
# @example
|
|
50
|
+
# url.query = 'a=1&b=2'
|
|
51
|
+
# # => "a=1&b=2"
|
|
45
52
|
#
|
|
46
53
|
def query=(query_str)
|
|
47
54
|
new_query = super(query_str)
|
|
@@ -50,8 +57,21 @@ module URI
|
|
|
50
57
|
end
|
|
51
58
|
|
|
52
59
|
#
|
|
53
|
-
# Iterates over every query parameter
|
|
54
|
-
#
|
|
60
|
+
# Iterates over every query parameter.
|
|
61
|
+
#
|
|
62
|
+
# @yield [name, value]
|
|
63
|
+
# The block to pass each query parameter to.
|
|
64
|
+
#
|
|
65
|
+
# @yieldparam [String] name
|
|
66
|
+
# The name of the query parameter.
|
|
67
|
+
#
|
|
68
|
+
# @yieldparam [String] value
|
|
69
|
+
# The value of the query parameter.
|
|
70
|
+
#
|
|
71
|
+
# @example
|
|
72
|
+
# url.each_query_param do |name,value|
|
|
73
|
+
# puts "#{name} = #{value}"
|
|
74
|
+
# end
|
|
55
75
|
#
|
|
56
76
|
def each_query_param(&block)
|
|
57
77
|
@query_params.each(&block)
|
|
@@ -81,7 +101,6 @@ module URI
|
|
|
81
101
|
|
|
82
102
|
private
|
|
83
103
|
|
|
84
|
-
# :nodoc
|
|
85
104
|
def path_query
|
|
86
105
|
str = @path
|
|
87
106
|
|
data/lib/ronin/formatting.rb
CHANGED
|
@@ -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/formatting/extensions'
|
|
@@ -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/formatting/extensions/binary'
|
|
@@ -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/formatting/extensions/digest'
|
|
@@ -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/formatting/extensions/binary'
|
|
@@ -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/formatting/extensions/binary/integer'
|
|
@@ -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/formatting/extensions/binary/string'
|
|
@@ -27,31 +24,9 @@ class File
|
|
|
27
24
|
|
|
28
25
|
#
|
|
29
26
|
# Converts the hexdump at the specified _path_ back into the original
|
|
30
|
-
# raw-data
|
|
27
|
+
# raw-data.
|
|
31
28
|
#
|
|
32
|
-
#
|
|
33
|
-
# <tt>:format</tt>:: The expected format of the hexdump. Must be either
|
|
34
|
-
# <tt>:od</tt> or <tt>:hexdump</tt>.
|
|
35
|
-
# <tt>:encoding</tt>:: Denotes the encoding used for the bytes within the
|
|
36
|
-
# hexdump. Must be one of the following:
|
|
37
|
-
# <tt>:binary</tt>:: Binary encoded bytes.
|
|
38
|
-
# <tt>:octal</tt>:: Octal encoding.
|
|
39
|
-
# <tt>:octal_bytes</tt>:: Octal encoded bytes.
|
|
40
|
-
# <tt>:octal_shorts</tt>:: Octal encoded shorts.
|
|
41
|
-
# <tt>:octal_ints</tt>:: Octal encoded integers.
|
|
42
|
-
# <tt>:octal_quads</tt>:: Octal encoded quads.
|
|
43
|
-
# <tt>:decimal</tt>:: Unsigned decimal encoding.
|
|
44
|
-
# <tt>:decimal_bytes</tt>:: Unsigned decimal bytes.
|
|
45
|
-
# <tt>:decimal_shorts</tt>:: Unsigned decimal shorts.
|
|
46
|
-
# <tt>:decimal_ints</tt>:: Unsigned decimal ints.
|
|
47
|
-
# <tt>:decimal_quads</tt>:: Unsigned decimal quads.
|
|
48
|
-
# <tt>:hex</tt>:: Hexadecimal encoding.
|
|
49
|
-
# <tt>:hex_bytes</tt>:: Hexadecimal bytes.
|
|
50
|
-
# <tt>:hex_shorts</tt>:: Hexadecimal shorts.
|
|
51
|
-
# <tt>:hex_ints</tt>:: Hexadecimal ints.
|
|
52
|
-
# <tt>:hex_quads</tt>:: Hexadecimal quads.
|
|
53
|
-
# <tt>:segment</tt>:: The length in bytes of each segment in the hexdump.
|
|
54
|
-
# Defaults to 16, if not specified.
|
|
29
|
+
# @see String#unhexdump.
|
|
55
30
|
#
|
|
56
31
|
def File.unhexdump(path,options={})
|
|
57
32
|
File.read(path).unhexdump(options)
|
|
@@ -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/arch'
|
|
@@ -26,15 +23,23 @@ require 'ronin/arch'
|
|
|
26
23
|
class Integer
|
|
27
24
|
|
|
28
25
|
#
|
|
29
|
-
#
|
|
30
|
-
# specified _address_length_ and given _endian_.
|
|
26
|
+
# Extracts a sequence of bytes which represent the Integer.
|
|
31
27
|
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
28
|
+
# @param [Integer] address_length
|
|
29
|
+
# The number of bytes to decode from the Integer.
|
|
34
30
|
#
|
|
31
|
+
# @param [Symbol] endian
|
|
32
|
+
# The endianness to use while decoding the bytes of the Integer.
|
|
33
|
+
# May be either +:big+, +:little+ or +:net+.
|
|
34
|
+
#
|
|
35
|
+
# @return [Array]
|
|
36
|
+
# The bytes decoded from the Integer.
|
|
37
|
+
#
|
|
38
|
+
# @example
|
|
35
39
|
# 0xff41.bytes(2)
|
|
36
40
|
# # => [65, 255]
|
|
37
41
|
#
|
|
42
|
+
# @example
|
|
38
43
|
# 0xff41.bytes(4, :big)
|
|
39
44
|
# # => [0, 0, 255, 65]
|
|
40
45
|
#
|
|
@@ -62,12 +67,22 @@ class Integer
|
|
|
62
67
|
end
|
|
63
68
|
|
|
64
69
|
#
|
|
65
|
-
# Packs the
|
|
66
|
-
#
|
|
67
|
-
#
|
|
70
|
+
# Packs the Integer into a String, for a specific architecture and
|
|
71
|
+
# address-length.
|
|
72
|
+
#
|
|
73
|
+
# @param [Ronin::Arch] arch
|
|
74
|
+
# The architecture to pack the Integer for.
|
|
68
75
|
#
|
|
76
|
+
# @param [Integer] address_length
|
|
77
|
+
# The number of bytes to pack.
|
|
78
|
+
#
|
|
79
|
+
# @return [String]
|
|
80
|
+
# The packed Integer.
|
|
81
|
+
#
|
|
82
|
+
# @example
|
|
69
83
|
# 0x41.pack(Arch.i686) # => "A\000\000\000"
|
|
70
84
|
#
|
|
85
|
+
# @example
|
|
71
86
|
# 0x41.pack(Arch.ppc,2) # => "\000A"
|
|
72
87
|
#
|
|
73
88
|
def pack(arch,address_length=arch.address_length)
|
|
@@ -75,8 +90,10 @@ class Integer
|
|
|
75
90
|
end
|
|
76
91
|
|
|
77
92
|
#
|
|
78
|
-
#
|
|
93
|
+
# @return [String]
|
|
94
|
+
# The hex escaped version of the Integer.
|
|
79
95
|
#
|
|
96
|
+
# @example
|
|
80
97
|
# 42.hex_escape
|
|
81
98
|
# # => "\\x2a"
|
|
82
99
|
#
|
|
@@ -84,4 +101,6 @@ class Integer
|
|
|
84
101
|
"\\x%.2x" % self
|
|
85
102
|
end
|
|
86
103
|
|
|
104
|
+
alias char chr
|
|
105
|
+
|
|
87
106
|
end
|