Sometimes, imported nmap hosts are all marked as "up," even if they're not, thanks to the "user-set" reason. Since that's not very trustworthy, only import hosts that actually have a port list.

git-svn-id: file:///home/svn/framework3/trunk@9240 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Tod Beardsley 2010-05-07 17:35:49 +00:00
parent ef7c628ff8
commit 044d7758d8
1 changed files with 6 additions and 3 deletions

View File

@ -1633,8 +1633,12 @@ class DBManager
data[:name] = h["reverse_dns"] data[:name] = h["reverse_dns"]
end end
# Only report alive hosts with ports to speak of.
if(data[:state] != Msf::HostState::Dead) if(data[:state] != Msf::HostState::Dead)
report_host(data) if h["ports"].size > 0
report_host(data)
report_import_note(wspace,addr)
end
end end
if( h["os_vendor"] ) if( h["os_vendor"] )
@ -1668,7 +1672,6 @@ class DBManager
) )
end end
report_import_note(wspace,addr)
# Put all the ports, regardless of state, into the db. # Put all the ports, regardless of state, into the db.
h["ports"].each { |p| h["ports"].each { |p|
@ -1695,7 +1698,7 @@ class DBManager
end end
def report_import_note(wspace,addr) def report_import_note(wspace,addr)
if @import_filedata.kind_of?(Hash) && @import_filedata[:type] if @import_filedata.kind_of?(Hash) && @import_filedata[:filename] && @import_filedata[:filename] !~ /msfe-nmap[0-9]{8}/
report_note( report_note(
:workspace => wspace, :workspace => wspace,
:host => addr, :host => addr,