ronin 1.0.0.pre4 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/ChangeLog.md +1 -0
- data/Gemfile +3 -1
- data/README.md +17 -19
- data/Rakefile +1 -0
- data/gemspec.yml +2 -1
- data/lib/ronin.rb +3 -0
- data/lib/ronin/address.rb +7 -3
- data/lib/ronin/arch.rb +2 -2
- data/lib/ronin/bootstrap.rb +3 -0
- data/lib/ronin/cached_file.rb +1 -1
- data/lib/ronin/campaign.rb +3 -32
- data/lib/ronin/class_methods.rb +17 -0
- data/lib/ronin/config.rb +25 -24
- data/lib/ronin/credential.rb +3 -0
- data/lib/ronin/database/migrations.rb +0 -1
- data/lib/ronin/database/migrations/create_credentials_table.rb +1 -2
- data/lib/ronin/database/migrations/graph.rb +6 -3
- data/lib/ronin/database/migrations/migration.rb +3 -0
- data/lib/ronin/database/migrations/migrations.rb +2 -2
- data/lib/ronin/email_address.rb +3 -0
- data/lib/ronin/engine/buildable.rb +3 -0
- data/lib/ronin/engine/class_methods.rb +3 -0
- data/lib/ronin/engine/deployable.rb +3 -0
- data/lib/ronin/engine/engine.rb +14 -0
- data/lib/ronin/engine/instance_methods.rb +3 -0
- data/lib/ronin/engine/verifiable.rb +3 -0
- data/lib/ronin/environment.rb +6 -0
- data/lib/ronin/host_name.rb +3 -0
- data/lib/ronin/host_name_ip_address.rb +3 -0
- data/lib/ronin/ip_address.rb +3 -0
- data/lib/ronin/ip_address_mac_address.rb +3 -0
- data/lib/ronin/license.rb +1 -1
- data/lib/ronin/mac_address.rb +3 -0
- data/lib/ronin/model/cacheable/cacheable.rb +1 -1
- data/lib/ronin/model/class_methods.rb +3 -0
- data/lib/ronin/model/has_authors/class_methods.rb +4 -0
- data/lib/ronin/model/has_authors/has_authors.rb +9 -5
- data/lib/ronin/model/has_description/class_methods.rb +4 -0
- data/lib/ronin/model/has_description/has_description.rb +6 -0
- data/lib/ronin/model/has_license/class_methods.rb +4 -0
- data/lib/ronin/model/has_license/has_license.rb +9 -5
- data/lib/ronin/model/has_name/class_methods.rb +4 -0
- data/lib/ronin/model/has_name/has_name.rb +6 -0
- data/lib/ronin/model/has_title/class_methods.rb +4 -0
- data/lib/ronin/model/has_title/has_title.rb +6 -0
- data/lib/ronin/model/has_unique_name.rb +7 -0
- data/lib/ronin/model/has_version/class_methods.rb +4 -0
- data/lib/ronin/model/has_version/has_version.rb +6 -0
- data/lib/ronin/model/model.rb +7 -0
- data/lib/ronin/model/types/description.rb +7 -2
- data/lib/ronin/open_port.rb +3 -0
- data/lib/ronin/organization.rb +3 -0
- data/lib/ronin/os.rb +2 -2
- data/lib/ronin/os_guess.rb +3 -0
- data/lib/ronin/password.rb +4 -1
- data/lib/ronin/port.rb +6 -1
- data/lib/ronin/ronin.rb +8 -0
- data/lib/ronin/service.rb +3 -0
- data/lib/ronin/service_credential.rb +3 -0
- data/lib/ronin/target.rb +3 -4
- data/lib/ronin/tcp_port.rb +4 -1
- data/lib/ronin/udp_port.rb +4 -1
- data/lib/ronin/ui/cli/cli.rb +1 -1
- data/lib/ronin/ui/cli/command.rb +6 -0
- data/lib/ronin/ui/cli/commands/repos.rb +33 -0
- data/lib/ronin/ui/cli/engine_command.rb +3 -0
- data/lib/ronin/ui/cli/model_command.rb +3 -0
- data/lib/ronin/ui/console.rb +5 -1
- data/lib/ronin/ui/hexdump/hexdump.rb +3 -0
- data/lib/ronin/ui/output/helpers.rb +59 -26
- data/lib/ronin/ui/output/output.rb +3 -0
- data/lib/ronin/ui/output/terminal/color.rb +32 -20
- data/lib/ronin/ui/output/terminal/raw.rb +23 -20
- data/lib/ronin/ui/shell.rb +3 -0
- data/lib/ronin/url.rb +8 -5
- data/lib/ronin/url_query_param.rb +3 -0
- data/lib/ronin/url_scheme.rb +3 -0
- data/lib/ronin/user_name.rb +4 -1
- data/lib/ronin/vendor.rb +1 -1
- data/lib/ronin/version.rb +1 -1
- data/lib/ronin/web_credential.rb +4 -1
- data/ronin.gemspec +7 -2
- data/spec/campaign_spec.rb +0 -25
- data/spec/url_spec.rb +5 -2
- metadata +48 -36
- data/lib/ronin/database/migrations/create_remote_files_table.rb +0 -52
- data/lib/ronin/proxy.rb +0 -178
- data/lib/ronin/proxy_credential.rb +0 -29
- data/lib/ronin/remote_file.rb +0 -152
@@ -22,10 +22,15 @@ require 'dm-core'
|
|
22
22
|
module Ronin
|
23
23
|
module Model
|
24
24
|
module Types
|
25
|
+
#
|
26
|
+
# The Description property type is similar to the `Text` type,
|
27
|
+
# but automatically strips all leading and tailing white-space
|
28
|
+
# from every line.
|
29
|
+
#
|
25
30
|
class Description < DataMapper::Property::Text
|
26
31
|
|
27
32
|
#
|
28
|
-
#
|
33
|
+
# Type-casts the description.
|
29
34
|
#
|
30
35
|
# @param [Object] value
|
31
36
|
# The text of the description.
|
@@ -34,7 +39,7 @@ module Ronin
|
|
34
39
|
# The description property.
|
35
40
|
#
|
36
41
|
# @return [String, nil]
|
37
|
-
# The
|
42
|
+
# The type-casted description.
|
38
43
|
#
|
39
44
|
# @since 1.0.0
|
40
45
|
#
|
data/lib/ronin/open_port.rb
CHANGED
data/lib/ronin/organization.rb
CHANGED
data/lib/ronin/os.rb
CHANGED
@@ -25,7 +25,7 @@ require 'ronin/extensions/meta'
|
|
25
25
|
|
26
26
|
module Ronin
|
27
27
|
#
|
28
|
-
# Represents an Operating System and
|
28
|
+
# Represents an Operating System and pre-defines other common ones
|
29
29
|
# ({linux}, {freebsd}, {openbsd}, {netbsd}, {osx}, {solaris}, {windows}
|
30
30
|
# and {unix}).
|
31
31
|
#
|
@@ -109,7 +109,7 @@ module Ronin
|
|
109
109
|
# Defines a new predefined OS.
|
110
110
|
#
|
111
111
|
# @param [Symbol, String] name
|
112
|
-
# The method name to define for the
|
112
|
+
# The method name to define for the predefined OS.
|
113
113
|
#
|
114
114
|
# @param [String] os_name
|
115
115
|
# The name of the OS.
|
data/lib/ronin/os_guess.rb
CHANGED
data/lib/ronin/password.rb
CHANGED
@@ -23,6 +23,9 @@ require 'ronin/model'
|
|
23
23
|
require 'digest'
|
24
24
|
|
25
25
|
module Ronin
|
26
|
+
#
|
27
|
+
# Represents a password that can be stored in the {Database}.
|
28
|
+
#
|
26
29
|
class Password
|
27
30
|
|
28
31
|
include Model
|
@@ -59,7 +62,7 @@ module Ronin
|
|
59
62
|
# The hex-digest of the hashed password.
|
60
63
|
#
|
61
64
|
# @raise [ArgumentError]
|
62
|
-
# Unknown Digest
|
65
|
+
# Unknown Digest algorithm.
|
63
66
|
#
|
64
67
|
# @example
|
65
68
|
# pass = Password.new(:clear_text => 'secret')
|
data/lib/ronin/port.rb
CHANGED
@@ -21,6 +21,9 @@ require 'ronin/open_port'
|
|
21
21
|
require 'ronin/model'
|
22
22
|
|
23
23
|
module Ronin
|
24
|
+
#
|
25
|
+
# Represents a TCP or UDP port.
|
26
|
+
#
|
24
27
|
class Port
|
25
28
|
|
26
29
|
include Model
|
@@ -28,13 +31,15 @@ module Ronin
|
|
28
31
|
# Primary key of the port
|
29
32
|
property :id, Serial
|
30
33
|
|
31
|
-
# The protocol of the port (tcp/udp)
|
34
|
+
# The protocol of the port (either `'tcp'` / `'udp'`)
|
32
35
|
property :protocol, String, :set => ['tcp', 'udp'],
|
33
36
|
:required => true,
|
34
37
|
:unique_index => :protocol_port
|
35
38
|
|
36
39
|
# The port number
|
37
40
|
property :number, Integer, :required => true,
|
41
|
+
:min => 1,
|
42
|
+
:max => 65535,
|
38
43
|
:unique_index => :protocol_port
|
39
44
|
|
40
45
|
# The open ports
|
data/lib/ronin/ronin.rb
CHANGED
@@ -24,6 +24,14 @@ require 'open_namespace'
|
|
24
24
|
module Ronin
|
25
25
|
include OpenNamespace
|
26
26
|
|
27
|
+
#
|
28
|
+
# Includes {ClassMethods} when {Ronin} is included.
|
29
|
+
#
|
30
|
+
# @param [Class, Module] base
|
31
|
+
# The class or module that {Ronin} is being included into.
|
32
|
+
#
|
33
|
+
# @since 1.0.0
|
34
|
+
#
|
27
35
|
def self.included(base)
|
28
36
|
base.send :extend, ClassMethods
|
29
37
|
end
|
data/lib/ronin/service.rb
CHANGED
data/lib/ronin/target.rb
CHANGED
@@ -19,12 +19,14 @@
|
|
19
19
|
|
20
20
|
require 'ronin/campaign'
|
21
21
|
require 'ronin/address'
|
22
|
-
require 'ronin/remote_file'
|
23
22
|
require 'ronin/model'
|
24
23
|
|
25
24
|
require 'fileutils'
|
26
25
|
|
27
26
|
module Ronin
|
27
|
+
#
|
28
|
+
# Represents an {Address} targeted by a {Campaign}.
|
29
|
+
#
|
28
30
|
class Target
|
29
31
|
|
30
32
|
include Model
|
@@ -41,9 +43,6 @@ module Ronin
|
|
41
43
|
# The organization that is being targeted
|
42
44
|
has 1, :organization, :through => :address
|
43
45
|
|
44
|
-
# The remote files recovered from the target
|
45
|
-
has 0..n, :remote_files
|
46
|
-
|
47
46
|
# Validates the uniqueness of the address and the campaign.
|
48
47
|
validates_uniqueness_of :address, :scope => [:campaign]
|
49
48
|
|
data/lib/ronin/tcp_port.rb
CHANGED
@@ -21,6 +21,9 @@ require 'ronin/port'
|
|
21
21
|
require 'ronin/url'
|
22
22
|
|
23
23
|
module Ronin
|
24
|
+
#
|
25
|
+
# Represents a TCP {Port}.
|
26
|
+
#
|
24
27
|
class TCPPort < Port
|
25
28
|
|
26
29
|
# The URLs that use the port
|
@@ -30,7 +33,7 @@ module Ronin
|
|
30
33
|
# Creates a new {TCPPort} resource.
|
31
34
|
#
|
32
35
|
# @param [Hash] attributes
|
33
|
-
# The attribute names and values to initialize the
|
36
|
+
# The attribute names and values to initialize the TCP port with.
|
34
37
|
#
|
35
38
|
def initialize(attributes={})
|
36
39
|
super(attributes.merge(:protocol => 'tcp'))
|
data/lib/ronin/udp_port.rb
CHANGED
@@ -20,13 +20,16 @@
|
|
20
20
|
require 'ronin/port'
|
21
21
|
|
22
22
|
module Ronin
|
23
|
+
#
|
24
|
+
# Represents a UDP {Port}.
|
25
|
+
#
|
23
26
|
class UDPPort < Port
|
24
27
|
|
25
28
|
#
|
26
29
|
# Creates a new {UDPPort} resource.
|
27
30
|
#
|
28
31
|
# @param [Hash] attributes
|
29
|
-
# The attribute names and values to initialize the
|
32
|
+
# The attribute names and values to initialize the UDP port with.
|
30
33
|
#
|
31
34
|
def initialize(attributes={})
|
32
35
|
super(attributes.merge(:protocol => 'udp'))
|
data/lib/ronin/ui/cli/cli.rb
CHANGED
@@ -24,7 +24,7 @@ require 'ronin/installation'
|
|
24
24
|
module Ronin
|
25
25
|
module UI
|
26
26
|
#
|
27
|
-
# The {CLI} provides an
|
27
|
+
# The {CLI} provides an extensible Command Line Interface (CLI)
|
28
28
|
# for Ronin. The {CLI} can load any sub-command using the
|
29
29
|
# {command} method, from the `ronin/ui/cli/commands`
|
30
30
|
# directory.
|
data/lib/ronin/ui/cli/command.rb
CHANGED
@@ -117,6 +117,12 @@ module Ronin
|
|
117
117
|
class_option :color, :type => :boolean, :default => true
|
118
118
|
class_option :no_color, :type => :boolean, :default => false
|
119
119
|
|
120
|
+
#
|
121
|
+
# Sets the namespace of a new {Command} class.
|
122
|
+
#
|
123
|
+
# @param [Class] super_class
|
124
|
+
# The new {Command} class.
|
125
|
+
#
|
120
126
|
def self.inherited(super_class)
|
121
127
|
super_class.namespace(super_class.command_name)
|
122
128
|
end
|
@@ -53,6 +53,9 @@ module Ronin
|
|
53
53
|
|
54
54
|
argument :name, :type => :string, :required => false
|
55
55
|
|
56
|
+
#
|
57
|
+
# Executes the command.
|
58
|
+
#
|
56
59
|
def execute
|
57
60
|
Database.setup
|
58
61
|
|
@@ -71,6 +74,12 @@ module Ronin
|
|
71
74
|
|
72
75
|
protected
|
73
76
|
|
77
|
+
#
|
78
|
+
# The selected SCM.
|
79
|
+
#
|
80
|
+
# @return [Symbol]
|
81
|
+
# The name of the selected SCM.
|
82
|
+
#
|
74
83
|
def scm
|
75
84
|
@scm ||= if options[:scm]
|
76
85
|
options[:scm].to_sym
|
@@ -106,6 +115,9 @@ module Ronin
|
|
106
115
|
end
|
107
116
|
end
|
108
117
|
|
118
|
+
#
|
119
|
+
# Lists installed or added Repositories.
|
120
|
+
#
|
109
121
|
def list
|
110
122
|
unless name
|
111
123
|
print_array Repository.all
|
@@ -177,6 +189,12 @@ module Ronin
|
|
177
189
|
end
|
178
190
|
end
|
179
191
|
|
192
|
+
#
|
193
|
+
# Adds a Repository.
|
194
|
+
#
|
195
|
+
# @param [String] path
|
196
|
+
# The path of the local repository.
|
197
|
+
#
|
180
198
|
def add(path)
|
181
199
|
repo = begin
|
182
200
|
Repository.add!(:path => path, :scm => @scm)
|
@@ -188,6 +206,12 @@ module Ronin
|
|
188
206
|
print_info "Repository #{repo} added."
|
189
207
|
end
|
190
208
|
|
209
|
+
#
|
210
|
+
# Installs a Repository.
|
211
|
+
#
|
212
|
+
# @param [String, URI] uri
|
213
|
+
# The URI of the remote repository.
|
214
|
+
#
|
191
215
|
def install(uri)
|
192
216
|
repo = begin
|
193
217
|
Repository.install!(:uri => uri, :scm => scm)
|
@@ -200,6 +224,9 @@ module Ronin
|
|
200
224
|
print_info "Repository #{repo} has been installed."
|
201
225
|
end
|
202
226
|
|
227
|
+
#
|
228
|
+
# Updates installed Repositories.
|
229
|
+
#
|
203
230
|
def update
|
204
231
|
repos = if name
|
205
232
|
begin
|
@@ -222,6 +249,12 @@ module Ronin
|
|
222
249
|
end
|
223
250
|
end
|
224
251
|
|
252
|
+
#
|
253
|
+
# Uninstalls a Repository.
|
254
|
+
#
|
255
|
+
# @param [String] name
|
256
|
+
# The name of the repository.
|
257
|
+
#
|
225
258
|
def uninstall(name)
|
226
259
|
repo = Repository.uninstall!(name)
|
227
260
|
|
data/lib/ronin/ui/console.rb
CHANGED
@@ -29,6 +29,10 @@ require 'ripl/auto_indent'
|
|
29
29
|
|
30
30
|
module Ronin
|
31
31
|
module UI
|
32
|
+
#
|
33
|
+
# An interactive Ruby {Console} using
|
34
|
+
# [Ripl](https://github.com/cldwalker/ripl).
|
35
|
+
#
|
32
36
|
class Console
|
33
37
|
|
34
38
|
# The history file for the Console session
|
@@ -67,7 +71,7 @@ module Ronin
|
|
67
71
|
end
|
68
72
|
|
69
73
|
#
|
70
|
-
# Determines
|
74
|
+
# Determines whether one-line errors will be printed, instead of full
|
71
75
|
# backtraces.
|
72
76
|
#
|
73
77
|
# @return [Boolean]
|
@@ -22,6 +22,9 @@ require 'ronin/ui/output/output'
|
|
22
22
|
module Ronin
|
23
23
|
module UI
|
24
24
|
module Output
|
25
|
+
#
|
26
|
+
# Helper methods for printing output.
|
27
|
+
#
|
25
28
|
module Helpers
|
26
29
|
#
|
27
30
|
# Writes data unless output has been silenced.
|
@@ -30,7 +33,7 @@ module Ronin
|
|
30
33
|
# The data to write.
|
31
34
|
#
|
32
35
|
# @return [Integer, nil]
|
33
|
-
# The number of bytes
|
36
|
+
# The number of bytes written.
|
34
37
|
#
|
35
38
|
# @since 1.0.0
|
36
39
|
#
|
@@ -101,22 +104,25 @@ module Ronin
|
|
101
104
|
end
|
102
105
|
|
103
106
|
#
|
104
|
-
# Prints
|
107
|
+
# Prints an `info` message.
|
105
108
|
#
|
106
|
-
# @param [Array]
|
107
|
-
# The
|
109
|
+
# @param [Array] message
|
110
|
+
# The message to print.
|
108
111
|
#
|
109
112
|
# @return [Boolean]
|
110
113
|
# Specifies whether the messages were successfully printed.
|
111
114
|
#
|
112
115
|
# @example
|
113
|
-
# print_info
|
116
|
+
# print_info "Connecting ..."
|
117
|
+
#
|
118
|
+
# @example Print a formatted message.
|
119
|
+
# print_info "Connected to %s", host
|
114
120
|
#
|
115
121
|
# @since 0.3.0
|
116
122
|
#
|
117
|
-
def print_info(*
|
123
|
+
def print_info(*message)
|
118
124
|
unless Output.silent?
|
119
|
-
Output.handler.print_info(
|
125
|
+
Output.handler.print_info(format_message(message))
|
120
126
|
return true
|
121
127
|
end
|
122
128
|
|
@@ -124,22 +130,22 @@ module Ronin
|
|
124
130
|
end
|
125
131
|
|
126
132
|
#
|
127
|
-
# Prints
|
133
|
+
# Prints a `debug` message.
|
128
134
|
#
|
129
|
-
# @param [Array]
|
130
|
-
# The
|
135
|
+
# @param [Array, String] message
|
136
|
+
# The message to print.
|
131
137
|
#
|
132
138
|
# @return [Boolean]
|
133
139
|
# Specifies whether the messages were successfully printed.
|
134
140
|
#
|
135
|
-
# @example
|
136
|
-
# print_debug "
|
141
|
+
# @example Print a formatted message.
|
142
|
+
# print_debug "vars: %p %p", vars[0], vars[1]
|
137
143
|
#
|
138
144
|
# @since 0.3.0
|
139
145
|
#
|
140
|
-
def print_debug(*
|
146
|
+
def print_debug(*message)
|
141
147
|
if (Output.verbose? && !(Output.silent?))
|
142
|
-
Output.handler.print_debug(
|
148
|
+
Output.handler.print_debug(format_message(message))
|
143
149
|
return true
|
144
150
|
end
|
145
151
|
|
@@ -147,22 +153,25 @@ module Ronin
|
|
147
153
|
end
|
148
154
|
|
149
155
|
#
|
150
|
-
# Prints
|
156
|
+
# Prints a `warning` message.
|
151
157
|
#
|
152
|
-
# @param [Array]
|
153
|
-
# The
|
158
|
+
# @param [Array, String] message
|
159
|
+
# The message to print.
|
154
160
|
#
|
155
161
|
# @return [Boolean]
|
156
162
|
# Specifies whether the messages were successfully printed.
|
157
163
|
#
|
158
164
|
# @example
|
159
|
-
# print_warning
|
165
|
+
# print_warning "Detecting a restricted character in the buffer"
|
166
|
+
#
|
167
|
+
# @example Print a formatted message.
|
168
|
+
# print_warning "Malformed input detected: %p", user_input
|
160
169
|
#
|
161
170
|
# @since 0.3.0
|
162
171
|
#
|
163
|
-
def print_warning(*
|
172
|
+
def print_warning(*message)
|
164
173
|
if (Output.verbose? && !(Output.silent?))
|
165
|
-
Output.handler.print_warning(
|
174
|
+
Output.handler.print_warning(format_message(message))
|
166
175
|
return true
|
167
176
|
end
|
168
177
|
|
@@ -170,27 +179,51 @@ module Ronin
|
|
170
179
|
end
|
171
180
|
|
172
181
|
#
|
173
|
-
# Prints
|
182
|
+
# Prints an `error` message.
|
174
183
|
#
|
175
|
-
# @param [Array]
|
176
|
-
# The
|
184
|
+
# @param [Array, String] message
|
185
|
+
# The message to print.
|
177
186
|
#
|
178
187
|
# @return [Boolean]
|
179
188
|
# Specifies whether the messages were successfully printed.
|
180
189
|
#
|
181
190
|
# @example
|
182
|
-
# print_error
|
191
|
+
# print_error "Could not connect!"
|
192
|
+
#
|
193
|
+
# @example Print a formatted message.
|
194
|
+
# print_error "%p: %s", error.class, error.message
|
183
195
|
#
|
184
196
|
# @since 0.3.0
|
185
197
|
#
|
186
|
-
def print_error(*
|
198
|
+
def print_error(*message)
|
187
199
|
unless Output.silent?
|
188
|
-
Output.handler.print_error(
|
200
|
+
Output.handler.print_error(format_message(message))
|
189
201
|
return true
|
190
202
|
end
|
191
203
|
|
192
204
|
return false
|
193
205
|
end
|
206
|
+
|
207
|
+
protected
|
208
|
+
|
209
|
+
#
|
210
|
+
# Formats a message to be printed.
|
211
|
+
#
|
212
|
+
# @param [Array] message
|
213
|
+
# The message and additional Objects to format.
|
214
|
+
#
|
215
|
+
# @return [String]
|
216
|
+
# The formatted message.
|
217
|
+
#
|
218
|
+
# @since 1.0.0
|
219
|
+
#
|
220
|
+
def format_message(message)
|
221
|
+
if message.length == 1
|
222
|
+
message[0]
|
223
|
+
else
|
224
|
+
message[0] % message[1..-1]
|
225
|
+
end
|
226
|
+
end
|
194
227
|
end
|
195
228
|
end
|
196
229
|
end
|