Skip to content

smbclient.py add SMB share permissions check (issues #186) #1989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

oladush
Copy link

@oladush oladush commented Jun 22, 2025

This PR implements share permission checks as requested in #186.

Changes:

  • READ/WRITE/DELETE access check
  • New -check-access flag to verify share permissions
  • Supports -no-write-check to skip write/delete tests

Usage examples:

  1. Check specific shares:
    `python3 examples/smbclient.py 'test:test@127.0.0.1' -check-access 'MY SHARE, IPC$'`

  2. Check all available shares:
    `python3 examples/smbclient.py 'test:test@127.0.0.1' -check-access`

  3. Skip write/delete checks (read-only):
    `python3 examples/smbclient.py 'test:test@127.0.0.1' -check-access -no-write-check`

Fixes (#186)

@covertivy
Copy link
Contributor

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...

@oladush
Copy link
Author

oladush commented Aug 1, 2025

Thanks for the feedback! I’ll check the documentation and rework the permissions check properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants