Land #10823, store host system data from post/system libs in database

GSoC/Meterpreter_Web_Console
Brendan Coles 2018-11-06 02:54:02 +00:00
commit a8ff9b27f7
No known key found for this signature in database
GPG Key ID: 3EB700FCFBA899B5
3 changed files with 34 additions and 1 deletions

View File

@ -99,6 +99,13 @@ module System
system_data[:version] = ''
end
report_host({
:host => rhost,
:os_name => system_data[:distro],
:os_flavor => system_data[:version]
})
return system_data
end
@ -148,7 +155,9 @@ module System
# @return [String]
#
def get_hostname
cmd_exec('uname -n').to_s
hostname = cmd_exec('uname -n').to_s
report_host({:host => rhost, :name => hostname})
rescue
raise 'Unable to retrieve hostname'
end

View File

@ -17,6 +17,13 @@ module Msf::Post::OSX::System
system_info["Kernel"] = cmd_exec("uname -a")
system_info["Hostname"] = system_info["Kernel"].split(" ")[1]
report_host({
:host => rhost,
:os_name => 'osx',
:os_flavor => system_info["Kernel"],
:name => system_info["Hostname"]
})
return system_info
end

View File

@ -22,6 +22,23 @@ module System
system_data[:version] = version
system_data[:kernel] = kernel_version
system_data[:hostname] = kernel_version.split(" ")[1]
host_info = {
:host => rhost,
:os_name => 'Solaris',
:name => system_data[:hostname]
}
# Test cases for these can be found here:
# http://rubular.com/r/MsGuhp89F0
# http://rubular.com/r/DWKG0jpPCk
# http://rubular.com/r/EjiIa1RFxB
if /(?<OS>(?<!Open|Oracle )Solaris).+s2?(?<major>\d?\d)[x|s]?(_u)(?<minor>\d?\d)/ =~ system_data[:version]
host_info[:os_flavor] = "#{major}.#{minor}"
elsif /(?<OS>Oracle Solaris) (?<major>\d\d)\.(?<minor>\d?\d)/ =~ system_data[:version]
host_info[:os_flavor] = "#{major}.#{minor}"
elsif /(?<OS>OpenSolaris|OpenIndiana [\w]+) (?<major>\d\d\d\d)\.(?<minor>\d\d)/ =~ system_data[:version]
host_info[:os_flavor] = "#{major}.#{minor}"
end
report_host(host_info)
return system_data
end