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.
Description
Showing the SMB Spider option some love as I wanted to add some quality of life changes. This should hopefully make searching for files and directories in shares using Netexec a lot nicer.
Type of change
Setup guide for the review
Run using poetry on the following system
All tests uses the following HTB Academy Lab setup to test the spider module
Screenshots and Code Snippets
Pattern Searching
By default it searches for all files and directories within the share if you don't specify a specific pattern or regex.
Only-Folder or Only-Files option
Can now search for either files or folder using the only-folder and only-files option
Ignore . and .. folders
These significantly reduce the amount of unnecessary output especially on shares with an abundance of folders.
New spider-all option
Previously, you had to use
--spider "*"
to search for the all the shares which wasn't obvious until you looked at the code.Changed the arguments to include a
--spider-all
option if a user wants to spider all the shares.Exclude Folder
Can now exclude multiple folder. I changed the name of this option to
exclude-folders
out of personal preference but happy to revert toexclude-dirs
Fixed bug with Depth option
The depth option did not seem to work with the current version of Spider. I've fixed it so now it now works.
Various Code Improvements
The most notable changes:
nxc/protocols/smb.py
.--content
on$IPC
share. It now catches the Netbios ErrorChecklist:
poetry run python -m ruff check . --preview
, use--fix
to automatically fix what it can)