Added Sample - Host Search Advanced #1174
Merged
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.
Host Search Advanced - Sample
I wanted to introduce some more flexibility for host searches. A potential use case could be to discover additional endpoints where the domain is known, or the naming pattern is known, but not all endpoints have been added to a regular search where the exact FQDN is used.
The host_search_advanced.py will take a partial match in order to find all hosts matching the given pattern in a hostname file. This can help with the above mentioned reconciliation.
Additionally, the updated host read function to ignore comments in the hostname file has been incorporated, this keeping output.csv files cleaner.
The READEME.md has also been updated to explain this.
Bandit analysis
Added features and functionality
This script retains the original functionality of host_search.py above, but adds in functionality for partial matches of hostnames. This will help with endpoint discovery where the domain is known, or a pattern of host naming is known, but not all endpoints have been discovered.
This script will also ignore comments in a hostname file, thus keeping the output.csv cleaner.
To read an input file of hostnames, the -f option (used in the original host_search.py) has been changed to -i. This made more sense considering the more "insensitive" nature of the search, and makes a visual idendification of the full command easier if you use both the original host_search.py, and the host_search_advanced.py. A potential use case could be to discover hosts using the 'advanced' search, in order to reconcile with hostname files for use with the original host search.
Command-line help
Command-line help is available via the -h argument.
Other
Source Code: host_search_advanced.py
Updated Documentation: README.md