ronin 1.3.0 → 1.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +51 -1
- data/Gemfile +1 -1
- data/README.md +36 -41
- data/bin/ronin-install +25 -0
- data/bin/ronin-uninstall +25 -0
- data/bin/ronin-update +25 -0
- data/gemspec.yml +4 -4
- data/lib/bond/completions/ronin.rb +6 -5
- data/lib/ronin/address.rb +0 -2
- data/lib/ronin/auto_load.rb +4 -5
- data/lib/ronin/campaign.rb +1 -0
- data/lib/ronin/credential.rb +6 -5
- data/lib/ronin/database/database.rb +1 -0
- data/lib/ronin/email_address.rb +28 -3
- data/lib/ronin/environment.rb +3 -6
- data/lib/ronin/host_name.rb +1 -3
- data/lib/ronin/host_name_ip_address.rb +0 -2
- data/lib/ronin/ip_address.rb +1 -4
- data/lib/ronin/ip_address_mac_address.rb +0 -2
- data/lib/ronin/mac_address.rb +0 -2
- data/lib/ronin/model/has_unique_name.rb +17 -0
- data/lib/ronin/open_port.rb +0 -4
- data/lib/ronin/organization.rb +0 -1
- data/lib/ronin/os.rb +0 -2
- data/lib/ronin/os_guess.rb +0 -2
- data/lib/ronin/password.rb +17 -1
- data/lib/ronin/port.rb +34 -1
- data/lib/ronin/repository.rb +31 -25
- data/lib/ronin/script/buildable.rb +19 -4
- data/lib/ronin/script/deployable.rb +7 -8
- data/lib/ronin/script/exceptions.rb +1 -0
- data/lib/ronin/script/exceptions/build_failed.rb +27 -0
- data/lib/ronin/script/path.rb +28 -11
- data/lib/ronin/script/script.rb +17 -14
- data/lib/ronin/script/testable.rb +3 -3
- data/lib/ronin/service.rb +0 -1
- data/lib/ronin/service_credential.rb +0 -1
- data/lib/ronin/software.rb +0 -1
- data/lib/ronin/target.rb +0 -2
- data/lib/ronin/tcp_port.rb +0 -1
- data/lib/ronin/ui/cli/class_command.rb +130 -0
- data/lib/ronin/ui/cli/command.rb +344 -159
- data/lib/ronin/ui/cli/commands/campaigns.rb +39 -29
- data/lib/ronin/ui/cli/commands/console.rb +24 -15
- data/lib/ronin/ui/cli/commands/creds.rb +14 -12
- data/lib/ronin/ui/cli/commands/database.rb +63 -46
- data/lib/ronin/ui/cli/commands/emails.rb +15 -15
- data/lib/ronin/ui/cli/commands/help.rb +6 -5
- data/lib/ronin/ui/cli/commands/hosts.rb +24 -24
- data/lib/ronin/ui/cli/commands/install.rb +104 -0
- data/lib/ronin/ui/cli/commands/ips.rb +23 -23
- data/lib/ronin/ui/cli/commands/repos.rb +69 -182
- data/lib/ronin/ui/cli/commands/uninstall.rb +65 -0
- data/lib/ronin/ui/cli/commands/update.rb +100 -0
- data/lib/ronin/ui/cli/commands/urls.rb +24 -24
- data/lib/ronin/ui/cli/model_command.rb +8 -6
- data/lib/ronin/ui/cli/printing.rb +167 -0
- data/lib/ronin/ui/cli/resources_command.rb +21 -13
- data/lib/ronin/ui/cli/script_command.rb +126 -24
- data/lib/ronin/ui/console/commands.rb +4 -1
- data/lib/ronin/ui/console/console.rb +1 -1
- data/lib/ronin/ui/console/context.rb +1 -1
- data/lib/ronin/url.rb +24 -5
- data/lib/ronin/url_query_param.rb +0 -1
- data/lib/ronin/version.rb +1 -1
- data/lib/ronin/web_credential.rb +0 -5
- data/spec/email_address_spec.rb +17 -0
- data/spec/installation_spec.rb +24 -34
- data/spec/model/has_authors_spec.rb +1 -1
- data/spec/model/has_description_spec.rb +1 -1
- data/spec/model/has_license_spec.rb +1 -1
- data/spec/model/has_name_spec.rb +1 -1
- data/spec/model/has_title_spec.rb +1 -1
- data/spec/model/has_version_spec.rb +1 -1
- data/spec/model/model_spec.rb +1 -1
- data/spec/repository_spec.rb +9 -9
- data/spec/script/script_spec.rb +2 -4
- data/spec/spec_helper.rb +16 -0
- data/spec/ui/cli/classes/test_command.rb +7 -3
- data/spec/ui/cli/command_spec.rb +37 -5
- metadata +82 -73
- data/spec/model/spec_helper.rb +0 -20
@@ -31,29 +31,37 @@ module Ronin
|
|
31
31
|
|
32
32
|
model Campaign
|
33
33
|
|
34
|
-
query_option :named, :type =>
|
35
|
-
:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
34
|
+
query_option :named, :type => String,
|
35
|
+
:flag => '-n',
|
36
|
+
:description => 'Name to search for'
|
37
|
+
|
38
|
+
query_option :describing, :type => String,
|
39
|
+
:flag => '-d',
|
40
|
+
:description => 'Description to search for'
|
41
|
+
|
42
|
+
query_option :targeting, :type => Array,
|
43
|
+
:flag => '-T',
|
44
|
+
:usage => 'ADDR [...]',
|
45
|
+
:description => 'Addresses to search for'
|
46
|
+
|
47
|
+
query_option :targeting_orgs, :type => Array,
|
48
|
+
:flag => '-O',
|
49
|
+
:usage => 'NAME [...]',
|
50
|
+
:description => 'Orgs to search for'
|
51
|
+
|
52
|
+
option :list, :type => true,
|
53
|
+
:default => true,
|
54
|
+
:flag => '-l',
|
55
|
+
:description => 'List all Campaigns'
|
56
|
+
|
57
|
+
option :add, :type => String,
|
58
|
+
:flag => '-a',
|
59
|
+
:usage => 'NAME',
|
60
|
+
:description => 'Create a new Campaign'
|
61
|
+
|
62
|
+
option :targets, :type => Array,
|
63
|
+
:usage => 'ADDR [...]',
|
64
|
+
:description => 'Addresses to target'
|
57
65
|
|
58
66
|
#
|
59
67
|
# Queries the {Campaign} model.
|
@@ -61,9 +69,9 @@ module Ronin
|
|
61
69
|
# @since 1.0.0
|
62
70
|
#
|
63
71
|
def execute
|
64
|
-
if
|
65
|
-
add
|
66
|
-
elsif
|
72
|
+
if add?
|
73
|
+
add(@add)
|
74
|
+
elsif list?
|
67
75
|
super
|
68
76
|
end
|
69
77
|
end
|
@@ -81,8 +89,10 @@ module Ronin
|
|
81
89
|
def add(name)
|
82
90
|
campaign = Campaign.new(:name => name)
|
83
91
|
|
84
|
-
|
85
|
-
|
92
|
+
if targets?
|
93
|
+
# add targets to the campaign
|
94
|
+
@targets.each { |target| campaign.target!(target) }
|
95
|
+
end
|
86
96
|
|
87
97
|
if campaign.save
|
88
98
|
print_info "Added campaign #{campaign}"
|
@@ -100,7 +110,7 @@ module Ronin
|
|
100
110
|
# @since 1.0.0
|
101
111
|
#
|
102
112
|
def print_resource(campaign)
|
103
|
-
return super(campaign) unless
|
113
|
+
return super(campaign) unless verbose?
|
104
114
|
|
105
115
|
print_title campaign.name
|
106
116
|
|
@@ -32,34 +32,43 @@ module Ronin
|
|
32
32
|
#
|
33
33
|
class Console < Command
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
summary 'Start the Ronin Console'
|
36
|
+
|
37
|
+
option :database, :type => URI,
|
38
|
+
:flag => '-D',
|
39
|
+
:description => 'The database to URI'
|
40
|
+
|
41
|
+
option :require, :type => Array,
|
42
|
+
:default => [],
|
43
|
+
:flag => '-r',
|
44
|
+
:usage => 'PATH',
|
45
|
+
:description => 'Ruby files to require'
|
46
|
+
|
47
|
+
option :backtrace, :type => true,
|
48
|
+
:description => 'Enable long backtraces'
|
49
|
+
|
50
|
+
option :version, :type => true,
|
51
|
+
:flag => '-V',
|
52
|
+
:description => 'Print the Ronin version'
|
44
53
|
|
45
54
|
#
|
46
55
|
# Starts the Ronin Console.
|
47
56
|
#
|
48
57
|
def execute
|
49
|
-
if
|
58
|
+
if version?
|
50
59
|
puts "ronin #{Ronin::VERSION}"
|
51
60
|
return
|
52
61
|
end
|
53
62
|
|
54
|
-
UI::Console.color =
|
55
|
-
UI::Console.short_errors = !
|
63
|
+
UI::Console.color = color?
|
64
|
+
UI::Console.short_errors = !backtrace?
|
56
65
|
|
57
|
-
|
66
|
+
@require.each do |path|
|
58
67
|
UI::Console.auto_load << path
|
59
68
|
end
|
60
69
|
|
61
|
-
if
|
62
|
-
Database.repositories[:default] =
|
70
|
+
if database?
|
71
|
+
Database.repositories[:default] = @database
|
63
72
|
end
|
64
73
|
|
65
74
|
UI::Console.start
|
@@ -18,6 +18,7 @@
|
|
18
18
|
#
|
19
19
|
|
20
20
|
require 'ronin/ui/cli/resources_command'
|
21
|
+
|
21
22
|
require 'ronin/credential'
|
22
23
|
require 'ronin/service_credential'
|
23
24
|
require 'ronin/web_credential'
|
@@ -33,17 +34,20 @@ module Ronin
|
|
33
34
|
|
34
35
|
model Credential
|
35
36
|
|
36
|
-
query_option :for_user, :type
|
37
|
-
:
|
38
|
-
:
|
37
|
+
query_option :for_user, :type => String,
|
38
|
+
:flag => '-u',
|
39
|
+
:usage => 'USER',
|
40
|
+
:description => 'Username to search for'
|
39
41
|
|
40
|
-
query_option :with_password, :type
|
41
|
-
:
|
42
|
-
:
|
42
|
+
query_option :with_password, :type => String,
|
43
|
+
:flag => '-p',
|
44
|
+
:usage => 'PASS',
|
45
|
+
:description => 'Password to search for'
|
43
46
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
+
option :list, :type => true,
|
48
|
+
:default => true,
|
49
|
+
:flag => '-l',
|
50
|
+
:description => 'List all Credentials'
|
47
51
|
|
48
52
|
#
|
49
53
|
# Queries the {Credential} model.
|
@@ -51,9 +55,7 @@ module Ronin
|
|
51
55
|
# @since 1.0.0
|
52
56
|
#
|
53
57
|
def execute
|
54
|
-
if
|
55
|
-
super
|
56
|
-
end
|
58
|
+
super if list?
|
57
59
|
end
|
58
60
|
|
59
61
|
protected
|
@@ -31,43 +31,66 @@ module Ronin
|
|
31
31
|
#
|
32
32
|
class Database < Command
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
summary "Manages the Ronin Database"
|
35
|
+
|
36
|
+
option :add, :type => Symbol,
|
37
|
+
:flag => '-a',
|
38
|
+
:usage => 'NAME'
|
39
|
+
|
40
|
+
option :set, :type => Symbol,
|
41
|
+
:flag => '-s',
|
42
|
+
:usage => 'NAME'
|
43
|
+
|
44
|
+
option :remove, :type => Symbol,
|
45
|
+
:flag => '-r',
|
46
|
+
:usage => 'NAME'
|
47
|
+
|
48
|
+
option :clear, :type => Symbol,
|
49
|
+
:flag => '-C',
|
50
|
+
:usage => 'NAME'
|
39
51
|
|
40
52
|
# repository options
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
53
|
+
option :uri, :type => String,
|
54
|
+
:usage => 'sqlite3:///path'
|
55
|
+
|
56
|
+
option :adapter, :type => String,
|
57
|
+
:usage => 'DB'
|
58
|
+
|
59
|
+
option :host, :type => String,
|
60
|
+
:usage => 'HOST'
|
61
|
+
|
62
|
+
option :port, :type => Integer,
|
63
|
+
:usage => 'PORT'
|
64
|
+
|
65
|
+
option :user, :type => String
|
66
|
+
|
67
|
+
option :password, :type => String
|
68
|
+
|
69
|
+
option :database, :type => String,
|
70
|
+
:usage => 'NAME'
|
71
|
+
|
72
|
+
option :path, :type => String,
|
73
|
+
:usage => 'PATH'
|
49
74
|
|
50
75
|
#
|
51
76
|
# Displays or modifies the Ronin Database configuration.
|
52
77
|
#
|
53
78
|
def execute
|
54
|
-
if
|
55
|
-
|
56
|
-
|
57
|
-
print_info "Clearing the Database repository #{name} ..."
|
79
|
+
if clear?
|
80
|
+
print_info "Clearing the Database repository #{@clear} ..."
|
58
81
|
|
59
|
-
Ronin::Database.clear(
|
60
|
-
print_info "Database repository #{
|
82
|
+
Ronin::Database.clear(@clear) do
|
83
|
+
print_info "Database repository #{@clear} cleared."
|
61
84
|
end
|
62
85
|
|
63
86
|
return
|
64
87
|
end
|
65
88
|
|
66
|
-
if
|
89
|
+
if add?
|
67
90
|
add_repository
|
68
|
-
elsif
|
91
|
+
elsif set?
|
69
92
|
set_repository
|
70
|
-
elsif
|
93
|
+
elsif delete?
|
71
94
|
delete_repository
|
72
95
|
else
|
73
96
|
Ronin::Database.repositories.each do |name,uri|
|
@@ -85,16 +108,16 @@ module Ronin
|
|
85
108
|
# The repository URI.
|
86
109
|
#
|
87
110
|
def repository_uri
|
88
|
-
if
|
89
|
-
Addressable::URI.parse(
|
111
|
+
if uri?
|
112
|
+
Addressable::URI.parse(@uri).to_hash
|
90
113
|
else
|
91
114
|
{
|
92
|
-
:adapter
|
93
|
-
:host
|
94
|
-
:port
|
95
|
-
:user
|
96
|
-
:password =>
|
97
|
-
:database => (
|
115
|
+
:adapter => @adapter,
|
116
|
+
:host => @host,
|
117
|
+
:port => @port,
|
118
|
+
:user => @user,
|
119
|
+
:password => @password,
|
120
|
+
:database => (@database || @path)
|
98
121
|
}
|
99
122
|
end
|
100
123
|
end
|
@@ -103,49 +126,43 @@ module Ronin
|
|
103
126
|
# Adds a new Database repository.
|
104
127
|
#
|
105
128
|
def add_repository
|
106
|
-
name = options[:add].to_sym
|
107
|
-
|
108
129
|
Ronin::Database.save do
|
109
|
-
Ronin::Database.repositories[
|
130
|
+
Ronin::Database.repositories[@add] = repository_uri
|
110
131
|
end
|
111
132
|
|
112
|
-
print_info "Database repository #{
|
133
|
+
print_info "Database repository #{@add} added."
|
113
134
|
end
|
114
135
|
|
115
136
|
#
|
116
137
|
# Sets the URI for an existing Database repository.
|
117
138
|
#
|
118
139
|
def set_repository
|
119
|
-
|
120
|
-
|
121
|
-
unless Ronin::Database.repository?(name)
|
122
|
-
print_error "Unknown Database repository #{name}"
|
140
|
+
unless Ronin::Database.repository?(@set)
|
141
|
+
print_error "Unknown Database repository #{@set}"
|
123
142
|
return
|
124
143
|
end
|
125
144
|
|
126
145
|
Ronin::Database.save do
|
127
|
-
Ronin::Database.repositories[
|
146
|
+
Ronin::Database.repositories[@set] = repository_uri
|
128
147
|
end
|
129
148
|
|
130
|
-
print_info "Database repository #{
|
149
|
+
print_info "Database repository #{@set} updated."
|
131
150
|
end
|
132
151
|
|
133
152
|
#
|
134
153
|
# Removes an existing Database repository.
|
135
154
|
#
|
136
155
|
def remove_repository
|
137
|
-
|
138
|
-
|
139
|
-
unless Ronin::Database.repository?(name)
|
140
|
-
print_error "Unknown Database repository #{name}"
|
156
|
+
unless Ronin::Database.repository?(@remove)
|
157
|
+
print_error "Unknown Database repository #{@remove}"
|
141
158
|
return
|
142
159
|
end
|
143
160
|
|
144
161
|
Ronin::Database.save do
|
145
|
-
Ronin::Database.repositories.delete(
|
162
|
+
Ronin::Database.repositories.delete(@remove)
|
146
163
|
end
|
147
164
|
|
148
|
-
print_info "Database repository #{
|
165
|
+
print_info "Database repository #{@remove} removed."
|
149
166
|
end
|
150
167
|
|
151
168
|
end
|
@@ -31,25 +31,25 @@ module Ronin
|
|
31
31
|
|
32
32
|
model EmailAddress
|
33
33
|
|
34
|
-
query_option :with_hosts, :type
|
35
|
-
:
|
36
|
-
:
|
34
|
+
query_option :with_hosts, :type => Array,
|
35
|
+
:flag => '-H',
|
36
|
+
:usage => 'HOST [...]'
|
37
37
|
|
38
|
-
query_option :with_ips, :type
|
39
|
-
:
|
40
|
-
:
|
38
|
+
query_option :with_ips, :type => Array,
|
39
|
+
:flag => '-I',
|
40
|
+
:usage => 'IP [...]'
|
41
41
|
|
42
|
-
query_option :with_users, :type
|
43
|
-
:
|
44
|
-
:
|
42
|
+
query_option :with_users, :type => Array,
|
43
|
+
:flag => '-u',
|
44
|
+
:usage => 'NAME [...]'
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
option :list, :type => true,
|
47
|
+
:default => true,
|
48
|
+
:flag => '-l'
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
option :import, :type => String,
|
51
|
+
:flag => '-i',
|
52
|
+
:usage => 'FILE'
|
53
53
|
|
54
54
|
end
|
55
55
|
end
|
@@ -29,18 +29,19 @@ module Ronin
|
|
29
29
|
#
|
30
30
|
class Help < Command
|
31
31
|
|
32
|
-
|
33
|
-
|
32
|
+
summary 'Displays the list of available commands or prints information on a specific command'
|
33
|
+
|
34
|
+
argument :command, :type => Symbol
|
34
35
|
|
35
36
|
#
|
36
37
|
# Lists the available commands.
|
37
38
|
#
|
38
39
|
def execute
|
39
|
-
if
|
40
|
+
if command?
|
40
41
|
begin
|
41
|
-
CLI.command(
|
42
|
+
CLI.command(@command).start(['--help'])
|
42
43
|
rescue UnknownCommand
|
43
|
-
print_error "unknown command #{command
|
44
|
+
print_error "unknown command: #{@command}"
|
44
45
|
end
|
45
46
|
else
|
46
47
|
print_array CLI.commands, :title => 'Available commands'
|
@@ -31,33 +31,33 @@ module Ronin
|
|
31
31
|
|
32
32
|
model HostName
|
33
33
|
|
34
|
-
query_option :with_ips, :type
|
35
|
-
:
|
36
|
-
:
|
34
|
+
query_option :with_ips, :type => Array,
|
35
|
+
:flag => '-I',
|
36
|
+
:usage => 'IP [...]'
|
37
37
|
|
38
|
-
query_option :with_ports, :type
|
39
|
-
:
|
40
|
-
:
|
38
|
+
query_option :with_ports, :type => Array[Integer],
|
39
|
+
:flag => '-p',
|
40
|
+
:usage => 'PORT [...]'
|
41
41
|
|
42
|
-
query_option :domain, :type
|
43
|
-
:
|
44
|
-
:
|
42
|
+
query_option :domain, :type => String,
|
43
|
+
:flag => '-D',
|
44
|
+
:usage => 'DOMAIN'
|
45
45
|
|
46
|
-
query_option :tld, :type
|
47
|
-
:
|
48
|
-
:
|
46
|
+
query_option :tld, :type => String,
|
47
|
+
:flag => '-T',
|
48
|
+
:usage => 'TLD'
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
option :list, :type => true,
|
51
|
+
:default => true,
|
52
|
+
:flag => '-l'
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
option :lookup, :type => String,
|
55
|
+
:flag => '-L',
|
56
|
+
:usage => 'IP'
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
option :import, :type => String,
|
59
|
+
:flag => '-i',
|
60
|
+
:usage => 'FILE'
|
61
61
|
|
62
62
|
#
|
63
63
|
# Queries the {HostName} model.
|
@@ -65,8 +65,8 @@ module Ronin
|
|
65
65
|
# @since 1.0.0
|
66
66
|
#
|
67
67
|
def execute
|
68
|
-
if
|
69
|
-
lookup
|
68
|
+
if lookup?
|
69
|
+
lookup(@lookup)
|
70
70
|
else
|
71
71
|
super
|
72
72
|
end
|
@@ -101,7 +101,7 @@ module Ronin
|
|
101
101
|
# @since 1.0.0
|
102
102
|
#
|
103
103
|
def print_resource(host)
|
104
|
-
return super(host) unless
|
104
|
+
return super(host) unless verbose?
|
105
105
|
|
106
106
|
print_title host.address
|
107
107
|
|