Skip to content

Commit

Permalink
Merge branch 'nessus-plugin-updates' of git://github.com/kost/metaspl…
Browse files Browse the repository at this point in the history
…oit-framework into kost-nessus-plugin-updates
  • Loading branch information
sinn3r committed Nov 27, 2012
2 parents 319fa04 + 11a44bb commit 917b938
Showing 1 changed file with 66 additions and 5 deletions.
71 changes: 66 additions & 5 deletions plugins/nessus.rb
Expand Up @@ -61,7 +61,7 @@ def nessus_index

class ConsoleCommandDispatcher
include Msf::Ui::Console::CommandDispatcher

def name
"Nessus"
end
Expand All @@ -78,6 +78,7 @@ def commands
"nessus_report_list" => "List all Nessus reports.",
"nessus_report_get" => "Import a report from the nessus server in Nessus v2 format.",
"nessus_report_del" => "Delete a report.",
"nessus_report_vulns" => "Get list of vulns from a report.",
"nessus_report_hosts" => "Get list of hosts from a report.",
"nessus_report_host_ports" => "Get list of open ports from a host from a report.",
"nessus_report_host_detail" => "Detail from a report item on a host.",
Expand Down Expand Up @@ -221,6 +222,7 @@ def cmd_nessus_help(*args)
tbl << [ "-----------------", "-----------------"]
tbl << [ "nessus_report_list", "List all Nessus reports" ]
tbl << [ "nessus_report_get", "Import a report from the nessus server in Nessus v2 format" ]
tbl << [ "nessus_report_vulns", "Get list of vulns from a report" ]
tbl << [ "nessus_report_hosts", "Get list of hosts from a report" ]
tbl << [ "nessus_report_host_ports", "Get list of open ports from a host from a report" ]
tbl << [ "nessus_report_host_detail", "Detail from a report item on a host" ]
Expand Down Expand Up @@ -751,7 +753,7 @@ def cmd_nessus_server_status(*args)
plugins = total.sum
tbl << [users, policies, scans, reports, plugins]
print_good "\n"
print_line tbl.to_s
print_line tbl.to_s
end

def cmd_nessus_plugin_list(*args)
Expand Down Expand Up @@ -960,6 +962,65 @@ def cmd_nessus_report_hosts(*args)
print_status(" Get information from a particular host: nessus_report_host_ports <hostname> <report id>")
end

def cmd_nessus_report_vulns(*args)

if args[0] == "-h"
print_status("Usage: ")
print_status(" nessus_report_vulns <report id>")
print_status(" Example:> nessus_report_vulns f0eabba3-4065-7d54-5763-f191e98eb0f7f9f33db7e75a06ca")
print_status()
print_status("Returns all the vulns associated with a scan and details about hosts and their vulnerabilities")
print_status("use nessus_report_list to list all available scans")
return
end

if ! nessus_verify_token
return
end

case args.length
when 1
rid = args[0]
else
print_status("Usage: ")
print_status(" nessus_report_vulns <report id>")
print_status(" use nessus_report_vulns to list all available reports")
return
end

tbl = Rex::Ui::Text::Table.new(
'Columns' => [
'Hostname',
'Port',
'Proto',
'Sev',
'PluginID',
'Plugin Name'
])
print_status("Grabbing all vulns for report #{rid}")
hosts=@n.report_hosts(rid)
hosts.each {|host|
ports=@n.report_host_ports(rid, host['hostname'])
ports.each {|port|
details=@n.report_host_port_details(rid, host['hostname'], port['portnum'], port['protocol'])
details.each {|detail|
tbl << [host['hostname'],
port['portnum'],
port['protocol'],
detail['severity'],
detail['pluginID'],
detail['pluginName']
]
}
}
}
print_good("Report Info")
print_good "\n"
print_line tbl.to_s
print_status("You can:")
print_status(" Get information from a particular host: nessus_report_host_ports <hostname> <report id>")
end

def cmd_nessus_report_host_ports(*args)

if args[0] == "-h"
Expand Down Expand Up @@ -1418,7 +1479,7 @@ def cmd_nessus_policy_del(*args)
return
end


del = @n.policy_del(pid)
status = del.root.elements['status'].text
if status == "OK"
Expand Down Expand Up @@ -1478,7 +1539,7 @@ def cmd_nessus_plugin_details(*args)
tbl << [ "Plugin Pub Date", entry['plugin_publication_date'] ]
tbl << [ "Plugin Modification Date", entry['plugin_modification_date'] ]
print_good "\n"
print_line tbl.to_s
print_line tbl.to_s
end

def cmd_nessus_report_del(*args)
Expand Down Expand Up @@ -1595,7 +1656,7 @@ def cmd_nessus_plugin_prefs(*args)

def initialize(framework, opts)
super

add_console_dispatcher(ConsoleCommandDispatcher)
@nbver = "1.1" # Nessus Plugin Version. Increments each time we commit to msf
@xindex = "#{Msf::Config.get_config_root}/nessus_index" # location of the exploit index file used to speed up searching for valid exploits.
Expand Down

0 comments on commit 917b938

Please sign in to comment.