add --get_folder functionality#1190
Conversation
|
@NeffIsBack as requested |
NeffIsBack
left a comment
There was a problem hiding this comment.
The forward slash path bug is still present 🥲 see review: #320 (comment)
Also silent is not applied when downloading a folder, see comment: #320 (review)
|
|
||
| def get_folder(self): | ||
| recursive = self.args.recursive | ||
| ignore_empty = getattr(self.args, "ignore_empty_folders", False) |
There was a problem hiding this comment.
Should be args.ignore_empty_folders
There was a problem hiding this comment.
Good call, it already has a default.
|
Hmm I swear I fixed those, my bad, I'll go back and check, maybe I fixed it and then over-wrote it like a dumbass. |
No worries :D |
Add download_file(), download_folder(), and get_folder() methods to the SMB protocol. Refactor get_file_single() to use download_file() with automatic fallback from READ to READ/WRITE access on sharing violations. New CLI args: --get-folder, --recursive, --ignore-empty-folders Example: nxc smb target -u user -p pass --share SYSVOL --get-folder 'domain\Policies' ./output --recursive
2cfdbd1 to
598afaa
Compare
|
Was that an intended force push? Did something change that I should review? |
lol no, was a rebase :P |
Description
Forking off this functionality from #1168
--get-folder SMB command — Downloads a remote directory from a share to a local destination. Supports --recursive for subdirectories and --ignore-empty-folders to skip empty directories. Includes path traversal protection via filename sanitization.
nxc/helpers/path.py — Path traversal sanitization for SMB filenames
Type of change
Insert an "x" inside the brackets for relevant items (do not delete options)
Setup guide for the review
Testing environment:
Kali Linux (Debian-based)
Python 3.x with NetExec installed from source (I used Poetry, per norm)
Target: SMB share (I used Windows)
To test --get-folder:
nxc smb -u -p --share SYSVOL --get-folder '<remote_path>' '<local_dest>' --recursive
Screenshots (if appropriate):
Screenshots are always nice to have and can give a visual representation of the change.
If appropriate, include before and after screenshot(s) to show which results are to be expected.
Checklist:
Insert an "x" inside the brackets for completed and relevant items (do not delete options)
poetry run ruff check ., use--fixto automatically fix what it can)tests/e2e_commands.txtfile if necessary (new modules or features are required to be added to the e2e tests)