smbclient.py add SMB share permissions check (issues #186)
This PR implements share permission checks as requested in #186.
Changes:
- READ/WRITE/DELETE access check
- New
-check-accessflag to verify share permissions - Supports
-no-write-checkto skip write/delete tests
Usage examples:
-
Check specific shares:
`python3 examples/smbclient.py 'test:[email protected]' -check-access 'MY SHARE, IPC$'` -
Check all available shares:
`python3 examples/smbclient.py 'test:[email protected]' -check-access` -
Skip write/delete checks (read-only):
`python3 examples/smbclient.py 'test:[email protected]' -check-access -no-write-check`
Fixes (https://github.com/fortra/impacket/issues/186)
There exists a better way of enumerating share information: one can request a share information query for level 2 or 502 and the returned struct will also hold a permissions attribute.
This is a much better way to check privileges without manually testing each access possibility by uploading and modifying random files...
It is an important feature for sure but I would advise you implement it differently...
Thanks for the feedback! I’ll check the documentation and rework the permissions check properly.