1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-10-29 18:07:27 +01:00

Extract Msf::DBManager::Import::IP260::ASPL

MSP-11124
This commit is contained in:
Luke Imhoff 2014-10-14 15:58:43 -05:00
parent c28f1fce3a
commit 81c18c96ee
No known key found for this signature in database
GPG Key ID: 5B1FB01FB33356F8
3 changed files with 32 additions and 21 deletions

View File

@ -17,7 +17,6 @@ require 'rex/parser/burp_session_nokogiri'
require 'rex/parser/ci_nokogiri'
require 'rex/parser/foundstone_nokogiri'
require 'rex/parser/fusionvm_nokogiri'
require 'rex/parser/ip360_aspl_xml'
require 'rex/parser/ip360_xml'
require 'rex/parser/mbsa_nokogiri'
require 'rex/parser/nessus_xml'
@ -34,10 +33,12 @@ require 'rex/parser/wapiti_nokogiri'
module Msf::DBManager::Import
autoload :Acunetix, 'msf/core/db_manager/import/acunetix'
autoload :IP360, 'msf/core/db_manager/import/ip360'
autoload :MsfXml, 'msf/core/db_manager/import/msf_xml'
autoload :Qualys, 'msf/core/db_manager/import/qualys'
include Msf::DBManager::Import::Acunetix
include Msf::DBManager::Import::IP360
include Msf::DBManager::Import::MsfXml
include Msf::DBManager::Import::Qualys
@ -547,26 +548,6 @@ module Msf::DBManager::Import
parser.parse(args[:data])
end
#
# Import IP360's ASPL database
#
def import_ip360_aspl_xml(args={}, &block)
data = args[:data]
wspace = args[:wspace] || workspace
bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []
if not data.index("<ontology")
raise DBImportError.new("The ASPL file does not appear to be valid or may still be compressed")
end
base = ::File.join(Msf::Config.config_directory, "data", "ncircle")
::FileUtils.mkdir_p(base)
::File.open(::File.join(base, "ip360.aspl"), "wb") do |fd|
fd.write(data)
end
yield(:notice, "Saved the IP360 ASPL database to #{base}...")
end
#
# Import IP360 XML v3 output
#

View File

@ -0,0 +1,7 @@
require 'rex/parser/ip360_aspl_xml'
module Msf::DBManager::Import::IP360
autoload 'ASPL', 'msf/core/db_manager/import/ip360/aspl'
include Msf::DBManager::Import::IP360::ASPL
end

View File

@ -0,0 +1,23 @@
require 'rex/parser/ip360_aspl_xml'
module Msf::DBManager::Import::IP360::ASPL
#
# Import IP360's ASPL database
#
def import_ip360_aspl_xml(args={}, &block)
data = args[:data]
wspace = args[:wspace] || workspace
bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []
if not data.index("<ontology")
raise DBImportError.new("The ASPL file does not appear to be valid or may still be compressed")
end
base = ::File.join(Msf::Config.config_directory, "data", "ncircle")
::FileUtils.mkdir_p(base)
::File.open(::File.join(base, "ip360.aspl"), "wb") do |fd|
fd.write(data)
end
yield(:notice, "Saved the IP360 ASPL database to #{base}...")
end
end