metasploit-runner 0.2.4 → 0.2.5
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.
- checksums.yaml +4 -4
- data/MetasploitPenTestScript.gemspec +1 -1
- data/bin/exploit +2 -1
- data/config/exploit.yml.example +1 -0
- data/lib/MetasploitPenTestScript/version.rb +1 -1
- data/lib/metasploit/command_line_argument_parser.rb +5 -0
- data/lib/metasploit/constants.rb +3 -1
- data/lib/metasploit/exploit.rb +3 -0
- data/lib/metasploit/exploit_run_description.rb +22 -2
- data/spec/command_line_argument_parser_spec.rb +11 -0
- data/spec/exploit_run_description_spec.rb +12 -0
- data/spec/exploit_spec.rb +3 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44b990805ebdd61623403a4830225f3d9bdaa3f9
|
4
|
+
data.tar.gz: 71522f5c6ae49c2595d018d43fc179bb7864339c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ba81f7d13ec19e6ff343c076d59b3f94997030569afc75cba1da50725fb250aec9f78efe4629297b0055141630103ac144207fe16164208c38e0a5f173cfb55
|
7
|
+
data.tar.gz: c8619e0b553700d9b79d2a6380c3bd42ac04caaa82eeab382fe65d2ab7c0de91c2d21c56fb0ff1839bd9946bb0eaaa7879f5be98c54dec160e40440e5f1756cb
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'msfrpc-client', '1.
|
21
|
+
spec.add_dependency 'msfrpc-client', '1.1.1'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'bundler'
|
24
24
|
spec.add_development_dependency 'rake'
|
data/bin/exploit
CHANGED
@@ -17,7 +17,8 @@ if ARGV.grep(/^--/).empty?
|
|
17
17
|
'use_os_filter' => ARGV[8],
|
18
18
|
'module_filter' => ARGV[9],
|
19
19
|
'report_type' => ARGV[10],
|
20
|
-
'whitelist_hosts' => ARGV[11]
|
20
|
+
'whitelist_hosts' => ARGV[11],
|
21
|
+
'ssl_version' => ARGV[12]
|
21
22
|
})
|
22
23
|
else
|
23
24
|
Metasploit::Exploit.start(ARGV)
|
data/config/exploit.yml.example
CHANGED
@@ -4,6 +4,7 @@ class CommandLineArgumentParser
|
|
4
4
|
def self.parse(args)
|
5
5
|
options = {}
|
6
6
|
options['use_ssl'] = false
|
7
|
+
options['ssl_version'] = 'TLS1'
|
7
8
|
options['use_os_filter'] = false
|
8
9
|
options['exploit_speed'] = 5
|
9
10
|
options['limit_sessions'] = false
|
@@ -28,6 +29,10 @@ class CommandLineArgumentParser
|
|
28
29
|
options['use_ssl'] = true
|
29
30
|
end
|
30
31
|
|
32
|
+
opts.on('--ssl-version SSL-VERSION', 'SSL Version when using SSL') do |ssl_version|
|
33
|
+
options['ssl_version'] = ssl_version
|
34
|
+
end
|
35
|
+
|
31
36
|
opts.on('--token TOKEN', 'Access token for Metasploit') do |token|
|
32
37
|
options['token'] = token
|
33
38
|
end
|
data/lib/metasploit/constants.rb
CHANGED
@@ -3,6 +3,7 @@ module CONSTANTS
|
|
3
3
|
DEFAULT_URI = '/api/1.0'
|
4
4
|
DEFAULT_SSL = true
|
5
5
|
DEFAULT_OS_FILTER = false
|
6
|
+
DEFAULT_SSL_VERSION = 'TLS1'
|
6
7
|
RUNNING_IMPORT_STATUS = 'running'
|
7
8
|
EXPLOIT_RUNNING_MESSAGE = 'running'
|
8
9
|
REQUIRED_TOKEN_MESSAGE = 'PWNED! Token is required'
|
@@ -13,6 +14,7 @@ module CONSTANTS
|
|
13
14
|
SUCCESSFUL_CONNECTION_MESSAGE = '[*] Sucessfully authenticated to the Metasploit server'
|
14
15
|
USING_DEFAULT_SSL_MESSAGE = '[*] Using SSL=TRUE'
|
15
16
|
IMPORTING_DATA_MESSAGE = '[*] Importing scan data from Nexpose...'
|
17
|
+
DISCOVER_MESSAGE = '[*] Discovering all your things with Discover...'
|
16
18
|
SCANNING_MESSAGE = '[*] Scanning all your things with WebScan...'
|
17
19
|
AUDIT_MESSAGE = '[*] Performing web audit...'
|
18
20
|
EXPLOIT_MESSAGE = '[*] Exploiting all your things...'
|
@@ -24,4 +26,4 @@ module CONSTANTS
|
|
24
26
|
USING_MODULE_FILTER = '[*] Filtering exploits based on your desired modules'
|
25
27
|
NO_MODULE_FILTER = '[*] Not filtering any modules'
|
26
28
|
NO_REPORT_TYPE_MESSAGE = 'No report type specified - skipping report generation'
|
27
|
-
end
|
29
|
+
end
|
data/lib/metasploit/exploit.rb
CHANGED
@@ -36,6 +36,9 @@ module Metasploit
|
|
36
36
|
|
37
37
|
if run_details.nexpose_console_name.nil? || run_details.nexpose_console_name.empty?
|
38
38
|
puts CONSTANTS::SKIPPING_IMPORT_MESSAGE
|
39
|
+
discover = rpc_client.call('pro.start_discover', run_details.get_discover_options)
|
40
|
+
|
41
|
+
wait_for_task_to_stop_running(rpc_client, CONSTANTS::DISCOVER_MESSAGE, discover['task_id'])
|
39
42
|
else
|
40
43
|
import = rpc_client.call('pro.start_import', {'workspace' => run_details.workspace_name, 'DS_NEXPOSE_CONSOLE' => run_details.nexpose_console_name, 'DS_NEXPOSE_SITE' => run_details.workspace_name})
|
41
44
|
wait_for_task_to_stop_running(rpc_client, CONSTANTS::IMPORTING_DATA_MESSAGE, import['task_id'])
|
@@ -6,10 +6,12 @@ class ExploitRunDescription
|
|
6
6
|
:port,
|
7
7
|
:uri,
|
8
8
|
:use_ssl,
|
9
|
+
:ssl_version,
|
9
10
|
:token,
|
10
11
|
:workspace_name,
|
11
12
|
:nexpose_console_name,
|
12
13
|
:device_ip_to_scan,
|
14
|
+
:raw_device_ip_to_scan,
|
13
15
|
:use_os_filter,
|
14
16
|
:module_filter,
|
15
17
|
:report_type,
|
@@ -20,6 +22,7 @@ class ExploitRunDescription
|
|
20
22
|
@@port_value = ''
|
21
23
|
@@uri_value = ''
|
22
24
|
@@use_ssl_value = ''
|
25
|
+
@@ssl_version = ''
|
23
26
|
@@device_ip_to_scan_value = ''
|
24
27
|
@@use_os_filter_value = ''
|
25
28
|
|
@@ -34,10 +37,12 @@ class ExploitRunDescription
|
|
34
37
|
@@port_value = options['port']
|
35
38
|
@@uri_value = options['uri']
|
36
39
|
@@use_ssl_value = options['use_ssl']
|
40
|
+
@@ssl_version = options['ssl_version']
|
37
41
|
self.token = options['token']
|
38
42
|
self.workspace_name = options['workspace_name']
|
39
43
|
self.nexpose_console_name = options['nexpose_console_name']
|
40
44
|
@@device_ip_to_scan_value = options['device_ip_to_scan']
|
45
|
+
self.raw_device_ip_to_scan = options['device_ip_to_scan']
|
41
46
|
self.use_os_filter = options['use_os_filter']
|
42
47
|
self.module_filter = options['module_filter']
|
43
48
|
self.report_type = options['report_type']
|
@@ -59,7 +64,7 @@ class ExploitRunDescription
|
|
59
64
|
:token => self.token,
|
60
65
|
:uri => self.uri,
|
61
66
|
:ssl => self.use_ssl,
|
62
|
-
:ssl_version =>
|
67
|
+
:ssl_version => self.ssl_version
|
63
68
|
}
|
64
69
|
end
|
65
70
|
|
@@ -98,7 +103,14 @@ class ExploitRunDescription
|
|
98
103
|
'report_type' => self.report_type,
|
99
104
|
'created_by' => self.workspace_name,
|
100
105
|
'file_formats' => [:pdf],
|
101
|
-
'
|
106
|
+
'included_addresses' => self.whitelist_hosts
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
def get_discover_options
|
111
|
+
{
|
112
|
+
'workspace' => self.workspace_name,
|
113
|
+
'ips' => [self.raw_device_ip_to_scan]
|
102
114
|
}
|
103
115
|
end
|
104
116
|
|
@@ -141,6 +153,14 @@ class ExploitRunDescription
|
|
141
153
|
(@@use_ssl_value != false) ? true : false
|
142
154
|
end
|
143
155
|
|
156
|
+
def ssl_version=(value)
|
157
|
+
@@ssl_version = value
|
158
|
+
end
|
159
|
+
|
160
|
+
def ssl_version
|
161
|
+
get_value(@@ssl_version, CONSTANTS::DEFAULT_SSL_VERSION)
|
162
|
+
end
|
163
|
+
|
144
164
|
def use_os_filter=(value)
|
145
165
|
@@use_os_filter_value = value
|
146
166
|
end
|
@@ -9,6 +9,7 @@ describe 'command_line_argument_parser' do
|
|
9
9
|
'--port' => '1234',
|
10
10
|
'--token' => 'testtoken',
|
11
11
|
'--use-ssl' => nil,
|
12
|
+
'--ssl-version' => 'TLS1',
|
12
13
|
'--use-os-filter' => nil,
|
13
14
|
'--module-filter' => 'exploit/blah1,exploit/blah2',
|
14
15
|
'--report-type' => 'fisma',
|
@@ -45,6 +46,16 @@ describe 'command_line_argument_parser' do
|
|
45
46
|
expect(@command_line_argument_parser['use_ssl']).to eq(false)
|
46
47
|
end
|
47
48
|
|
49
|
+
it 'should parse --ssl-version' do
|
50
|
+
expect(@command_line_argument_parser['ssl_version']).to eq(@expected_arguments['--ssl-version'])
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should pick appropriate default when --ssl-version not present' do
|
54
|
+
@expected_arguments.delete '--ssl-version'
|
55
|
+
@command_line_argument_parser = CommandLineArgumentParser.parse(hash_to_array(@expected_arguments))
|
56
|
+
expect(@command_line_argument_parser['ssl_version']).to eq('TLS1')
|
57
|
+
end
|
58
|
+
|
48
59
|
it 'should parse --use-os-filter' do
|
49
60
|
expect(@command_line_argument_parser['use_os_filter']).to eq(true)
|
50
61
|
end
|
@@ -30,6 +30,7 @@ describe 'exploit_run_description' do
|
|
30
30
|
'port' => @expected_port,
|
31
31
|
'uri' => @expected_uri,
|
32
32
|
'use_ssl' => @expected_ssl,
|
33
|
+
'ssl_version' => @expected_tls,
|
33
34
|
'token' => @expected_token,
|
34
35
|
'workspace_name' => @expected_workspace_name,
|
35
36
|
'nexpose_console_name' => @expected_nexpose_console_name,
|
@@ -48,6 +49,7 @@ describe 'exploit_run_description' do
|
|
48
49
|
expect(@exploit_run_description.port).to eq(@expected_port)
|
49
50
|
expect(@exploit_run_description.uri).to eq(@expected_uri)
|
50
51
|
expect(@exploit_run_description.use_ssl).to eq(@expected_ssl)
|
52
|
+
expect(@exploit_run_description.ssl_version).to eq(@expected_tls)
|
51
53
|
expect(@exploit_run_description.token).to eq(@expected_token)
|
52
54
|
expect(@exploit_run_description.workspace_name).to eq(@expected_workspace_name)
|
53
55
|
expect(@exploit_run_description.nexpose_console_name).to eq(@expected_nexpose_console_name)
|
@@ -98,6 +100,16 @@ describe 'exploit_run_description' do
|
|
98
100
|
expect(@exploit_run_description.use_ssl).to eq(CONSTANTS::DEFAULT_SSL)
|
99
101
|
end
|
100
102
|
|
103
|
+
it 'should use TLS1 as default if empty string' do
|
104
|
+
@exploit_run_description.ssl_version = ''
|
105
|
+
expect(@exploit_run_description.ssl_version).to eq(CONSTANTS::DEFAULT_SSL_VERSION)
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'should use TLS1 as default if nil is passed' do
|
109
|
+
@exploit_run_description.ssl_version = nil
|
110
|
+
expect(@exploit_run_description.ssl_version).to eq(CONSTANTS::DEFAULT_SSL_VERSION)
|
111
|
+
end
|
112
|
+
|
101
113
|
it 'should return false on the SSL Option if false is passed' do
|
102
114
|
@exploit_run_description.use_ssl = false
|
103
115
|
expect(@exploit_run_description.use_ssl).to eq(false)
|
data/spec/exploit_spec.rb
CHANGED
@@ -44,6 +44,7 @@ describe 'exploit' do
|
|
44
44
|
'port' => @expected_port,
|
45
45
|
'uri' => @expected_uri,
|
46
46
|
'use_ssl' => @expected_ssl,
|
47
|
+
'ssl_version' => @expected_ssl_version,
|
47
48
|
'token' => @expected_token,
|
48
49
|
'workspace_name' => @expected_workspace_name,
|
49
50
|
'nexpose_console_name' => @expected_nexpose_console_name,
|
@@ -68,6 +69,7 @@ describe 'exploit' do
|
|
68
69
|
'--device-ip-to-scan' => '1.2.3.4',
|
69
70
|
'--whitelist-hosts' => '1.2.3.0/24',
|
70
71
|
'--exploit-speed' => '200',
|
72
|
+
'--ssl-version' => 'TLS1'
|
71
73
|
}
|
72
74
|
end
|
73
75
|
|
@@ -340,7 +342,7 @@ describe 'exploit' do
|
|
340
342
|
'report_type' => @expected_report_type,
|
341
343
|
'created_by' => @expected_workspace_name,
|
342
344
|
'file_formats' => [:pdf],
|
343
|
-
'
|
345
|
+
'included_addresses' => @mock_whitelist_hosts,
|
344
346
|
})
|
345
347
|
|
346
348
|
Metasploit::Exploit.start(@options)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metasploit-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Gibson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msfrpc-client
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.1.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.1.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.5.1
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Script to run automated Metaspolit Penetration Tests.
|