feat(audit): ask the questions a port number cannot answer - #8
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The complaint this answers: "right now it's pretty just a naked little scan that looks for open ports". That was a coverage problem, not an architecture one - ten ports and no version detection, so on a clean LAN the audit produced a single
infoline. On the same LAN it now produces five, all evidence-backed and none of them invented.--ports top100- nmap's frequency ranking as a named set, mixable with numbers (--ports top100 3000). The port scan is now flat across every(ip, port)rather than a pool of devices each walking its own list, so a packet-dropping device costs one timeout instead of a hundred consecutive ones.probe.py- the layer between "what is here" and "what it means". It speaks just enough TLS, SMB, DNS and SSH to turn 445 is open into this server accepted the 1996 dialect. Parsers are split from sockets, so the fiddly half is bytes in, a value out.audit.pystill opens no socket and does not import it.smb-v1(high),ssh-weak-algorithmsandtls-cert-expired(medium),service-version,tls-cert-untrustedanddns-recursion-open(info). The last two are explicitly labelled not-a-problem, for the same reasonopen-ports-notedis: every home router would fire them, and a report that flags the normal case trains you to ignore it.Three bugs found on the way, each of the fail-silently kind:
SMB_HEADER_SIZEis now asserted by a test rather than trusted.parse_kexinitread all ten name-lists, so compressionnone- which every SSH server offers - was read as the ciphernone. It would have flagged every SSH server on earth. Only the first six lists are read now.service-versionfired onHTTP/1.0 200 OK, reporting the protocol version as the software. Caught by an existing test - the anti-theater half oftest_audit.pydoing its job.Verified against real servers rather than only fixtures: two Samba containers with SMBv1 on and off (both replies are now the test fixtures), a real OpenSSH server, a CA-issued certificate off the wire, and a live LAN.
DEFAULT_PORTSis unchanged on purpose - adding even port 53 would reportport-openedon everyone's router on their next scan, which is the one failure modediff.pyexists to avoid.