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,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/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,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/text'
|
data/lib/ronin/license.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/model'
|
|
@@ -48,71 +45,81 @@ module Ronin
|
|
|
48
45
|
validates_is_unique :name
|
|
49
46
|
|
|
50
47
|
#
|
|
51
|
-
#
|
|
48
|
+
# Converts the license to a String.
|
|
52
49
|
#
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
#
|
|
58
|
-
# Defines a new builtin License object of the specified _name_ and the
|
|
59
|
-
# given _opts_. If block is given, it will be passed the newly created
|
|
60
|
-
# License object.
|
|
50
|
+
# @return [String]
|
|
51
|
+
# The name of the license.
|
|
61
52
|
#
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# <tt>:url</tt>:: The URL to the license.
|
|
65
|
-
#
|
|
66
|
-
def self.define(name,options={})
|
|
67
|
-
super(name.downcase.gsub(/[\s_\-]+/,'_'),options.merge(:name => name))
|
|
53
|
+
def to_s
|
|
54
|
+
self.name.to_s
|
|
68
55
|
end
|
|
69
56
|
|
|
70
|
-
# Creative Commons
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
57
|
+
# Creative Commons By-Attribution License
|
|
58
|
+
predefine :cc_by,
|
|
59
|
+
:name => 'CC by',
|
|
60
|
+
:description => 'Creative Commons Attribution v3.0 License',
|
|
61
|
+
:url => 'http://creativecommons.org/licenses/by/3.0/'
|
|
62
|
+
|
|
63
|
+
# Creative Commons By-Attribution Share-Alike License
|
|
64
|
+
predefine :cc_by_sa,
|
|
65
|
+
:name => 'CC by-sa',
|
|
66
|
+
:description => 'Creative Commons Attribution-Share Alike v3.0 License',
|
|
67
|
+
:url => 'http://creativecommons.org/licenses/by-sa/3.0/'
|
|
68
|
+
|
|
69
|
+
# Creative Commons By-Attribution No-Derivative Works License
|
|
70
|
+
predefine :cc_by_nd,
|
|
71
|
+
:name => 'CC by-nd',
|
|
72
|
+
:description => 'Creative Commons Attribution-No Derivative Works v3.0 License',
|
|
73
|
+
:url => 'http://creativecommons.org/licenses/by-nd/3.0/'
|
|
74
|
+
|
|
75
|
+
# Creative Commons By-Attribution Non-Commercial License
|
|
76
|
+
predefine :cc_by_nc,
|
|
77
|
+
:name => 'CC by-nc',
|
|
78
|
+
:description => 'Creative Commons Attribution-Noncommercial v3.0 License',
|
|
79
|
+
:url => 'http://creativecommons.org/licenses/by-nc/3.0/'
|
|
80
|
+
|
|
81
|
+
# Creative Commons By-Attribution Non-Commercial Share-Alike License
|
|
82
|
+
predefine :cc_by_nc_sa,
|
|
83
|
+
:name => 'CC by-nc-sa',
|
|
84
|
+
:description => 'Creative Commons Attribution-Noncommercial-Share Alike v3.0 License',
|
|
85
|
+
:url => 'http://creativecommons.org/licenses/by-nc-sa/3.0/'
|
|
86
|
+
|
|
87
|
+
# Creative Commons By-Attribution Non-Commercial No-Derivative Works
|
|
88
|
+
# License
|
|
89
|
+
predefine :cc_by_nc_nd,
|
|
90
|
+
:name => 'CC by-nc-nd',
|
|
91
|
+
:description => 'Creative Commons Attribution-Noncommercial-No Derivative Works v3.0 License',
|
|
92
|
+
:url => 'http://creativecommons.org/licenses/by-nc-nd/3.0/'
|
|
93
|
+
|
|
94
|
+
# Creative Commons Zero License
|
|
95
|
+
predefine :cc0,
|
|
96
|
+
:name => 'CC0',
|
|
97
|
+
:description => 'Creative Commons Zero License',
|
|
98
|
+
:url => 'http://creativecommons.org/licenses/zero/1.0/'
|
|
99
|
+
|
|
100
|
+
# General Public License, version 2
|
|
101
|
+
predefine :gpl2,
|
|
102
|
+
:name => 'GPL-2',
|
|
103
|
+
:description => 'GNU Public License v2.0',
|
|
104
|
+
:url => 'http://www.gnu.org/licenses/gpl-2.0.txt'
|
|
105
|
+
|
|
106
|
+
# General Public License, version 3
|
|
107
|
+
predefine :gpl3,
|
|
108
|
+
:name => 'GPL-3',
|
|
109
|
+
:description => 'GNU Public License v3.0',
|
|
110
|
+
:url => 'http://www.gnu.org/licenses/gpl-3.0.txt'
|
|
111
|
+
|
|
112
|
+
# Lesser General Public License, version 3
|
|
113
|
+
predefine :lgpl3,
|
|
114
|
+
:name => 'LGPL-3',
|
|
115
|
+
:description => 'GNU Lesser General Public License v3.0',
|
|
116
|
+
:url => 'http://www.gnu.org/licenses/lgpl-3.0.txt'
|
|
117
|
+
|
|
118
|
+
# The MIT "as-is" Licence
|
|
119
|
+
predefine :mit,
|
|
120
|
+
:name => 'MIT',
|
|
121
|
+
:description => 'The MIT Licence',
|
|
122
|
+
:url => 'http://www.opensource.org/licenses/mit-license.php'
|
|
116
123
|
|
|
117
124
|
end
|
|
118
125
|
end
|
data/lib/ronin/model.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/model/model'
|
|
@@ -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/model'
|
|
@@ -36,11 +33,43 @@ module Ronin
|
|
|
36
33
|
property :description, Text
|
|
37
34
|
|
|
38
35
|
#
|
|
39
|
-
# Finds models with descriptions
|
|
40
|
-
#
|
|
36
|
+
# Finds models with descriptions containing the specified
|
|
37
|
+
# _fragment_.
|
|
41
38
|
#
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
# @param [String] fragment
|
|
40
|
+
# The fragment of text to match descriptions with.
|
|
41
|
+
#
|
|
42
|
+
# @example
|
|
43
|
+
# Exploit.describing 'bypass'
|
|
44
|
+
#
|
|
45
|
+
def self.describing(fragment)
|
|
46
|
+
self.all(:description.like => "%#{fragment}%")
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
#
|
|
50
|
+
# Strips leading and trailing white-space from each line, then sets
|
|
51
|
+
# the description property.
|
|
52
|
+
#
|
|
53
|
+
# @param [String] new_text
|
|
54
|
+
# The new description to use.
|
|
55
|
+
#
|
|
56
|
+
# @example
|
|
57
|
+
# self.description = %{
|
|
58
|
+
# Some text here.
|
|
59
|
+
#
|
|
60
|
+
# More text.
|
|
61
|
+
# }
|
|
62
|
+
#
|
|
63
|
+
# @since 0.3.0
|
|
64
|
+
#
|
|
65
|
+
def description=(new_text)
|
|
66
|
+
sanitized_lines = []
|
|
67
|
+
|
|
68
|
+
new_text.to_s.each_line do |line|
|
|
69
|
+
sanitized_lines << line.strip
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
attribute_set(:description,sanitized_lines.join("\n").strip)
|
|
44
73
|
end
|
|
45
74
|
end
|
|
46
75
|
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,12 +16,13 @@
|
|
|
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/model'
|
|
25
22
|
require 'ronin/license'
|
|
26
23
|
|
|
24
|
+
require 'extlib'
|
|
25
|
+
|
|
27
26
|
module Ronin
|
|
28
27
|
module Model
|
|
29
28
|
module HasLicense
|
|
@@ -32,14 +31,16 @@ module Ronin
|
|
|
32
31
|
include Ronin::Model
|
|
33
32
|
|
|
34
33
|
# The license
|
|
35
|
-
belongs_to :license,
|
|
36
|
-
:child_key => [:license_id],
|
|
37
|
-
:class_name => 'Ronin::License'
|
|
34
|
+
belongs_to :license, :nullable => true
|
|
38
35
|
|
|
39
36
|
#
|
|
40
37
|
# Returns all models having the predefined license with the
|
|
41
|
-
#
|
|
38
|
+
# specified _name_.
|
|
39
|
+
#
|
|
40
|
+
# @param [Symbol, String] name
|
|
41
|
+
# The name of the license which models are associated with.
|
|
42
42
|
#
|
|
43
|
+
# @example
|
|
43
44
|
# LicensedModel.licensed_under(:cc_by_nc)
|
|
44
45
|
# # => [#<Ronin::LicensedModel: ...>, ...]
|
|
45
46
|
#
|
|
@@ -47,6 +48,9 @@ module Ronin
|
|
|
47
48
|
self.all(:license_id => Ronin::License[name].id)
|
|
48
49
|
end
|
|
49
50
|
end
|
|
51
|
+
|
|
52
|
+
model_name = base.name.split('::').last.snake_case.plural.to_sym
|
|
53
|
+
License.has License.n, model_name, :model => base.name
|
|
50
54
|
end
|
|
51
55
|
end
|
|
52
56
|
end
|
data/lib/ronin/model/has_name.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/model'
|
|
@@ -37,10 +34,16 @@ module Ronin
|
|
|
37
34
|
validates_present :name
|
|
38
35
|
|
|
39
36
|
#
|
|
40
|
-
# Finds models with names
|
|
37
|
+
# Finds models with names containing the specified _fragment_.
|
|
41
38
|
#
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
# @param [String] fragment
|
|
40
|
+
# The fragment of text to search for within the names of models.
|
|
41
|
+
#
|
|
42
|
+
# @example
|
|
43
|
+
# Exploit.named 'ProFTP'
|
|
44
|
+
#
|
|
45
|
+
def self.named(fragment)
|
|
46
|
+
self.all(:name.like => "%#{fragment}%")
|
|
44
47
|
end
|
|
45
48
|
end
|
|
46
49
|
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/model'
|
|
@@ -33,6 +30,19 @@ module Ronin
|
|
|
33
30
|
# The version of the model
|
|
34
31
|
property :version, String, :default => '0.1', :index => true
|
|
35
32
|
|
|
33
|
+
#
|
|
34
|
+
# Finds all models with a specific version.
|
|
35
|
+
#
|
|
36
|
+
# @param [String] version
|
|
37
|
+
# The specific version to search for.
|
|
38
|
+
#
|
|
39
|
+
# @return [Array]
|
|
40
|
+
# The models with the specific version.
|
|
41
|
+
#
|
|
42
|
+
def self.revision(version)
|
|
43
|
+
self.all(:version => version.to_s)
|
|
44
|
+
end
|
|
45
|
+
|
|
36
46
|
#
|
|
37
47
|
# Finds latest version of the model.
|
|
38
48
|
#
|
data/lib/ronin/model/model.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,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
|
-
|
|
25
|
-
|
|
21
|
+
require 'extlib'
|
|
26
22
|
require 'dm-core'
|
|
27
23
|
require 'dm-types'
|
|
28
24
|
require 'dm-validations'
|
|
@@ -38,10 +34,18 @@ module Ronin
|
|
|
38
34
|
unless base.ancestors.include?(DataMapper::Resource)
|
|
39
35
|
base.module_eval do
|
|
40
36
|
include DataMapper::Resource
|
|
41
|
-
include DataMapper::
|
|
37
|
+
include DataMapper::Migrations
|
|
38
|
+
|
|
39
|
+
def self.allocate
|
|
40
|
+
resource = super
|
|
41
|
+
resource.instance_eval("initialize()")
|
|
42
|
+
|
|
43
|
+
return resource
|
|
44
|
+
end
|
|
42
45
|
|
|
43
46
|
#
|
|
44
|
-
#
|
|
47
|
+
# @return [Symbol]
|
|
48
|
+
# The default repository name used for the model.
|
|
45
49
|
#
|
|
46
50
|
def self.default_repository_name
|
|
47
51
|
Model::REPOSITORY_NAME
|
|
@@ -49,16 +53,69 @@ module Ronin
|
|
|
49
53
|
|
|
50
54
|
# The class type property
|
|
51
55
|
property :type, Discriminator
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
52
59
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
#
|
|
61
|
+
# Formats the attributes of the model into human readable names
|
|
62
|
+
# and values.
|
|
63
|
+
#
|
|
64
|
+
# @param [Hash] options
|
|
65
|
+
# Additional options.
|
|
66
|
+
#
|
|
67
|
+
# @option options [Array<Symbol>] :exclude ([])
|
|
68
|
+
# A list of attribute names to exclude.
|
|
69
|
+
#
|
|
70
|
+
# @yield [name, value]
|
|
71
|
+
# If a block is given, it will be passed the name and humanized
|
|
72
|
+
# value of each attribute.
|
|
73
|
+
#
|
|
74
|
+
# @yieldparam [String] name
|
|
75
|
+
# The humanized name of the attribute.
|
|
76
|
+
#
|
|
77
|
+
# @yieldparam [String] value
|
|
78
|
+
# The human readable value of the attribute.
|
|
79
|
+
#
|
|
80
|
+
# @return [Hash{String => String}]
|
|
81
|
+
# A hash of the humanly readable names and values of the attributes.
|
|
82
|
+
#
|
|
83
|
+
def humanize_attributes(options={},&block)
|
|
84
|
+
exclude = [:id, :type]
|
|
85
|
+
|
|
86
|
+
if options[:exclude]
|
|
87
|
+
exclude += options[:exclude]
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
formatter = lambda { |value|
|
|
91
|
+
if value.kind_of?(Array)
|
|
92
|
+
value.map(&formatter).join(', ')
|
|
93
|
+
elsif value.kind_of?(Symbol)
|
|
94
|
+
Extlib::Inflection.humanize(value)
|
|
95
|
+
else
|
|
96
|
+
value.to_s
|
|
97
|
+
end
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
formatted = {}
|
|
101
|
+
|
|
102
|
+
self.attributes.each do |name,value|
|
|
103
|
+
next if (value.nil? || (value.respond_to?(:empty?) && value.empty?))
|
|
104
|
+
|
|
105
|
+
unless (exclude.include?(name) || value.nil?)
|
|
106
|
+
name = name.to_s
|
|
107
|
+
|
|
108
|
+
unless name[-3..-1] == '_id'
|
|
109
|
+
name = Extlib::Inflection.humanize(name)
|
|
110
|
+
value = formatter.call(value)
|
|
111
|
+
|
|
112
|
+
block.call(name,value) if block
|
|
113
|
+
formatted[name] = value
|
|
59
114
|
end
|
|
60
115
|
end
|
|
61
116
|
end
|
|
117
|
+
|
|
118
|
+
return formatted
|
|
62
119
|
end
|
|
63
120
|
end
|
|
64
121
|
end
|