-
Notifications
You must be signed in to change notification settings - Fork 13.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
database host info from post modules #10823
Conversation
@bcoles mind giving this a look? I Know you have a few more solaris boxes to test against, and while I <3 ubuntu, you tend to have other flavors. |
Pre patch:
Post patch (spacing off due to ip rewrite):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does report host gracefully deal with no db? Looks sane and useful to me.
This should be ready to test now that the blocker has landed. |
I ran some tests on Linux and Solaris. I haven't had a chance to test OSX yet. I also tried a couple quick tests without a database connected and encountered no issues. While not directly relevant to this PR, on a somewhat related note, CentOS is incorrectly identified as # Amazon
elsif etc_files.include?("system-release")
version = read_file("/etc/system-release").gsub(/\n|\\n|\\l/,'')
system_data[:distro] = "amazon"
system_data[:version] = version
Linux
Solaris
It looks like the version detection could be improved. Here's the current version check: if system_data[:version] =~ /([\d]?\d\.\d)/
host_info[:os_flavor] = $1
end Note that it only matches Here's the reported version from the system lib for a Solaris 9 box: The host flavor reporting portion of the method should probably trust the system lib. Same as the Linux and OSX flavor reporting. MiscI did encounter this error, twice, but I'm not sure what caused it, and wasn't able to reproduce it.
|
Tested on OSX. There's a typo that needs to be fixed, as per above. Apart from that, it worked as described.
|
The OSX |
Agreed. The OSX libraries have been neglected. I only have a The |
@bcoles |
@h00die Prior to 11.x the typical naming pattern was in the form of Using |
@bcoles i always hated the |
@h00die How far down the rabbit hole do you want to go? See #10437 for a bunch of example x86 / x64 / Intel ArchitectureThe regex will run into issues with Solaris Nevada (10u3) and Solaris 8: {:version=>"Solaris Nevada snv_50 X86", :kernel=>"SunOS unknown 5.11 snv_50 i86pc i386 i86pc", :hostname=>"unknown"} {:version=>"Solaris 8 1/01 s28x_u3wos_08 INTEL", :kernel=>"SunOS unknown 5.8 Generic_108529-05 i86pc i386 i86pc", :hostname=>"unknown"} SPARCThe regex won't work for SPARC, which makes use of The versioning also gets a whole lot trickier when taking into account rebuilds and kernel patches which also modify the |
There's also the issue of the hardcoded Edit: It appears OpenSolaris does not reveal its presence in the |
@bcoles Ok, I'd like to not make a 90+ character regex to catch it all the solaris pokemon, so I broke it down in to 3. I like the idea of hardcoding Solaris as I think it makes life easier for GUI developers, but meh. test strings:
Regexes which I believe catch everything correctly.
If these look good to you, i'll implement them, and this can be landed. Also keep in mind, if something isn't caught properly by a regex, it'll skip the DBing which is more or less the current behavior, so no big loss. PS, the more you teach me about solaris and its derivatives, the more I don't like it. |
Looks reasonable.
In the long term, it might be better to implement parsing of Edit: I realize this PR was intended to simply catch and report information that would have been ignored otherwise. It doesn't break anything, and I agree with the Edit 2: There's also no existing convention for reporting host details. It's taken years for the database to become popular. Many modules still don't report hosts, services or vulns. I'm keen to get this landed and move on. We can circle back to improving the Solaris libs later.
It's a matter of perspective. The path to Solaris enlightenment starts with throwing preconceived ideas out the window. Solaris cares not for IBM / MS propaganda. |
@bcoles should be good to land 😉 |
Test cases look good. WFM.
|
Release NotesThis updates the post/system libraries for Linux, OS X, and Solaris to store retrieved host system information in the database. |
Requires: #10857
The
lib/msf/core/post/*/system.rb
modules pullhostname
,os
andkernel
, but never bother to database them. Seems like wasted effort, it should definitely be saved once we see it!This PR adds to the
system.rb
libraries calls to database information we gather from post modules about the host.I DO NOT HAVE AN OSX BOX TO TEST!!!!!!!!!!!!
Verification
msfconsole
get_sysinfo
call (for linux,get_hostname
as well)hosts
now has more data populated