nexposecli 0.2.5 → 0.2.6
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/README.md +10 -1
- data/bin/nexposecli +292 -20
- data/lib/nexposecli/args.rb +9 -0
- data/lib/nexposecli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f49f4e83f9ef01ac87442809f173e63aa37674f9
|
4
|
+
data.tar.gz: fa29239804d715454231171e514cb173e444f277
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19c6e2b1b6f7b503f0a9fbd80ea454856d9fd69ee4d5ad22439dacc6d822f0e939bb965ad82013be8437929e800c519fb4f4e162bcc847208b12ce24dfa2d3a8
|
7
|
+
data.tar.gz: bcfa934b537318685021efc9f07f82d4f64e0eed9bcccce87cbb90299de18a6934c29f9b6f8001115406a0ca248e06d018c72cdfe7c93488a8148f7b5b886d1c
|
data/README.md
CHANGED
@@ -17,8 +17,9 @@ or an example of running a query to list all active scans
|
|
17
17
|
nexposecli --config ./lab.yaml --list --SCAN
|
18
18
|
|
19
19
|
how to run an adhoc sql query and export via csv
|
20
|
+
NOTE: Consider the potential impact of running SQL queries without filters.
|
20
21
|
|
21
|
-
nexposecli --run --QUERY --config ./lab.yaml --sql "select * from dim_asset"
|
22
|
+
nexposecli --run --QUERY --config ./lab.yaml --sql "select * from dim_asset limit 10"
|
22
23
|
|
23
24
|
or for more complex sql queries, put the sql into a file and run
|
24
25
|
|
@@ -50,6 +51,14 @@ how to export packaged scan data in a single zip file
|
|
50
51
|
|
51
52
|
nexposecli --config ./lab.yaml --SCAN --update --scanpath ./ --action export --id <scan id>
|
52
53
|
|
54
|
+
how to export packaged scan data in a single zip file
|
55
|
+
|
56
|
+
nexposecli --config ./lab.yaml --SCAN --update --scanpath ./ --action import --filterv scan-<scan id>.zip --id <site id>
|
57
|
+
|
58
|
+
how to import packaged scan data into a site
|
59
|
+
|
60
|
+
nexposecli --config ./lab.yaml --SCAN --update --scanpath ./ --action import --filterv <scan zip> --id <site id>
|
61
|
+
|
53
62
|
where ./lab.yaml consists of the following:
|
54
63
|
|
55
64
|
config:
|
data/bin/nexposecli
CHANGED
@@ -28,6 +28,7 @@ require 'securerandom'
|
|
28
28
|
require 'netaddr'
|
29
29
|
require 'logger'
|
30
30
|
require 'yaml'
|
31
|
+
require 'json'
|
31
32
|
require 'csv'
|
32
33
|
# for debug, this dumps the ruby objects to STDOUT
|
33
34
|
require 'pp'
|
@@ -35,6 +36,7 @@ require 'pp'
|
|
35
36
|
##############################################################################
|
36
37
|
# Set default var values
|
37
38
|
$debug = false
|
39
|
+
$dryrun = false
|
38
40
|
uf_scanners = ''
|
39
41
|
|
40
42
|
@logpath = "./"
|
@@ -285,6 +287,10 @@ if args.scanpath
|
|
285
287
|
end
|
286
288
|
|
287
289
|
$debug = TRUE if args.verbose
|
290
|
+
$dryrun = TRUE if args.dryrun
|
291
|
+
uputs("CLI", "Command-line verbosity mode is #{$debug.to_s}")
|
292
|
+
uputs("CLI", "Command-line dry run mode is #{$dryrun.to_s}")
|
293
|
+
uputs("CLI", "Command-line args parsed for #{$0}")
|
288
294
|
uputs("CLI", "Command-line args parsed for #{$0}")
|
289
295
|
uputs("CLI", "Args: #{args.inspect}")
|
290
296
|
|
@@ -305,8 +311,9 @@ uputs("CLI", "Checking for the requested action")
|
|
305
311
|
@action |= 16 if args.delete
|
306
312
|
@action |= 32 if args.run
|
307
313
|
@action |= 64 if args.sync
|
314
|
+
@action |= 128 if args.copy
|
308
315
|
uputs("ACTION", "The requested action value is: #{@action.to_s}")
|
309
|
-
raise "You can only submit one action per task, see --help (action submitted: #{@action.to_s})" unless [1,2,4,8,16,32,64].include?(@action)
|
316
|
+
raise "You can only submit one action per task, see --help (action submitted: #{@action.to_s})" unless [1,2,4,8,16,32,64,128].include?(@action)
|
310
317
|
|
311
318
|
uputs("TARGET", "Checking for the requested target")
|
312
319
|
@target = 0
|
@@ -326,8 +333,10 @@ uputs("TARGET", "Checking for the requested target")
|
|
326
333
|
@target |= 8192 if args.ROLE
|
327
334
|
@target |= 16384 if args.QUERY
|
328
335
|
@target |= 32768 if args.AUTHSRC
|
336
|
+
@target |= 65536 if args.GROUP
|
337
|
+
@target |= 131072 if args.SCHEDULE
|
329
338
|
uputs("TARGET", "The requested target value is: #{@target.to_s}")
|
330
|
-
raise "You can only submit one target per task, see --help (#{@target})" unless [1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768].include?(@target)
|
339
|
+
raise "You can only submit one target per task, see --help (#{@target})" unless [1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072].include?(@target)
|
331
340
|
|
332
341
|
# Needs to potentially move into TARGET object or module instance var
|
333
342
|
## First NSC Connection and Session creation
|
@@ -1040,23 +1049,39 @@ when 16 # TARGET SITE
|
|
1040
1049
|
if (args.id != nil)
|
1041
1050
|
scan_site_id = args.id.to_i
|
1042
1051
|
end
|
1052
|
+
|
1043
1053
|
begin
|
1044
1054
|
site = Nexpose::Site.load(@nsc, scan_site_id)
|
1045
1055
|
rescue Nexpose::APIError => e
|
1046
1056
|
STDERR.puts "ERROR [ " + e.to_s + " ]"
|
1047
1057
|
exit(-1)
|
1048
1058
|
end
|
1059
|
+
upp(site)
|
1060
|
+
puts("\n")
|
1049
1061
|
puts("Site: id:#{site.id}\t name:'#{site.name}'\tconfig version:#{site.config_version}\n--description:#{site.description}\n")
|
1050
|
-
puts("--scan engine: #{site.
|
1051
|
-
puts("--
|
1052
|
-
site.
|
1062
|
+
puts("--default scan engine: #{site.engine_id}\tdefault scan_template: '#{site.scan_template_id}'\n")
|
1063
|
+
puts("--scan targets:")
|
1064
|
+
site.included_scan_targets[:addresses].each do |iprange|
|
1053
1065
|
puts(" IPRange from: #{iprange.from} - #{iprange.to}\n")
|
1054
1066
|
end
|
1055
|
-
puts("--
|
1056
|
-
site.
|
1067
|
+
puts("--excluded scan targets:")
|
1068
|
+
site.excluded_scan_targets[:addresses].each do |iprange|
|
1057
1069
|
puts(" IPRange from: #{iprange.from} - #{iprange.to}\n")
|
1058
1070
|
end
|
1059
|
-
|
1071
|
+
puts("--active assets:")
|
1072
|
+
assets = @nsc.list_site_devices(scan_site_id)
|
1073
|
+
assets.each do |asset|
|
1074
|
+
print(" Asset Id: #{asset.id}, IP Address: #{asset.address}, Risk Score: #{asset.risk_score} Hostnames: [")
|
1075
|
+
asset_detail = Nexpose::Asset.load(@nsc, asset.id)
|
1076
|
+
if asset_detail.host_names
|
1077
|
+
asset_detail.host_names.each do |hostname|
|
1078
|
+
print("#{hostname},")
|
1079
|
+
end
|
1080
|
+
end
|
1081
|
+
print("] OS: #{asset_detail.os_cpe}\n")
|
1082
|
+
upp(asset_detail)
|
1083
|
+
end
|
1084
|
+
# upp site
|
1060
1085
|
when 8 # update
|
1061
1086
|
uputs("ACTION", 'update SITE action requested')
|
1062
1087
|
site = ""
|
@@ -1083,9 +1108,101 @@ when 16 # TARGET SITE
|
|
1083
1108
|
exit(-1)
|
1084
1109
|
end
|
1085
1110
|
site.exclude.push(Nexpose::IPRange.new(valid_xrange.split(',').first.to_s, valid_xrange.split(',').last.to_s))
|
1086
|
-
|
1111
|
+
if $dryrun
|
1112
|
+
upp(site)
|
1113
|
+
puts "Site exclude request tested."
|
1114
|
+
else
|
1115
|
+
site.save(@nsc)
|
1116
|
+
end
|
1117
|
+
when "import-assets-csv"
|
1118
|
+
if File.file?(args.filterv)
|
1119
|
+
external_assets = []
|
1120
|
+
new_assets = CSV.read(args.filterv, :headers=>true)
|
1121
|
+
new_assets.each do |new_asset|
|
1122
|
+
upp(new_asset)
|
1123
|
+
puts("IP: #{new_asset['ip']} OS: #{new_asset['os']}")
|
1124
|
+
external_asset = Nexpose::External::Asset.new
|
1125
|
+
external_asset.ip = new_asset['ip']
|
1126
|
+
external_asset.aliases = []
|
1127
|
+
external_asset.fqdn = new_asset['fqdn']
|
1128
|
+
external_asset.net_bios = new_asset['net_bios']
|
1129
|
+
external_asset.mac = new_asset['mac']
|
1130
|
+
external_asset.host_type = new_asset['host_type']
|
1131
|
+
external_asset.os = "#{new_asset['os']}"
|
1132
|
+
import_time = Time.now
|
1133
|
+
external_asset.scan_date = %Q[#{import_time.strftime("%Y%m%dT%H%M%S.000-0600")}]
|
1134
|
+
upp(external_asset)
|
1135
|
+
external_assets.push(external_asset)
|
1136
|
+
end
|
1137
|
+
asset_import = @nsc.import_assets(scan_site_id, Array(external_assets))
|
1138
|
+
upp(asset_import)
|
1139
|
+
else
|
1140
|
+
puts("ERROR the filterv value passed is not a valid file.\n")
|
1141
|
+
end
|
1142
|
+
when "rsam-hostname", "RSAM-HOSTNAME"
|
1143
|
+
# RSAM Integration Asset housekeeping to reduce hostnames to a single usable value
|
1144
|
+
external_assets = []
|
1145
|
+
assets = @nsc.list_site_devices(scan_site_id)
|
1146
|
+
assets.each do |site_asset|
|
1147
|
+
asset = Nexpose::Asset.load(@nsc, site_asset.id)
|
1148
|
+
external_asset = Nexpose::External::Asset.new
|
1149
|
+
external_asset.ip = asset.ip
|
1150
|
+
external_asset.aliases = []
|
1151
|
+
|
1152
|
+
upp(asset.host_names)
|
1153
|
+
if (asset.host_names.nil?)
|
1154
|
+
puts("Asset had zero hostnames set. [#{asset.ip}]")
|
1155
|
+
next
|
1156
|
+
elsif (asset.host_names.length == 1) && (asset.host_names[0] !~ /^[^.]+\./)
|
1157
|
+
puts("Asset had the shortname already set. [#{asset.host_names[0]}]\n")
|
1158
|
+
next
|
1159
|
+
elsif (asset.host_names.length == 1) && (/^(?<short_name>[^.]+)\./ =~ asset.host_names[0])
|
1160
|
+
puts("Asset has the fqdn and needs the shortname to be set. [#{asset.host_names[0]}]")
|
1161
|
+
external_asset.fqdn = asset.host_names[0]
|
1162
|
+
external_asset.net_bios = short_name
|
1163
|
+
else
|
1164
|
+
asset.host_names.each do |hostname|
|
1165
|
+
puts("Asset has the multiple hostnames set. [#{hostname}]")
|
1166
|
+
if /^[^.]+\./ =~ hostname
|
1167
|
+
external_asset.fqdn = ''
|
1168
|
+
else
|
1169
|
+
external_asset.net_bios = hostname
|
1170
|
+
end
|
1171
|
+
end
|
1172
|
+
end
|
1173
|
+
external_asset.mac = asset.mac
|
1174
|
+
external_asset.host_type = asset.host_type
|
1175
|
+
import_time = Time.now
|
1176
|
+
external_asset.scan_date = %Q[#{import_time.strftime("%Y%m%dT%H%M%S.000-0600")}]
|
1177
|
+
external_asset.os = asset.os_cpe
|
1178
|
+
|
1179
|
+
# grab and set lazy attrs
|
1180
|
+
# if (asset.vulnerability_instances.nil?)
|
1181
|
+
# upp(asset.vulnerability_instances)
|
1182
|
+
external_asset.vulnerabilities = []
|
1183
|
+
asset.vulnerability_instances.each do |old_vuln|
|
1184
|
+
new_vuln = Nexpose::External::VulnerabilityCheck.new(
|
1185
|
+
old_vuln.vulnerability_id,
|
1186
|
+
Nexpose::External::VulnerabilityCheck::Status::EXPLOITED,
|
1187
|
+
old_vuln.proof,
|
1188
|
+
old_vuln.key)
|
1189
|
+
external_asset.vulnerabilities << new_vuln
|
1190
|
+
end
|
1191
|
+
|
1192
|
+
upp(external_asset)
|
1193
|
+
external_assets.push(external_asset)
|
1194
|
+
end
|
1195
|
+
|
1196
|
+
upp(external_assets)
|
1197
|
+
puts("SITE RSAM Hostname update for Site Id [#{scan_site_id}], contains [#{assets.length}] assets, attempting updates to [#{external_assets.length}] assets.")
|
1198
|
+
if (external_assets.empty?)
|
1199
|
+
puts("The Site Assets have no hostnames or are already all shortnames.")
|
1200
|
+
else
|
1201
|
+
# asset_import = @nsc.import_assets(scan_site_id, Array(external_assets))
|
1202
|
+
# upp(asset_import)
|
1203
|
+
end
|
1087
1204
|
else
|
1088
|
-
|
1205
|
+
puts 'Not yet implemented'
|
1089
1206
|
end
|
1090
1207
|
when 16 # delete
|
1091
1208
|
uputs("ACTION", 'delete SITE action requested')
|
@@ -1110,18 +1227,115 @@ when 32 # TARGET ASSET
|
|
1110
1227
|
when 4 # show
|
1111
1228
|
uputs("ACTION", 'show ASSET action requested')
|
1112
1229
|
if is_numeric(args.id)
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
end
|
1230
|
+
asset = Nexpose::Asset.load(@nsc, args.id)
|
1231
|
+
# upp(asset.vulnerability_instances)
|
1232
|
+
# upp(asset.vulnerabilities)
|
1233
|
+
upp(asset.services)
|
1118
1234
|
else
|
1119
|
-
puts 'The Asset
|
1235
|
+
puts 'The Asset Id must be numeric.'
|
1120
1236
|
end
|
1121
|
-
upp(
|
1237
|
+
upp(asset)
|
1122
1238
|
when 8 # update
|
1123
1239
|
uputs("ACTION", 'update ASSET action requested')
|
1124
|
-
|
1240
|
+
if is_numeric(args.id)
|
1241
|
+
|
1242
|
+
# GOMEZ
|
1243
|
+
# asset = Nexpose::Asset.load(@nsc, args.id)
|
1244
|
+
|
1245
|
+
external_asset = Nexpose::External::Asset.new
|
1246
|
+
external_asset.ip = '10.3.70.77'
|
1247
|
+
check = Nexpose::External::VulnerabilityCheck.new(
|
1248
|
+
'snmp-read-0001',
|
1249
|
+
Nexpose::External::VulnerabilityCheck::Status::VERSION,
|
1250
|
+
'External scanning resource.')
|
1251
|
+
external_asset.vulnerabilities << check
|
1252
|
+
|
1253
|
+
check = Nexpose::External::VulnerabilityCheck.new(
|
1254
|
+
'ssh-default-account-admin-password-admin',
|
1255
|
+
Nexpose::External::VulnerabilityCheck::Status::POTENTIAL,
|
1256
|
+
'External scanning resource.')
|
1257
|
+
external_asset.vulnerabilities << check
|
1258
|
+
|
1259
|
+
service_check = Nexpose::External::VulnerabilityCheck.new(
|
1260
|
+
'http-generic-script-blind-sql-injection',
|
1261
|
+
Nexpose::External::VulnerabilityCheck::Status::EXPLOITED,
|
1262
|
+
'External scanning resource.',
|
1263
|
+
'/')
|
1264
|
+
external_asset.vulnerabilities << service_check
|
1265
|
+
|
1266
|
+
service_check = Nexpose::External::VulnerabilityCheck.new(
|
1267
|
+
'http-generic-script-blind-sql-injection',
|
1268
|
+
Nexpose::External::VulnerabilityCheck::Status::EXPLOITED,
|
1269
|
+
'External scanning resource.',
|
1270
|
+
'/home/')
|
1271
|
+
external_asset.vulnerabilities << service_check
|
1272
|
+
|
1273
|
+
service_check = Nexpose::External::VulnerabilityCheck.new(
|
1274
|
+
'http-generic-script-blind-sql-injection',
|
1275
|
+
Nexpose::External::VulnerabilityCheck::Status::EXPLOITED,
|
1276
|
+
'External scanning resource.',
|
1277
|
+
'/')
|
1278
|
+
external_asset.vulnerabilities << service_check
|
1279
|
+
# external_asset.vulnerabilities = []
|
1280
|
+
|
1281
|
+
external_asset.aliases = []
|
1282
|
+
# external_asset.fqdn = 'gomez-nexpose01-ext.rapidcloud.priv'
|
1283
|
+
external_asset.net_bios = 'CleanNexpos-0'
|
1284
|
+
external_asset.mac = '00:50:56:02:18:19'
|
1285
|
+
external_asset.host_type = 'GUEST'
|
1286
|
+
external_asset.scan_date = '20141218T074721.823-0800'
|
1287
|
+
external_asset.os = 'cpe:/o:canonical:ubuntu_linux:12.04::~~lts~~~'
|
1288
|
+
|
1289
|
+
external_asset.software = ['cpe:/a:microsoft:office:2007',
|
1290
|
+
'cpe:/a:microsoft:.net_framework:3.0:sp2',
|
1291
|
+
'cpe:/a:microsoft:.net_framework:2.0:sp2']
|
1292
|
+
external_asset.software = []
|
1293
|
+
|
1294
|
+
external_asset.services = [
|
1295
|
+
Nexpose::External::Service.new(135, 'TCP', 'DCE Endpoint Resolution'),
|
1296
|
+
Nexpose::External::Service.new(137, 'UDP', 'CIFS Name Service'),
|
1297
|
+
Nexpose::External::Service.new(139, 'TCP', 'CIFS Windows Vista (TM) Enterprise 6.0'),
|
1298
|
+
Nexpose::External::Service.new(445, 'TCP', 'CIFS Windows Vista (TM) Enterprise 6.0') ]
|
1299
|
+
external_asset.services = []
|
1300
|
+
|
1301
|
+
external_asset.users = [
|
1302
|
+
Nexpose::UserAccount.new('Guest', 10, '', [{'gid' => '216'}]),
|
1303
|
+
Nexpose::UserAccount.new('Administrator', 1, 'Administrator', []),
|
1304
|
+
Nexpose::UserAccount.new('NetworkService', 403, 'NetworkService', []) ]
|
1305
|
+
external_asset.users = []
|
1306
|
+
|
1307
|
+
external_asset.groups = [
|
1308
|
+
Nexpose::GroupAccount.new('ANONYMOUS LOGON', 123),
|
1309
|
+
Nexpose::GroupAccount.new('Everyone', 124),
|
1310
|
+
Nexpose::GroupAccount.new('LOCAL SERVICE', 1),
|
1311
|
+
Nexpose::GroupAccount.new('SYSTEM'),
|
1312
|
+
Nexpose::GroupAccount.new('Guests', 122, [{'just' => 'because'}]),
|
1313
|
+
Nexpose::GroupAccount.new('Administrators', 10) ]
|
1314
|
+
external_asset.groups = []
|
1315
|
+
|
1316
|
+
external_asset.files = [
|
1317
|
+
Nexpose::File.new('ADMIN$', -1, true, [{'comment' => 'Remote Admin'}]),
|
1318
|
+
Nexpose::File.new('C$', 665321, true),
|
1319
|
+
Nexpose::File.new('c:\\', 665321, true) ]
|
1320
|
+
|
1321
|
+
external_asset.unique_identifiers = []
|
1322
|
+
upp(external_asset)
|
1323
|
+
|
1324
|
+
# test_json = JSON.generate(Array(Array([external_asset])).map(&:to_h))
|
1325
|
+
|
1326
|
+
# test_hash = JSON.parse(test_json)[0]
|
1327
|
+
|
1328
|
+
# upp( test_hash )
|
1329
|
+
|
1330
|
+
# GOMEZ
|
1331
|
+
# test_back = JSON.generate(test_hash)
|
1332
|
+
# upp( test_back)
|
1333
|
+
|
1334
|
+
# asset_import = @nsc.import_assets(39, Array([external_asset]))
|
1335
|
+
# upp(asset_import)
|
1336
|
+
else
|
1337
|
+
puts 'The Asset Id must be numeric.'
|
1338
|
+
end
|
1125
1339
|
when 16 # delete
|
1126
1340
|
uputs("ACTION", 'delete ASSET action requested')
|
1127
1341
|
puts 'Not yet implemented'
|
@@ -1607,6 +1821,25 @@ when 2048 # TARGET CONSOLE
|
|
1607
1821
|
uputs("ACTION", 'The action requested is not implemented for target')
|
1608
1822
|
puts 'The action requested is not implemented for target'
|
1609
1823
|
end
|
1824
|
+
when 4096 # TARGET TEMPLATE
|
1825
|
+
case @action
|
1826
|
+
when 2 # list
|
1827
|
+
uputs("ACTION", 'list TEMPLATE action requested')
|
1828
|
+
templates = @nsc.list_scan_templates
|
1829
|
+
templates.each do |template|
|
1830
|
+
scan_template = Nexpose::ScanTemplate.load(@nsc, "#{template.id}")
|
1831
|
+
puts "Scan Template Id: #{scan_template.id}"
|
1832
|
+
puts "Scan Template Name: #{scan_template.name}"
|
1833
|
+
# upp scan_template
|
1834
|
+
end
|
1835
|
+
when 128 # copy
|
1836
|
+
uputs("ACTION", 'copy TEMPLATE action requested')
|
1837
|
+
new_scan_template = Nexpose::ScanTemplate.load(@nsc, "#{args.id}")
|
1838
|
+
upp new_scan_template.xml
|
1839
|
+
else
|
1840
|
+
uputs("ACTION", 'The action requested is not implemented for target')
|
1841
|
+
puts 'The action requested is not implemented for target'
|
1842
|
+
end
|
1610
1843
|
when 8192 # TARGET ROLE
|
1611
1844
|
case @action
|
1612
1845
|
when 1 # create, via copy for now
|
@@ -1672,8 +1905,12 @@ when 16384 # TARGET QUERY
|
|
1672
1905
|
sql_config.add_filter('query', sql)
|
1673
1906
|
# EJG
|
1674
1907
|
if args.filter
|
1675
|
-
if ['site','group','device','scan','vuln-categories','vuln-severity','vuln-status'].include?(args.filter)
|
1676
|
-
|
1908
|
+
# if ['site','group','device','scan','vuln-categories','vuln-severity','vuln-status'].include?(args.filter)
|
1909
|
+
if ['site','group','device','scan'].include?(args.filter)
|
1910
|
+
groups = args.filterv.split(",")
|
1911
|
+
groups.each do |group|
|
1912
|
+
sql_config.add_filter(args.filter, group.to_i)
|
1913
|
+
end
|
1677
1914
|
else
|
1678
1915
|
ubail(-1, "The report filter type passed is not valid")
|
1679
1916
|
end
|
@@ -1709,6 +1946,41 @@ when 32768 # TARGET AUTHSRC
|
|
1709
1946
|
uputs("ACTION", 'The action requested is not implemented for target: AUTHSRC')
|
1710
1947
|
puts 'The action requested is not implemented for target: AUTHSRC'
|
1711
1948
|
end
|
1949
|
+
when 65536 # TARGET GROUP
|
1950
|
+
case @action
|
1951
|
+
when 1 # create
|
1952
|
+
uputs("ACTION", 'create GROUP action requested')
|
1953
|
+
puts 'Not yet implemented'
|
1954
|
+
when 2 # list
|
1955
|
+
uputs("ACTION", 'list GROUP action requested')
|
1956
|
+
assetgroups = @nsc.asset_groups
|
1957
|
+
uputs("ACTION", "There are #{assetgroups.size} asset groups.")
|
1958
|
+
assetgroups.each do |ags|
|
1959
|
+
puts "id: #{ags.id.to_s.ljust(10)} name: #{ags.name}"
|
1960
|
+
end
|
1961
|
+
upp assetgroups
|
1962
|
+
when 4 # show
|
1963
|
+
uputs("ACTION", 'show GROUP action requested')
|
1964
|
+
if is_numeric(args.id)
|
1965
|
+
ag = Nexpose::AssetGroup.load(@nsc, args.id)
|
1966
|
+
puts "There are #{ag.assets.size} assets in asset group id: #{args.id} name: \"#{ag.name}\".\n"
|
1967
|
+
ag.assets.each do |asset|
|
1968
|
+
puts "id: #{asset.id.to_s.ljust(10)} address: #{asset.address}"
|
1969
|
+
end
|
1970
|
+
else
|
1971
|
+
puts 'The Asset Group Id must be numeric.'
|
1972
|
+
end
|
1973
|
+
upp(ag)
|
1974
|
+
when 8 # update
|
1975
|
+
uputs("ACTION", 'update GROUP action requested')
|
1976
|
+
puts 'Not yet implemented'
|
1977
|
+
when 16 # delete
|
1978
|
+
uputs("ACTION", 'delete GROUP action requested')
|
1979
|
+
puts 'Not yet implemented'
|
1980
|
+
else
|
1981
|
+
uputs("ACTION", 'The action requested is not implemented for target')
|
1982
|
+
puts 'The action requested is not implemented for target'
|
1983
|
+
end
|
1712
1984
|
else
|
1713
1985
|
# there is no default target
|
1714
1986
|
uputs("ACTION", 'No default action requested')
|
data/lib/nexposecli/args.rb
CHANGED
@@ -15,12 +15,18 @@ module Nexposecli
|
|
15
15
|
short : v
|
16
16
|
desc : Run verbosely
|
17
17
|
|
18
|
+
- name : dryrun
|
19
|
+
desc : Dry run mode, do not commit to Console
|
20
|
+
|
18
21
|
- comment : EVM Administrative Actions
|
19
22
|
|
20
23
|
- name : create
|
21
24
|
short : c
|
22
25
|
desc : The create action is used for new objects
|
23
26
|
|
27
|
+
- name : copy
|
28
|
+
desc : The copy action is used to copy of objects of the same type
|
29
|
+
|
24
30
|
- name : list
|
25
31
|
short : l
|
26
32
|
desc : The list action is used to list of objects of the same type
|
@@ -98,6 +104,9 @@ module Nexposecli
|
|
98
104
|
- name : CONSOLE
|
99
105
|
desc : The CONSOLE target is used to alter the CONSOLE nsc connection object
|
100
106
|
|
107
|
+
- name : TEMPLATE
|
108
|
+
desc : The TEMPLATE target is used to alter the TEMPLATE nsc connection object
|
109
|
+
|
101
110
|
- name : COMMAND
|
102
111
|
short : C
|
103
112
|
desc : The COMMAND target is only used in conjunction with the --run action
|
data/lib/nexposecli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexposecli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Gomez
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nexpose
|