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
data/lib/ronin/path.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 'pathname'
|
@@ -27,13 +24,22 @@ module Ronin
|
|
27
24
|
class Path < Pathname
|
28
25
|
|
29
26
|
#
|
30
|
-
# Creates a new
|
27
|
+
# Creates a new path object for upward directory traversal.
|
31
28
|
#
|
29
|
+
# @param [Integer, Array, Range] n
|
30
|
+
# The number of directories to go up.
|
31
|
+
#
|
32
|
+
# @return [Path]
|
33
|
+
# The new path object.
|
34
|
+
#
|
35
|
+
# @example Generate a relative path that goes up 7 directories.
|
32
36
|
# Path.up(7)
|
33
37
|
# # => #<Ronin::Path:../../../../../../..>
|
34
38
|
#
|
39
|
+
# @example Generate multiple relative paths, going up 1 to 3 directories.
|
35
40
|
# Path.up(1..3)
|
36
|
-
# # => [#<Ronin::Path:..>, #<Ronin::Path:../..>,
|
41
|
+
# # => [#<Ronin::Path:..>, #<Ronin::Path:../..>,
|
42
|
+
# #<Ronin::Path:../../..>]
|
37
43
|
#
|
38
44
|
def self.up(n)
|
39
45
|
if n.kind_of?(Integer)
|
@@ -44,9 +50,16 @@ module Ronin
|
|
44
50
|
end
|
45
51
|
|
46
52
|
#
|
47
|
-
# Joins
|
48
|
-
# path.
|
53
|
+
# Joins directory names together with the path, but does not resolve
|
54
|
+
# the resulting path.
|
55
|
+
#
|
56
|
+
# @param [Array] names
|
57
|
+
# The names to join together.
|
49
58
|
#
|
59
|
+
# @return [Path]
|
60
|
+
# The joined path.
|
61
|
+
#
|
62
|
+
# @example
|
50
63
|
# Path.up(7).join('etc/passwd')
|
51
64
|
# # => #<Ronin::Path:../../../../../../../etc/passwd>
|
52
65
|
#
|
@@ -57,11 +70,18 @@ module Ronin
|
|
57
70
|
end
|
58
71
|
|
59
72
|
#
|
60
|
-
# Joins
|
73
|
+
# Joins a directory name to the path, but does not resolve the resulting
|
74
|
+
# path.
|
75
|
+
#
|
76
|
+
# @param [String] name
|
77
|
+
# A directory name.
|
61
78
|
#
|
79
|
+
# @example
|
62
80
|
# Path.up(7) / 'etc' / 'passwd'
|
63
81
|
# # => #<Ronin::Path:../../../../../../../etc/passwd>
|
64
82
|
#
|
83
|
+
# @see join
|
84
|
+
#
|
65
85
|
def /(name)
|
66
86
|
join(name)
|
67
87
|
end
|
data/lib/ronin/platform.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/platform/exceptions'
|
@@ -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/platform/exceptions/extension_not_found'
|
@@ -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
|
module Ronin
|
@@ -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
|
module Ronin
|
@@ -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
|
module Ronin
|
@@ -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/platform/exceptions/extension_not_found'
|
@@ -26,7 +23,7 @@ require 'ronin/platform/extension_cache'
|
|
26
23
|
require 'ronin/platform/platform'
|
27
24
|
require 'ronin/extensions/kernel'
|
28
25
|
require 'ronin/static/finders'
|
29
|
-
require 'ronin/ui/
|
26
|
+
require 'ronin/ui/output/helpers'
|
30
27
|
|
31
28
|
require 'contextify'
|
32
29
|
|
@@ -36,8 +33,16 @@ module Ronin
|
|
36
33
|
|
37
34
|
include Contextify
|
38
35
|
include Static::Finders
|
39
|
-
include UI::
|
36
|
+
include UI::Output::Helpers
|
40
37
|
|
38
|
+
#
|
39
|
+
# Creates a new Ronin::Platform::Extension object using the given
|
40
|
+
# _block_.
|
41
|
+
#
|
42
|
+
# ronin_extension do
|
43
|
+
# ...
|
44
|
+
# end
|
45
|
+
#
|
41
46
|
contextify :ronin_extension
|
42
47
|
|
43
48
|
# Extension file name
|
@@ -56,14 +61,21 @@ module Ronin
|
|
56
61
|
attr_reader :paths
|
57
62
|
|
58
63
|
#
|
59
|
-
# Creates a new Extension
|
60
|
-
# _block_ is given, it will be passed the newly created
|
61
|
-
# Extension.
|
64
|
+
# Creates a new Extension object.
|
62
65
|
#
|
66
|
+
# @param [String] name
|
67
|
+
# The name to give the newly created Extension object.
|
68
|
+
#
|
69
|
+
# @yield []
|
70
|
+
# The block that will be instance-evaled inside the newly created
|
71
|
+
# Extension object.
|
72
|
+
#
|
73
|
+
# @example
|
63
74
|
# Extension.new('exploits')
|
64
75
|
#
|
76
|
+
# @example
|
65
77
|
# Extension.new('awesome') do |ext|
|
66
|
-
# ...
|
78
|
+
# # ...
|
67
79
|
# end
|
68
80
|
#
|
69
81
|
def initialize(name,&block)
|
@@ -80,38 +92,20 @@ module Ronin
|
|
80
92
|
end
|
81
93
|
|
82
94
|
#
|
83
|
-
#
|
84
|
-
# Extension object. If a _block_ is given, it will be passed the
|
85
|
-
# newly created Extension object.
|
95
|
+
# Includes all extensions with the matching _name_ into the extension.
|
86
96
|
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
# end
|
97
|
+
# @param [String] name
|
98
|
+
# The name of the extensions to include.
|
90
99
|
#
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
block.call(ext) if block
|
96
|
-
return ext
|
97
|
-
end
|
98
|
-
|
99
|
-
#
|
100
|
-
# Loads all extensions with the specified _name_ into a newly created
|
101
|
-
# Extension object and then runs it with the specified _block_.
|
100
|
+
# @yield [ext]
|
101
|
+
# If a block is given, it will be passed the extension, after the
|
102
|
+
# other extensions have been included into it.
|
102
103
|
#
|
103
|
-
#
|
104
|
-
#
|
105
|
-
# end
|
106
|
-
#
|
107
|
-
def Extension.run(name,&block)
|
108
|
-
Extension.load(name) { |ext| ext.run(&block) }
|
109
|
-
end
|
110
|
-
|
104
|
+
# @yieldparam [Extension] ext
|
105
|
+
# The extension.
|
111
106
|
#
|
112
|
-
#
|
113
|
-
#
|
114
|
-
# extension after the extensions of _name_ have been included.
|
107
|
+
# @return [Extension]
|
108
|
+
# The extension.
|
115
109
|
#
|
116
110
|
def include(name,&block)
|
117
111
|
Platform.overlays.extension_paths(name).each do |path|
|
@@ -124,8 +118,21 @@ module Ronin
|
|
124
118
|
|
125
119
|
#
|
126
120
|
# Includes the extension at the specified _path_ into the extension.
|
127
|
-
#
|
128
|
-
#
|
121
|
+
#
|
122
|
+
# @param [String] path
|
123
|
+
# The path of the extension directory to include from.
|
124
|
+
#
|
125
|
+
# @yield [ext]
|
126
|
+
# If a block is given, it will be passed the extension.
|
127
|
+
#
|
128
|
+
# @yieldparam [Extension] ext
|
129
|
+
# The extension.
|
130
|
+
#
|
131
|
+
# @return [Extension]
|
132
|
+
# The extension.
|
133
|
+
#
|
134
|
+
# @raise [ExtensionNotFound]
|
135
|
+
# The specified _path_ was not a valid directory.
|
129
136
|
#
|
130
137
|
def include_path(path,&block)
|
131
138
|
path = File.expand_path(path)
|
@@ -153,16 +160,24 @@ module Ronin
|
|
153
160
|
end
|
154
161
|
|
155
162
|
#
|
156
|
-
#
|
163
|
+
# @return [Array]
|
164
|
+
# The list of public methods exposed by the extension.
|
157
165
|
#
|
158
166
|
def exposed_methods
|
159
167
|
methods(false).map { |name| name.to_sym }
|
160
168
|
end
|
161
169
|
|
162
170
|
#
|
163
|
-
#
|
164
|
-
# of the matching _name_, returns +false+ otherwise.
|
171
|
+
# Searches for a public method with the specified _name_.
|
165
172
|
#
|
173
|
+
# @param [Symbol, String] name
|
174
|
+
# The method name to search for.
|
175
|
+
#
|
176
|
+
# @return [Boolean]
|
177
|
+
# Specifies whether there is a public method with the specified
|
178
|
+
# _name_.
|
179
|
+
#
|
180
|
+
# @example
|
166
181
|
# ext.has_method?(:console)
|
167
182
|
# # => true
|
168
183
|
#
|
@@ -171,12 +186,23 @@ module Ronin
|
|
171
186
|
end
|
172
187
|
|
173
188
|
#
|
174
|
-
# Calls the setup blocks of the extension.
|
175
|
-
#
|
189
|
+
# Calls the setup blocks of the extension.
|
190
|
+
#
|
191
|
+
# @yield [ext]
|
192
|
+
# If a block is given, it will be passed the extension, once it
|
193
|
+
# has been setup.
|
194
|
+
#
|
195
|
+
# @yieldparam [Extension] ext
|
196
|
+
# The extension.
|
176
197
|
#
|
198
|
+
# @return [Extension]
|
199
|
+
# The extension.
|
200
|
+
#
|
201
|
+
# @example
|
177
202
|
# ext.setup!
|
178
203
|
# # => #<Ronin::Platform::Extension: ...>
|
179
204
|
#
|
205
|
+
# @example
|
180
206
|
# ext.setup! do |ext|
|
181
207
|
# puts "Extension #{ext} has been setup..."
|
182
208
|
# end
|
@@ -196,20 +222,31 @@ module Ronin
|
|
196
222
|
end
|
197
223
|
|
198
224
|
#
|
199
|
-
#
|
200
|
-
#
|
225
|
+
# @return [Boolean]
|
226
|
+
# Specifies whether the extension has been setup.
|
201
227
|
#
|
202
228
|
def setup?
|
203
229
|
@setup == true
|
204
230
|
end
|
205
231
|
|
206
232
|
#
|
207
|
-
# Run the teardown blocks of the extension.
|
208
|
-
#
|
233
|
+
# Run the teardown blocks of the extension.
|
234
|
+
#
|
235
|
+
# @yield [ext]
|
236
|
+
# If a block is given, it will be passed the extension, before it
|
237
|
+
# has been toredown.
|
238
|
+
#
|
239
|
+
# @yieldparam [Extension] ext
|
240
|
+
# The extension.
|
241
|
+
#
|
242
|
+
# @return [Extension]
|
243
|
+
# The extension.
|
209
244
|
#
|
245
|
+
# @example
|
210
246
|
# ext.teardown!
|
211
247
|
# # => #<Ronin::Platform::Extension: ...>
|
212
248
|
#
|
249
|
+
# @example
|
213
250
|
# ext.teardown! do |ext|
|
214
251
|
# puts "Extension #{ext} is being tore down..."
|
215
252
|
# end
|
@@ -230,8 +267,8 @@ module Ronin
|
|
230
267
|
end
|
231
268
|
|
232
269
|
#
|
233
|
-
#
|
234
|
-
#
|
270
|
+
# @return [Boolean]
|
271
|
+
# Specifies whether the extension has been toredown.
|
235
272
|
#
|
236
273
|
def toredown?
|
237
274
|
@toredown == true
|
@@ -241,6 +278,18 @@ module Ronin
|
|
241
278
|
# Sets up the extension, passes the extension to the specified
|
242
279
|
# _block_ and then tears down the extension.
|
243
280
|
#
|
281
|
+
# @yield [(ext)]
|
282
|
+
# If a block is given, it will be called after the extension has
|
283
|
+
# been setup. When the block has finished, the extension will be
|
284
|
+
# toredown.
|
285
|
+
#
|
286
|
+
# @yieldparam [Extension] ext
|
287
|
+
# The extension.
|
288
|
+
#
|
289
|
+
# @return [Extension]
|
290
|
+
# The extension.
|
291
|
+
#
|
292
|
+
# @example
|
244
293
|
# ext.run do |ext|
|
245
294
|
# ext.console(ARGV)
|
246
295
|
# end
|
@@ -260,6 +309,17 @@ module Ronin
|
|
260
309
|
return self
|
261
310
|
end
|
262
311
|
|
312
|
+
#
|
313
|
+
# The temporary directory for the extension.
|
314
|
+
#
|
315
|
+
# @return [String]
|
316
|
+
# The path to the extensions temporary directory within
|
317
|
+
# {Config::TMP_DIR}.
|
318
|
+
#
|
319
|
+
def tmp_dir
|
320
|
+
@tmp_dir ||= Config.tmp_dir(@name)
|
321
|
+
end
|
322
|
+
|
263
323
|
def static_paths(path,&block)
|
264
324
|
@paths.each do |dir|
|
265
325
|
static_dir = File.join(dir,STATIC_DIR)
|
@@ -272,7 +332,8 @@ module Ronin
|
|
272
332
|
end
|
273
333
|
|
274
334
|
#
|
275
|
-
#
|
335
|
+
# @return [String]
|
336
|
+
# The name of the extension.
|
276
337
|
#
|
277
338
|
def to_s
|
278
339
|
@name.to_s
|
@@ -280,10 +341,87 @@ module Ronin
|
|
280
341
|
|
281
342
|
protected
|
282
343
|
|
344
|
+
#
|
345
|
+
# Defines reader methods for the listed instance variables.
|
346
|
+
#
|
347
|
+
# @param [Array<Symbol, String>] names
|
348
|
+
# The names of instance variables to add reader methods for.
|
349
|
+
#
|
350
|
+
# @example
|
351
|
+
# attr_reader :var1, :var2
|
352
|
+
#
|
353
|
+
# self.var1
|
354
|
+
# # => nil
|
355
|
+
#
|
356
|
+
def attr_reader(*names)
|
357
|
+
names.each do |name|
|
358
|
+
name = name.to_sym
|
359
|
+
ivar_name = "@#{name}"
|
360
|
+
|
361
|
+
instance_eval %{
|
362
|
+
def #{name}
|
363
|
+
instance_variable_get(#{ivar_name.dump})
|
364
|
+
end
|
365
|
+
}
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
#
|
370
|
+
# Defines writer methods for the listed instance variables.
|
371
|
+
#
|
372
|
+
# @param [Array<Symbol, String>] names
|
373
|
+
# The names of the instance variables to define writer methods for.
|
374
|
+
#
|
375
|
+
# @example
|
376
|
+
# attr_writer :var1, :var2
|
377
|
+
#
|
378
|
+
# self.var1 = :foo
|
379
|
+
# self.var2 = :bar
|
380
|
+
#
|
381
|
+
def attr_writer(*names)
|
382
|
+
names.each do |name|
|
383
|
+
name = name.to_sym
|
384
|
+
ivar_name = "@#{name}"
|
385
|
+
|
386
|
+
instance_eval %{
|
387
|
+
def #{name}=(value)
|
388
|
+
instance_variable_set(#{ivar_name.dump},value)
|
389
|
+
end
|
390
|
+
}
|
391
|
+
end
|
392
|
+
end
|
393
|
+
|
394
|
+
#
|
395
|
+
# Defines reader and writer methods for the listed instance variables.
|
396
|
+
#
|
397
|
+
# @param [Array<Symbol, String>] names
|
398
|
+
# The names of the instance variables to define reader and writer
|
399
|
+
# methods for.
|
400
|
+
#
|
401
|
+
# @example
|
402
|
+
# attr_accessor :var1, :var2
|
403
|
+
#
|
404
|
+
# self.var1 = :foo
|
405
|
+
# self.var1
|
406
|
+
# # => :foo
|
407
|
+
#
|
408
|
+
# @see attr_reader
|
409
|
+
# @see attr_writer
|
410
|
+
#
|
411
|
+
def attr_accessor(*names)
|
412
|
+
attr_reader(*names)
|
413
|
+
attr_writer(*names)
|
414
|
+
end
|
415
|
+
|
283
416
|
#
|
284
417
|
# Adds the specified _block_ to the list of blocks to run in order
|
285
418
|
# to properly setup the extension.
|
286
419
|
#
|
420
|
+
# @example
|
421
|
+
# setup do
|
422
|
+
# @var = 'hello'
|
423
|
+
# end
|
424
|
+
#
|
287
425
|
def setup(&block)
|
288
426
|
@setup_blocks << block if block
|
289
427
|
return self
|
@@ -293,6 +431,11 @@ module Ronin
|
|
293
431
|
# Adds the specified _block_ to the list of blocks to run in order
|
294
432
|
# to properly tear-down the extension.
|
295
433
|
#
|
434
|
+
# @example
|
435
|
+
# teardown do
|
436
|
+
# @file.close
|
437
|
+
# end
|
438
|
+
#
|
296
439
|
def teardown(&block)
|
297
440
|
@teardown_blocks << block if block
|
298
441
|
return self
|