Refactor host/note reporting for the jenkins module

This prevents this module from blindly overwriting the host
fields and instead reports the information as a note that can
be used by the fingerprinting engine. Additionally, consolidate
all jenkins data bits into a single note vs a dozen.
bug/bundler_fix
HD Moore 2014-04-02 07:49:39 -07:00
parent 4caeec81f0
commit b8c5e5ddb7
1 changed files with 21 additions and 46 deletions

View File

@ -164,52 +164,37 @@ class Metasploit3 < Msf::Auxiliary
infos[td] = tds[idx+1].get_text.to_s.strip if infos.has_key?(td)
end
fprint = {}
jinfo = {}
# print out the goodies
infos.each do |k, v|
next if v.nil?
v = v.strip
next if v.length == 0
jinfo[k.gsub(/\s+/, '_')] = v
case k
when "os.name"
vprint_line(" OS: #{v}")
report_host({:host => rhost, :os_name => v})
fprint['os.product'] = v
when "os.version"
vprint_line(" OS Version: #{v}")
report_host({:host => rhost, :os_flavor => v})
fprint['os.version'] = v
when "sun.os.patch.level"
vprint_line(" Patch Level: #{v}")
when "os.arch"
vprint_line(" Arch: #{v}")
report_note({
:type => "system_arch",
:host => rhost,
:data => "Arch: #{v}",
:update => :unique_data
})
fprint['os.arch'] = v
when "user.name"
vprint_line(" User: #{v}")
report_note({
:type => "jenkins_user",
:host => rhost,
:port => rport,
:proto => 'tcp',
:data => "User: #{v}",
:update => :unique_data
})
when "USERDOMAIN"
vprint_line(" Domain: #{v}")
report_note({
:type => "system_domain",
:host => rhost,
:data => "Domain: #{v}",
:update => :unique_data
})
fprint['host.domain'] = v
when "COMPUTERNAME"
vprint_line(" Computer Name: #{v}")
report_note({
:type => "system_computer",
:host => rhost,
:data => "Computer Name: #{v}",
:update => :unique_data
})
fprint['host.name'] = v
when "SystemDrive"
vprint_line(" System Drive: #{v}")
when "SHELL"
@ -222,30 +207,20 @@ class Metasploit3 < Msf::Auxiliary
vprint_line(" Home Directory: #{v}")
when "user.language"
vprint_line(" Language: #{v}")
report_note({
:type => "system_lang",
:host => rhost,
:data => "Language: #{v}",
:update => :unique_data
})
fprint['os.language'] = v
when "user.country"
vprint_line(" Country: #{v}")
report_note({
:type => "system_country",
:host => rhost,
:data => "Country: #{v}",
:update => :unique_data
})
when "user.timezone"
vprint_line(" Timezone: #{v}")
report_note({
:type => "system_timezone",
:host => rhost,
:data => "Timezone: #{v}",
:update => :unique_data
})
end
end
# Report a fingerprint.match for OS fingerprinting support, tied to this service
report_note(:host => rhost, :port => rport, :proto => 'tcp', :ntype => 'fingerprint.match', :data => fprint)
# Report a jenkins information note for future analysis, tied to this service
report_note(:host => rhost, :port => rport, :proto => 'tcp', :ntype => 'jenkins.info', :data => jinfo)
vprint_line('')
end
end