Take out irrelevant files (nessus)
parent
68effe0bc6
commit
62cb0c8749
|
@ -4,21 +4,20 @@ require 'rex/parser/nessus_xml'
|
||||||
|
|
||||||
module Msf
|
module Msf
|
||||||
|
|
||||||
|
PLUGIN_NAME = 'Nessus'
|
||||||
|
PLUGIN_DESCRIPTION = 'Nessus Bridge for Metasploit'
|
||||||
|
|
||||||
class Plugin::Nessus < Msf::Plugin
|
class Plugin::Nessus < Msf::Plugin
|
||||||
|
|
||||||
def name
|
def name
|
||||||
"Nessus"
|
PLUGIN_NAME
|
||||||
end
|
|
||||||
|
|
||||||
def desc
|
|
||||||
"Nessus Bridge for Metasploit"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class ConsoleCommandDispatcher
|
class ConsoleCommandDispatcher
|
||||||
include Msf::Ui::Console::CommandDispatcher
|
include Msf::Ui::Console::CommandDispatcher
|
||||||
|
|
||||||
def name
|
def name
|
||||||
"Nessus"
|
PLUGIN_NAME
|
||||||
end
|
end
|
||||||
|
|
||||||
def xindex
|
def xindex
|
||||||
|
@ -451,7 +450,7 @@ module Msf
|
||||||
print_status("Returns a list of information about the scan or policy templates..")
|
print_status("Returns a list of information about the scan or policy templates..")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if type.downcase.in?(['scan', 'policy'])
|
if type.in?(['scan', 'policy'])
|
||||||
list=@n.list_template(type)
|
list=@n.list_template(type)
|
||||||
else
|
else
|
||||||
print_error("Only scan and policy are valid templates")
|
print_error("Only scan and policy are valid templates")
|
||||||
|
@ -1184,7 +1183,7 @@ module Msf
|
||||||
when 2
|
when 2
|
||||||
scan_id = args[0]
|
scan_id = args[0]
|
||||||
category = args[1]
|
category = args[1]
|
||||||
if category.downcase.in?(['info', 'hosts', 'vulnerabilities', 'history'])
|
if category.in?(['info', 'hosts', 'vulnerabilities', 'history'])
|
||||||
category = args[1]
|
category = args[1]
|
||||||
else
|
else
|
||||||
print_error("Invalid category. The available categories are info, hosts, vulnerabilities, and history")
|
print_error("Invalid category. The available categories are info, hosts, vulnerabilities, and history")
|
||||||
|
@ -1261,7 +1260,7 @@ module Msf
|
||||||
case args.length
|
case args.length
|
||||||
when 2
|
when 2
|
||||||
scan_id = args[0]
|
scan_id = args[0]
|
||||||
format = args[1]
|
format = args[1].downcase
|
||||||
else
|
else
|
||||||
print_status("Usage: ")
|
print_status("Usage: ")
|
||||||
print_status("nessus_scan_export <scan ID> <export format>")
|
print_status("nessus_scan_export <scan ID> <export format>")
|
||||||
|
@ -1269,19 +1268,15 @@ module Msf
|
||||||
print_status("Use nessus_scan_list to list all available scans with their corresponding scan IDs")
|
print_status("Use nessus_scan_list to list all available scans with their corresponding scan IDs")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if format.downcase.in?(['nessus','html','pdf','csv','db'])
|
if format.in?(['nessus','html','pdf','csv','db'])
|
||||||
export = @n.scan_export(scan_id, format)
|
export = @n.scan_export(scan_id, format)
|
||||||
if export["file"]
|
if export["file"]
|
||||||
file_id = export["file"]
|
file_id = export["file"]
|
||||||
print_good("The export file ID for scan ID #{scan_id} is #{file_id}")
|
print_good("The export file ID for scan ID #{scan_id} is #{file_id}")
|
||||||
print_status("Checking export status...")
|
print_status("Checking export status...")
|
||||||
code, body = @n.scan_export_status(scan_id, file_id)
|
status = @n.scan_export_status(scan_id, file_id)
|
||||||
if code == "200"
|
if status == "ready"
|
||||||
if body =~ /ready/
|
print_good("The status of scan ID #{scan_id} export is ready")
|
||||||
print_good("The status of scan ID #{scan_id} export is ready")
|
|
||||||
else
|
|
||||||
print_status("Scan result not ready for download. Please check again after a few seconds")
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
print_error("There was some problem in exporting the scan. The error message is #{status}")
|
print_error("There was some problem in exporting the scan. The error message is #{status}")
|
||||||
end
|
end
|
||||||
|
@ -1306,7 +1301,12 @@ module Msf
|
||||||
when 2
|
when 2
|
||||||
scan_id = args[0]
|
scan_id = args[0]
|
||||||
file_id = args[1]
|
file_id = args[1]
|
||||||
check_export_status(scan_id, file_id)
|
status = @n.scan_export_status(scan_id, file_id)
|
||||||
|
if status == "ready"
|
||||||
|
print_status("The status of scan ID #{scan_id} export is ready")
|
||||||
|
else
|
||||||
|
print_error("There was some problem in exporting the scan. The error message is #{status}")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
print_status("Usage: ")
|
print_status("Usage: ")
|
||||||
print_status("nessus_scan_export_status <scan ID> <file ID>")
|
print_status("nessus_scan_export_status <scan ID> <file ID>")
|
||||||
|
@ -1314,25 +1314,6 @@ module Msf
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_export_status(scan_id, file_id, attempt = 0)
|
|
||||||
code, body = @n.scan_export_status(scan_id, file_id)
|
|
||||||
if code == "200"
|
|
||||||
if body.to_s =~ /ready/
|
|
||||||
print_status("The status of scan ID #{scan_id} export is ready")
|
|
||||||
else
|
|
||||||
if attempt < 3
|
|
||||||
print_status("Scan result not ready for download. Checking again...")
|
|
||||||
select(nil, nil, nil, 1)
|
|
||||||
attempt = attempt + 1
|
|
||||||
print_error("Current value of attempt is #{attempt}")
|
|
||||||
check_export_status(scan_id, file_id, attempt)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
print_error("There was some problem in exporting the scan. The error message is #{body}")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def cmd_nessus_plugin_list(*args)
|
def cmd_nessus_plugin_list(*args)
|
||||||
if args[0] == "-h"
|
if args[0] == "-h"
|
||||||
print_status("nessus_plugin_list <Family ID>")
|
print_status("nessus_plugin_list <Family ID>")
|
||||||
|
@ -1687,7 +1668,7 @@ module Msf
|
||||||
def initialize(framework, opts)
|
def initialize(framework, opts)
|
||||||
super
|
super
|
||||||
add_console_dispatcher(ConsoleCommandDispatcher)
|
add_console_dispatcher(ConsoleCommandDispatcher)
|
||||||
print_status("Nessus Bridge for Metasploit")
|
print_status(PLUGIN_DESCRIPTION)
|
||||||
print_status("Type %bldnessus_help%clr for a command listing")
|
print_status("Type %bldnessus_help%clr for a command listing")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue