ronin 1.4.1 → 1.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +1 -0
- data/.gitignore +1 -0
- data/ChangeLog.md +38 -1
- data/Gemfile +10 -10
- data/README.md +1 -1
- data/Rakefile +13 -2
- data/bin/ronin-net-proxy +25 -0
- data/gemspec.yml +21 -2
- data/lib/bond/completions/ronin.rb +16 -5
- data/lib/ronin/arch.rb +5 -5
- data/lib/ronin/auto_load.rb +22 -1
- data/lib/ronin/campaign.rb +1 -1
- data/lib/ronin/database/database.rb +36 -25
- data/lib/ronin/installation.rb +2 -2
- data/lib/ronin/model/model.rb +5 -6
- data/lib/ronin/model/types/description.rb +0 -3
- data/lib/ronin/os.rb +2 -2
- data/lib/ronin/password.rb +1 -1
- data/lib/ronin/repository.rb +6 -6
- data/lib/ronin/script/path.rb +1 -2
- data/lib/ronin/spec/database.rb +16 -4
- data/lib/ronin/ui/cli/cli.rb +1 -1
- data/lib/ronin/ui/cli/command.rb +50 -7
- data/lib/ronin/ui/cli/commands/console.rb +15 -6
- data/lib/ronin/ui/cli/commands/creds.rb +1 -1
- data/lib/ronin/ui/cli/commands/database.rb +41 -29
- data/lib/ronin/ui/cli/commands/emails.rb +20 -15
- data/lib/ronin/ui/cli/commands/help.rb +18 -5
- data/lib/ronin/ui/cli/commands/hosts.rb +34 -27
- data/lib/ronin/ui/cli/commands/install.rb +21 -4
- data/lib/ronin/ui/cli/commands/ips.rb +34 -23
- data/lib/ronin/ui/cli/commands/net/proxy.rb +403 -0
- data/lib/ronin/ui/cli/commands/repos.rb +4 -4
- data/lib/ronin/ui/cli/commands/uninstall.rb +10 -0
- data/lib/ronin/ui/cli/commands/update.rb +11 -1
- data/lib/ronin/ui/cli/commands/urls.rb +39 -30
- data/lib/ronin/ui/cli/commands/wordlist.rb +11 -1
- data/lib/ronin/ui/console.rb +1 -0
- data/lib/ronin/ui/console/commands.rb +16 -98
- data/lib/ronin/ui/console/shell.rb +184 -0
- data/lib/ronin/url.rb +3 -3
- data/lib/ronin/url_scheme.rb +3 -3
- data/lib/ronin/version.rb +1 -1
- data/man/ronin-campaigns.1.md +78 -0
- data/man/ronin-console.1.md +72 -0
- data/man/ronin-creds.1.md +66 -0
- data/man/ronin-database.1.md +82 -0
- data/man/ronin-emails.1.md +72 -0
- data/man/ronin-exec.1.md +49 -0
- data/man/ronin-help.1.md +34 -0
- data/man/ronin-hosts.1.md +78 -0
- data/man/ronin-install.1.md +79 -0
- data/man/ronin-ips.1.md +81 -0
- data/man/ronin-net-proxy.1.md +86 -0
- data/man/ronin-repos.1.md +77 -0
- data/man/ronin-uninstall.1.md +67 -0
- data/man/ronin-update.1.md +67 -0
- data/man/ronin-urls.1.md +84 -0
- data/man/ronin-wordlist.1.md +53 -0
- data/man/ronin.1.md +26 -0
- data/ronin.gemspec +38 -109
- data/spec/installation_spec.rb +2 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/ui/cli/classes/test_command.rb +7 -0
- data/spec/ui/cli/command_spec.rb +235 -7
- metadata +217 -96
data/lib/ronin/installation.rb
CHANGED
@@ -77,8 +77,8 @@ module Ronin
|
|
77
77
|
# Enumerates over all files within a given directory found in any
|
78
78
|
# of the installed Ronin libraries.
|
79
79
|
#
|
80
|
-
# @param [String]
|
81
|
-
# The
|
80
|
+
# @param [String] pattern
|
81
|
+
# The glob pattern to search for.
|
82
82
|
#
|
83
83
|
# @yield [file]
|
84
84
|
# The given block will be passed each file found within the directory.
|
data/lib/ronin/model/model.rb
CHANGED
@@ -18,7 +18,6 @@
|
|
18
18
|
#
|
19
19
|
|
20
20
|
require 'ronin/model/types'
|
21
|
-
require 'ronin/support/inflector'
|
22
21
|
|
23
22
|
require 'dm-core'
|
24
23
|
require 'dm-types'
|
@@ -75,9 +74,9 @@ module Ronin
|
|
75
74
|
# @api semipublic
|
76
75
|
#
|
77
76
|
def relationship_name
|
78
|
-
|
79
|
-
|
80
|
-
|
77
|
+
DataMapper::Inflector.pluralize(
|
78
|
+
DataMapper::Inflector.underscore(self.name.split('::').last)
|
79
|
+
).to_sym
|
81
80
|
end
|
82
81
|
|
83
82
|
#
|
@@ -133,7 +132,7 @@ module Ronin
|
|
133
132
|
if value.kind_of?(Array)
|
134
133
|
value.map(&formatter).join(', ')
|
135
134
|
elsif value.kind_of?(Symbol)
|
136
|
-
|
135
|
+
DataMapper::Inflector.humanize(value)
|
137
136
|
else
|
138
137
|
value.to_s
|
139
138
|
end
|
@@ -148,7 +147,7 @@ module Ronin
|
|
148
147
|
name = name.to_s
|
149
148
|
|
150
149
|
unless name[-3..-1] == '_id'
|
151
|
-
name =
|
150
|
+
name = DataMapper::Inflector.humanize(name)
|
152
151
|
value = formatter.call(value)
|
153
152
|
|
154
153
|
if block_given?
|
data/lib/ronin/os.rb
CHANGED
@@ -96,8 +96,8 @@ module Ronin
|
|
96
96
|
# @param [Symbol, String] name
|
97
97
|
# The method name to define for the predefined OS.
|
98
98
|
#
|
99
|
-
# @param [
|
100
|
-
#
|
99
|
+
# @param [Hash{Symbol => Object}] attributes
|
100
|
+
# Additional attributes for the OS.
|
101
101
|
#
|
102
102
|
# @return [nil]
|
103
103
|
#
|
data/lib/ronin/password.rb
CHANGED
data/lib/ronin/repository.rb
CHANGED
@@ -126,10 +126,10 @@ module Ronin
|
|
126
126
|
# @param [Hash] attributes
|
127
127
|
# The attributes of the repository.
|
128
128
|
#
|
129
|
-
# @
|
129
|
+
# @option attributes [String] :path
|
130
130
|
# The path to the repository.
|
131
131
|
#
|
132
|
-
# @
|
132
|
+
# @option attributes [Symbol] :scm
|
133
133
|
# The SCM used by the repository. Can be either:
|
134
134
|
#
|
135
135
|
# * `:git`
|
@@ -137,7 +137,7 @@ module Ronin
|
|
137
137
|
# * `:sub_version` / `:svn`
|
138
138
|
# * `:rsync`
|
139
139
|
#
|
140
|
-
# @
|
140
|
+
# @option attributes [String, URI] :uri
|
141
141
|
# The URI the repository resides at.
|
142
142
|
#
|
143
143
|
# @yield [repo]
|
@@ -393,10 +393,10 @@ module Ronin
|
|
393
393
|
end
|
394
394
|
|
395
395
|
#
|
396
|
-
#
|
396
|
+
# Deactivates all installed or added repositories.
|
397
397
|
#
|
398
398
|
# @return [Array<Repository>]
|
399
|
-
# The
|
399
|
+
# The deactivated repositories.
|
400
400
|
#
|
401
401
|
# @see #deactivate!
|
402
402
|
#
|
@@ -520,7 +520,7 @@ module Ronin
|
|
520
520
|
end
|
521
521
|
|
522
522
|
#
|
523
|
-
#
|
523
|
+
# Deactivates the repository by removing the {#lib_dir} from the
|
524
524
|
# `$LOAD_PATH` global variable.
|
525
525
|
#
|
526
526
|
# @api private
|
data/lib/ronin/script/path.rb
CHANGED
@@ -19,7 +19,6 @@
|
|
19
19
|
|
20
20
|
require 'ronin/model'
|
21
21
|
require 'ronin/script/script'
|
22
|
-
require 'ronin/support/inflector'
|
23
22
|
|
24
23
|
require 'object_loader'
|
25
24
|
|
@@ -66,7 +65,7 @@ module Ronin
|
|
66
65
|
#
|
67
66
|
def class_path
|
68
67
|
if self.class_name
|
69
|
-
|
68
|
+
DataMapper::Inflector.underscore(self.class_name)
|
70
69
|
end
|
71
70
|
end
|
72
71
|
|
data/lib/ronin/spec/database.rb
CHANGED
@@ -24,13 +24,25 @@ require 'tempfile'
|
|
24
24
|
|
25
25
|
RSpec.configure do |spec|
|
26
26
|
spec.before(:suite) do
|
27
|
-
|
28
|
-
|
27
|
+
defaults = {
|
28
|
+
:user => 'ronin_test',
|
29
|
+
:password => 'ronin_test',
|
30
|
+
:database => 'ronin_test'
|
31
|
+
}
|
32
|
+
adapter = ENV.fetch('ADAPTER','sqlite3')
|
29
33
|
|
30
|
-
|
34
|
+
uri = case adapter
|
35
|
+
when 'sqlite3', 'sqlite'
|
36
|
+
{
|
37
|
+
:adapter => 'sqlite3',
|
38
|
+
:database => Tempfile.new('ronin_database').path
|
39
|
+
}
|
40
|
+
else
|
41
|
+
defaults.merge(:adapter => adapter)
|
42
|
+
end
|
31
43
|
|
32
44
|
# setup the database
|
33
|
-
Ronin::Database.setup
|
45
|
+
Ronin::Database.setup(uri)
|
34
46
|
|
35
47
|
# auto-migrate any models defined in the specs
|
36
48
|
DataMapper.finalize.auto_migrate!
|
data/lib/ronin/ui/cli/cli.rb
CHANGED
@@ -51,7 +51,7 @@ module Ronin
|
|
51
51
|
if @commands.empty?
|
52
52
|
commands_dir = File.join('lib',Commands.namespace_root)
|
53
53
|
|
54
|
-
Installation.each_file_in(commands_dir
|
54
|
+
Installation.each_file_in(commands_dir,'rb') do |path|
|
55
55
|
# remove the .rb file extension
|
56
56
|
name = path.chomp('.rb')
|
57
57
|
|
data/lib/ronin/ui/cli/command.rb
CHANGED
@@ -185,9 +185,7 @@ module Ronin
|
|
185
185
|
# @api public
|
186
186
|
#
|
187
187
|
def self.run(options={})
|
188
|
-
|
189
|
-
|
190
|
-
return command.run(options)
|
188
|
+
new().run(options)
|
191
189
|
end
|
192
190
|
|
193
191
|
#
|
@@ -263,7 +261,10 @@ module Ronin
|
|
263
261
|
|
264
262
|
setup
|
265
263
|
execute
|
264
|
+
|
266
265
|
return true
|
266
|
+
ensure
|
267
|
+
cleanup
|
267
268
|
end
|
268
269
|
|
269
270
|
#
|
@@ -293,6 +294,16 @@ module Ronin
|
|
293
294
|
def execute
|
294
295
|
end
|
295
296
|
|
297
|
+
#
|
298
|
+
# Default method to call after the command has finished.
|
299
|
+
#
|
300
|
+
# @since 1.5.0
|
301
|
+
#
|
302
|
+
# @api semipublic
|
303
|
+
#
|
304
|
+
def cleanup
|
305
|
+
end
|
306
|
+
|
296
307
|
protected
|
297
308
|
|
298
309
|
#
|
@@ -343,6 +354,31 @@ module Ronin
|
|
343
354
|
end
|
344
355
|
end
|
345
356
|
|
357
|
+
#
|
358
|
+
# Example usages for the command.
|
359
|
+
#
|
360
|
+
# @param [Array<String>] new_examples
|
361
|
+
# The new examples for the command.
|
362
|
+
#
|
363
|
+
# @return [Array]
|
364
|
+
# Example commands.
|
365
|
+
#
|
366
|
+
# @since 1.5.0
|
367
|
+
#
|
368
|
+
# @api semipublic
|
369
|
+
#
|
370
|
+
def self.examples(new_examples=nil)
|
371
|
+
if new_examples
|
372
|
+
@examples = new_examples
|
373
|
+
else
|
374
|
+
@examples ||= if superclass < Command
|
375
|
+
superclass.examples.dup
|
376
|
+
else
|
377
|
+
[]
|
378
|
+
end
|
379
|
+
end
|
380
|
+
end
|
381
|
+
|
346
382
|
#
|
347
383
|
# The options for the parameters.
|
348
384
|
#
|
@@ -366,7 +402,7 @@ module Ronin
|
|
366
402
|
# @param [Hash] options
|
367
403
|
# Additional options for the option.
|
368
404
|
#
|
369
|
-
# @option options [Hash{Class => Class}, Set<Class>, Array<Class>, Class, true] :type
|
405
|
+
# @option options [Hash{Class => Class}, Set<Class>, Array<Class>, Class, true] :type
|
370
406
|
# The type of the options.
|
371
407
|
#
|
372
408
|
# @option options [Object, Proc] :default
|
@@ -395,8 +431,6 @@ module Ronin
|
|
395
431
|
# @api semipublic
|
396
432
|
#
|
397
433
|
def self.option(name,options={})
|
398
|
-
options = {:type => String}.merge(options)
|
399
|
-
|
400
434
|
self.options[name] = {
|
401
435
|
:flag => options[:flag],
|
402
436
|
:usage => options[:usage],
|
@@ -417,7 +451,7 @@ module Ronin
|
|
417
451
|
:description => 'Silence all output'
|
418
452
|
|
419
453
|
option :color, :type => true,
|
420
|
-
:default => proc {
|
454
|
+
:default => proc { $stdout.tty? },
|
421
455
|
:description => 'Enables color output'
|
422
456
|
|
423
457
|
#
|
@@ -598,6 +632,15 @@ module Ronin
|
|
598
632
|
end
|
599
633
|
end
|
600
634
|
|
635
|
+
unless self.class.examples.empty?
|
636
|
+
opts.separator ''
|
637
|
+
opts.separator 'Examples:'
|
638
|
+
|
639
|
+
self.class.examples.each do |example|
|
640
|
+
opts.separator " #{example}"
|
641
|
+
end
|
642
|
+
end
|
643
|
+
|
601
644
|
if self.class.summary
|
602
645
|
opts.separator ''
|
603
646
|
opts.separator self.class.summary
|
@@ -68,13 +68,12 @@ module Ronin
|
|
68
68
|
:description => 'Print the Ronin version'
|
69
69
|
|
70
70
|
#
|
71
|
-
#
|
71
|
+
# Sets up the Ronin Console.
|
72
72
|
#
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
73
|
+
# @since 1.5.0
|
74
|
+
#
|
75
|
+
def setup
|
76
|
+
super
|
78
77
|
|
79
78
|
UI::Console.color = color?
|
80
79
|
UI::Console.short_errors = !backtrace?
|
@@ -86,6 +85,16 @@ module Ronin
|
|
86
85
|
if database?
|
87
86
|
Database.repositories[:default] = @database
|
88
87
|
end
|
88
|
+
end
|
89
|
+
|
90
|
+
#
|
91
|
+
# Starts the Ronin Console.
|
92
|
+
#
|
93
|
+
def execute
|
94
|
+
if version?
|
95
|
+
puts "ronin #{Ronin::VERSION}"
|
96
|
+
return
|
97
|
+
end
|
89
98
|
|
90
99
|
UI::Console.start
|
91
100
|
end
|
@@ -56,44 +56,56 @@ module Ronin
|
|
56
56
|
|
57
57
|
summary 'Manages the Ronin Database'
|
58
58
|
|
59
|
-
option :add, :type
|
60
|
-
:flag
|
61
|
-
:usage
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
:
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
59
|
+
option :add, :type => Symbol,
|
60
|
+
:flag => '-a',
|
61
|
+
:usage => 'NAME',
|
62
|
+
:description => 'Adds a Database Repository'
|
63
|
+
|
64
|
+
option :set, :type => Symbol,
|
65
|
+
:flag => '-s',
|
66
|
+
:usage => 'NAME',
|
67
|
+
:description => 'Sets the information for a Database Repository'
|
68
|
+
|
69
|
+
option :remove, :type => Symbol,
|
70
|
+
:flag => '-r',
|
71
|
+
:usage => 'NAME',
|
72
|
+
:description => 'Removes a Database Repository'
|
73
|
+
|
74
|
+
option :clear, :type => Symbol,
|
75
|
+
:flag => '-C',
|
76
|
+
:usage => 'NAME',
|
77
|
+
:description => 'WARNING: Clears a Database Repository'
|
74
78
|
|
75
79
|
# repository options
|
76
|
-
option :uri, :type
|
77
|
-
:usage
|
80
|
+
option :uri, :type => String,
|
81
|
+
:usage => 'sqlite3:///path',
|
82
|
+
:description => 'The URI for the Database Repository'
|
78
83
|
|
79
|
-
option :adapter, :type
|
80
|
-
:usage
|
84
|
+
option :adapter, :type => String,
|
85
|
+
:usage => 'sqlite3|mysql|postgres',
|
86
|
+
:description => 'The Database Adapter'
|
81
87
|
|
82
|
-
option :host, :type
|
83
|
-
:usage
|
88
|
+
option :host, :type => String,
|
89
|
+
:usage => 'HOST',
|
90
|
+
:description => 'The host running the Database'
|
84
91
|
|
85
|
-
option :port, :type
|
86
|
-
:usage
|
92
|
+
option :port, :type => Integer,
|
93
|
+
:usage => 'PORT',
|
94
|
+
:description => 'The port the Database is listening on'
|
87
95
|
|
88
|
-
option :user, :type
|
96
|
+
option :user, :type => String,
|
97
|
+
:description => 'User to authenticate with'
|
89
98
|
|
90
|
-
option :password, :type
|
99
|
+
option :password, :type => String,
|
100
|
+
:description => 'Password to authenticate with'
|
91
101
|
|
92
|
-
option :database, :type
|
93
|
-
:usage
|
102
|
+
option :database, :type => String,
|
103
|
+
:usage => 'NAME',
|
104
|
+
:description => 'Database name'
|
94
105
|
|
95
|
-
option :path, :type
|
96
|
-
:usage
|
106
|
+
option :path, :type => String,
|
107
|
+
:usage => 'PATH',
|
108
|
+
:description => 'Path to the Database file.'
|
97
109
|
|
98
110
|
#
|
99
111
|
# Displays or modifies the Ronin Database configuration.
|
@@ -54,25 +54,30 @@ module Ronin
|
|
54
54
|
|
55
55
|
summary 'Manages EmailAddresses'
|
56
56
|
|
57
|
-
query_option :with_hosts, :type
|
58
|
-
:flag
|
59
|
-
:usage
|
57
|
+
query_option :with_hosts, :type => Array,
|
58
|
+
:flag => '-H',
|
59
|
+
:usage => 'HOST [...]',
|
60
|
+
:description => 'Searches for the associated HOST(s)'
|
60
61
|
|
61
|
-
query_option :with_ips, :type
|
62
|
-
:flag
|
63
|
-
:usage
|
62
|
+
query_option :with_ips, :type => Array,
|
63
|
+
:flag => '-I',
|
64
|
+
:usage => 'IP [...]',
|
65
|
+
:description => 'Searches for the associated IP(s)'
|
64
66
|
|
65
|
-
query_option :with_users, :type
|
66
|
-
:flag
|
67
|
-
:usage
|
67
|
+
query_option :with_users, :type => Array,
|
68
|
+
:flag => '-u',
|
69
|
+
:usage => 'NAME [...]',
|
70
|
+
:description => 'Searches for the associated UserName(s)'
|
68
71
|
|
69
|
-
option :list, :type
|
70
|
-
:default
|
71
|
-
:flag
|
72
|
+
option :list, :type => true,
|
73
|
+
:default => true,
|
74
|
+
:flag => '-l',
|
75
|
+
:description => 'Lists the EmailAddresses'
|
72
76
|
|
73
|
-
option :import, :type
|
74
|
-
:flag
|
75
|
-
:usage
|
77
|
+
option :import, :type => String,
|
78
|
+
:flag => '-i',
|
79
|
+
:usage => 'FILE',
|
80
|
+
:description => 'Imports EmailAddresses from the FILE'
|
76
81
|
|
77
82
|
end
|
78
83
|
end
|