Permalink
Browse files

Zate - Tue Sep 28 18:55:33 EDT 2010

  • Loading branch information...
1 parent 3c34187 commit ca59adc85c02890bf422b7d3260cc2983861b97d @Zate Zate committed Sep 28, 2010
Showing with 32 additions and 2 deletions.
  1. +1 −1 lib/rex/parser/nessus_xml.rb
  2. +31 −1 plugins/nessus.rb
@@ -38,7 +38,7 @@ module Parser
# xml will trip it up. Nmap shouldn't ever output malformed xml, so it's not
# a big deal.
#
-class NmapXMLStreamParser
+class NessusXMLStreamParser
attr_accessor :on_found_host
View
@@ -1,5 +1,6 @@
require 'nessus/nessus-xmlrpc'
+require 'rex/parser/nessus_xml'
module Msf
@@ -53,6 +54,7 @@ def commands
"nessus_policy_list" => "List all polciies",
#"nessus_policy_new" => "Save new policy"
"nessus_policy_del" => "Delete a policy",
+ "nessus_stream" => "testing a stream parser",
#"nessus_policy_dupe" => "Duplicate a policy"
#"nessus_policy_rename" => "Rename a policy"
"nessus_find_targets" => "Try to find vulnerable targets from a report"
@@ -62,6 +64,10 @@ def commands
}
end
+
+ def cmd_nessus_stream
+ parser = Rex::Parser::NssusXMLStreamParser.new
+ end
def cmd_nessus_logout
@token = nil
@@ -409,6 +415,25 @@ def cmd_nessus_report_list(*args)
print_status("You can:")
print_status(" Get a list of hosts from the report: nessus_report_hosts <report id>")
end
+
+ def check_scan(*args)
+
+ case args.length
+ when 1
+ rid = args[0]
+ else
+ print_error("No Report ID Supplied")
+ return
+ end
+
+ scans = @n.scan_list_hash
+ scans.each {|scan|
+ if scan['id'] == rid
+ return true
+ end
+ }
+ return false
+ end
def cmd_nessus_report_get(*args)
@@ -449,7 +474,12 @@ def cmd_nessus_report_get(*args)
print_status(" use nessus_report_list to list all available reports for importing")
return
end
-
+
+ if check_scan(rid)
+ print_error("That scan is still running.")
+ return
+ end
+
content=@n.report_file_download(rid)
print_status("importing " + rid)
framework.db.import({:data => content})

0 comments on commit ca59adc

Please sign in to comment.