ronin 1.1.0 → 1.2.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/ChangeLog.md +23 -0
- data/README.md +19 -13
- data/Rakefile +2 -1
- data/gemspec.yml +18 -17
- data/lib/bond/completions/ronin.rb +147 -0
- data/lib/ronin/auto_load.rb +30 -28
- data/lib/ronin/database/migrations/1.0.0.rb +1 -0
- data/lib/ronin/model/has_authors.rb +92 -2
- data/lib/ronin/model/has_description.rb +54 -2
- data/lib/ronin/model/has_license.rb +101 -2
- data/lib/ronin/model/has_name.rb +72 -2
- data/lib/ronin/model/has_title.rb +52 -2
- data/lib/ronin/model/has_unique_name.rb +93 -2
- data/lib/ronin/model/has_version.rb +58 -2
- data/lib/ronin/model/model.rb +91 -52
- data/lib/ronin/os.rb +30 -15
- data/lib/ronin/repository.rb +1 -1
- data/lib/ronin/ronin.rb +0 -15
- data/lib/ronin/script/script.rb +257 -2
- data/lib/ronin/ui/console.rb +2 -199
- data/lib/ronin/ui/console/commands.rb +164 -0
- data/lib/ronin/ui/console/console.rb +215 -0
- data/lib/ronin/ui/console/context.rb +95 -0
- data/lib/ronin/version.rb +1 -1
- data/spec/os_spec.rb +18 -13
- metadata +206 -239
- data/lib/ronin/class_methods.rb +0 -49
- data/lib/ronin/model/class_methods.rb +0 -58
- data/lib/ronin/model/has_authors/class_methods.rb +0 -60
- data/lib/ronin/model/has_authors/has_authors.rb +0 -70
- data/lib/ronin/model/has_description/class_methods.rb +0 -49
- data/lib/ronin/model/has_description/has_description.rb +0 -49
- data/lib/ronin/model/has_license/class_methods.rb +0 -68
- data/lib/ronin/model/has_license/has_license.rb +0 -71
- data/lib/ronin/model/has_name/class_methods.rb +0 -48
- data/lib/ronin/model/has_name/has_name.rb +0 -62
- data/lib/ronin/model/has_title/class_methods.rb +0 -48
- data/lib/ronin/model/has_title/has_title.rb +0 -48
- data/lib/ronin/model/has_unique_name/class_methods.rb +0 -51
- data/lib/ronin/model/has_unique_name/has_unique_name.rb +0 -78
- data/lib/ronin/model/has_version/class_methods.rb +0 -54
- data/lib/ronin/model/has_version/has_version.rb +0 -48
- data/lib/ronin/script/class_methods.rb +0 -84
- data/lib/ronin/script/instance_methods.rb +0 -217
@@ -1,84 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
-
#
|
4
|
-
# This file is part of Ronin.
|
5
|
-
#
|
6
|
-
# Ronin is free software: you can redistribute it and/or modify
|
7
|
-
# it under the terms of the GNU General Public License as published by
|
8
|
-
# the Free Software Foundation, either version 3 of the License, or
|
9
|
-
# (at your option) any later version.
|
10
|
-
#
|
11
|
-
# Ronin is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
# GNU General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU General Public License
|
17
|
-
# along with Ronin. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
#
|
19
|
-
|
20
|
-
module Ronin
|
21
|
-
module Script
|
22
|
-
#
|
23
|
-
# @since 1.1.0
|
24
|
-
#
|
25
|
-
module ClassMethods
|
26
|
-
#
|
27
|
-
# Loads the {Script} of the same class.
|
28
|
-
#
|
29
|
-
# @param [String] path
|
30
|
-
# The path to load the script from.
|
31
|
-
#
|
32
|
-
# @return [Script]
|
33
|
-
# The loaded script.
|
34
|
-
#
|
35
|
-
# @example
|
36
|
-
# Exploits::HTTP.load_from('mod_php_exploit.rb')
|
37
|
-
# # => #<Ronin::Exploits::HTTP: ...>
|
38
|
-
#
|
39
|
-
# @since 1.1.0
|
40
|
-
#
|
41
|
-
def load_from(path)
|
42
|
-
load_object(path)
|
43
|
-
end
|
44
|
-
|
45
|
-
#
|
46
|
-
# Loads all objects with the matching attributes.
|
47
|
-
#
|
48
|
-
# @param [Hash] attributes
|
49
|
-
# Attributes to search for.
|
50
|
-
#
|
51
|
-
# @since 1.1.0
|
52
|
-
#
|
53
|
-
# @api public
|
54
|
-
#
|
55
|
-
def load_all(attributes={})
|
56
|
-
resources = all(attributes)
|
57
|
-
resources.each { |resource| resource.load_script! }
|
58
|
-
|
59
|
-
return resources
|
60
|
-
end
|
61
|
-
|
62
|
-
#
|
63
|
-
# Loads the first object with matching attributes.
|
64
|
-
#
|
65
|
-
# @param [Hash] attributes
|
66
|
-
# Attributes to search for.
|
67
|
-
#
|
68
|
-
# @return [Cacheable]
|
69
|
-
# The loaded cached objects.
|
70
|
-
#
|
71
|
-
# @since 1.1.0
|
72
|
-
#
|
73
|
-
# @api public
|
74
|
-
#
|
75
|
-
def load_first(attributes={})
|
76
|
-
if (resource = first(attributes))
|
77
|
-
resource.load_script!
|
78
|
-
end
|
79
|
-
|
80
|
-
return resource
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
@@ -1,217 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
-
#
|
4
|
-
# This file is part of Ronin.
|
5
|
-
#
|
6
|
-
# Ronin is free software: you can redistribute it and/or modify
|
7
|
-
# it under the terms of the GNU General Public License as published by
|
8
|
-
# the Free Software Foundation, either version 3 of the License, or
|
9
|
-
# (at your option) any later version.
|
10
|
-
#
|
11
|
-
# Ronin is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
# GNU General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU General Public License
|
17
|
-
# along with Ronin. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
#
|
19
|
-
|
20
|
-
module Ronin
|
21
|
-
module Script
|
22
|
-
#
|
23
|
-
# Instance methods for an {Script}.
|
24
|
-
#
|
25
|
-
# @since 1.1.0
|
26
|
-
#
|
27
|
-
module InstanceMethods
|
28
|
-
#
|
29
|
-
# Initializes the Ronin Script.
|
30
|
-
#
|
31
|
-
# @param [Array] arguments
|
32
|
-
# Arguments for initializing the Script.
|
33
|
-
#
|
34
|
-
# @since 1.1.0
|
35
|
-
#
|
36
|
-
# @api semipublic
|
37
|
-
#
|
38
|
-
def initialize(*arguments,&block)
|
39
|
-
@script_loaded = false
|
40
|
-
@cache_prepared = false
|
41
|
-
|
42
|
-
if arguments.first.kind_of?(Hash)
|
43
|
-
initialize_params(arguments.first)
|
44
|
-
end
|
45
|
-
|
46
|
-
super(*arguments,&block)
|
47
|
-
end
|
48
|
-
|
49
|
-
#
|
50
|
-
# The script type.
|
51
|
-
#
|
52
|
-
# @return [String]
|
53
|
-
# The name of the script class.
|
54
|
-
#
|
55
|
-
# @since 1.1.0
|
56
|
-
#
|
57
|
-
# @api semipublic
|
58
|
-
#
|
59
|
-
def script_type
|
60
|
-
@script_type ||= self.class.base_model.name.split('::').last
|
61
|
-
end
|
62
|
-
|
63
|
-
#
|
64
|
-
# Determines if the original code, from the cache file, has been
|
65
|
-
# loaded into the object.
|
66
|
-
#
|
67
|
-
# @return [Boolean]
|
68
|
-
# Specifies whether the original code has been loaded into the
|
69
|
-
# object.
|
70
|
-
#
|
71
|
-
# @since 1.1.0
|
72
|
-
#
|
73
|
-
# @api private
|
74
|
-
#
|
75
|
-
def script_loaded?
|
76
|
-
@script_loaded == true
|
77
|
-
end
|
78
|
-
|
79
|
-
#
|
80
|
-
# Loads the code from the cached file for the object, and instance
|
81
|
-
# evaluates it into the object.
|
82
|
-
#
|
83
|
-
# @return [Boolean]
|
84
|
-
# Indicates the original code was successfully loaded.
|
85
|
-
#
|
86
|
-
# @since 1.1.0
|
87
|
-
#
|
88
|
-
# @api private
|
89
|
-
#
|
90
|
-
def load_script!
|
91
|
-
if (cached? && !script_loaded?)
|
92
|
-
block = self.class.load_object_block(self.script_path.path)
|
93
|
-
|
94
|
-
@script_loaded = true
|
95
|
-
instance_eval(&block) if block
|
96
|
-
return true
|
97
|
-
end
|
98
|
-
|
99
|
-
return false
|
100
|
-
end
|
101
|
-
|
102
|
-
#
|
103
|
-
# @return [Boolean]
|
104
|
-
# Specifies whether the object has been prepared to be cached,
|
105
|
-
#
|
106
|
-
# @since 1.1.0
|
107
|
-
#
|
108
|
-
# @api private
|
109
|
-
#
|
110
|
-
def prepared_for_cache?
|
111
|
-
@cache_prepared == true
|
112
|
-
end
|
113
|
-
|
114
|
-
#
|
115
|
-
# Indicates whether the object has been cached.
|
116
|
-
#
|
117
|
-
# @return [Boolean]
|
118
|
-
# Specifies whether the object has been previously cached.
|
119
|
-
#
|
120
|
-
# @since 1.1.0
|
121
|
-
#
|
122
|
-
# @api private
|
123
|
-
#
|
124
|
-
def cached?
|
125
|
-
(saved? && self.script_path)
|
126
|
-
end
|
127
|
-
|
128
|
-
#
|
129
|
-
# Default method which invokes the script.
|
130
|
-
#
|
131
|
-
# @param [Array] arguments
|
132
|
-
# Optional arguments.
|
133
|
-
#
|
134
|
-
# @since 1.1.0
|
135
|
-
#
|
136
|
-
def run(*arguments)
|
137
|
-
end
|
138
|
-
|
139
|
-
#
|
140
|
-
# Converts the script to a String.
|
141
|
-
#
|
142
|
-
# @return [String]
|
143
|
-
# The name and version of the script.
|
144
|
-
#
|
145
|
-
# @since 1.1.0
|
146
|
-
#
|
147
|
-
# @api public
|
148
|
-
#
|
149
|
-
def to_s
|
150
|
-
if (self.name && self.version)
|
151
|
-
"#{self.name} #{self.version}"
|
152
|
-
elsif self.name
|
153
|
-
super
|
154
|
-
elsif self.version
|
155
|
-
self.version.to_s
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
#
|
160
|
-
# Inspects both the properties and parameters of the Ronin Script.
|
161
|
-
#
|
162
|
-
# @return [String]
|
163
|
-
# The inspected Ronin Script.
|
164
|
-
#
|
165
|
-
# @since 1.1.0
|
166
|
-
#
|
167
|
-
# @api public
|
168
|
-
#
|
169
|
-
def inspect
|
170
|
-
body = []
|
171
|
-
|
172
|
-
self.attributes.each do |name,value|
|
173
|
-
body << "#{name}: #{value.inspect}"
|
174
|
-
end
|
175
|
-
|
176
|
-
param_pairs = []
|
177
|
-
|
178
|
-
self.params.each do |name,param|
|
179
|
-
param_pairs << "#{name}: #{param.value.inspect}"
|
180
|
-
end
|
181
|
-
|
182
|
-
body << "params: {#{param_pairs.join(', ')}}"
|
183
|
-
|
184
|
-
return "#<#{self.class}: #{body.join(', ')}>"
|
185
|
-
end
|
186
|
-
|
187
|
-
protected
|
188
|
-
|
189
|
-
#
|
190
|
-
# Will call the given block only once, in order to prepare the
|
191
|
-
# object for caching.
|
192
|
-
#
|
193
|
-
# @yield []
|
194
|
-
# The block will be ran inside the object when the object is to be
|
195
|
-
# prepared for caching.
|
196
|
-
#
|
197
|
-
# @return [Boolean]
|
198
|
-
# Specifies whether the object was successfully prepared for
|
199
|
-
# caching.
|
200
|
-
#
|
201
|
-
# @since 1.1.0
|
202
|
-
#
|
203
|
-
# @api public
|
204
|
-
#
|
205
|
-
def cache
|
206
|
-
if (block_given? && !(cached? || prepared_for_cache?))
|
207
|
-
@cache_prepared = true
|
208
|
-
|
209
|
-
yield
|
210
|
-
return true
|
211
|
-
end
|
212
|
-
|
213
|
-
return false
|
214
|
-
end
|
215
|
-
end
|
216
|
-
end
|
217
|
-
end
|