Add OS Fingerprinting#31
Merged
Merged
Conversation
Closed
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.
OS Fingerprinting
This adds operating system fingerprinting capabilities to complement the existing features. Users can now identify the OS type based on TTL, window size, and MAC address patterns.
Closes #17.
Fingerprinting Methods
TTL (Time to Live) Analysis: By examining the TTL value in the IP header, disco can make guesses about the operating system. Different OSes have different default TTL values, e.g., 64 for Linux, 128 for Windows. Cisco devices apparently use a TTL of 255, but this has not been tested. It is still supported though.
Window Size Examination: The TCP window size can also provide clues about the OS. For instance, certain OSes use specific window sizes. BSD-like systems often use a window size of 65535. My testing shows that macOS is consistently using a window size of 65535, in line with its BSD-based network stack. To separate macOS and other BSD-like systems from Linux, window size is used. There is currently no reliable way (for me) to separate Linux from the other Unix-like OSes.
MAC Address Pattern Matching: The MAC address of the target reveals the manufacturer of the network card, which can reveal information about the OS. Because newer Apple devices use their own network cards, I implemented a check for Apple MAC address prefixes (e.g., 10:BD:3A) to identify macOS systems. This enables disco to distinguish macOS from other BSD-like systems. This also means that Macs have the most accurate fingerprinting, since MAC fingerprinting has not been implemented for other manufacturers.
Bonus Target Info
The fingerprinting allows for calculations of the estimated number of hops between the scanning host and the target, based on the identified OS's default TTL value. This information could be useful for network diagnostics and understanding the network topology. The MAC address is also printed without Vendor lookup (except Apple), allowing users to gain more information about the target device with a quick online search.
Changed Files
include/cli.handsrc/cli.cinclude/fingerprint.hsrc/fingerprint.cinclude/syn_scan.hsyn_scan()functionsrc/syn_scan.csrc/main.csyn_scan()structtests/cli_test.ctests/include/fingerprint_test.htests/fingerprint_test.ctests/run_all_tests.ctests/syn_scan_test.c