Skip to main content

A package to show and set windows files permissions

Project description

Pyicacls

A package for simple Windows ACL management, much like the windows icacls binary. This package can run both on UNIX machines and Windows machines.

How to use?

For regular IT purposes you can use the script attached in the example folder.

python examples/icacls.py -h
usage: icacls.py [-h] --ip IP --user USER [--password PASSWORD] [--domain DOMAIN] [--share SHARE] --file-path FILE_PATH [--target-user TARGET_USER]
                 [--permissions PERMISSIONS]

optional arguments:
  -h, --help            show this help message and exit
  --ip IP               ip of the target pc
  --user USER           user name to authenticate with
  --password PASSWORD   password to authenticate with (empty for interactive typing)
  --domain DOMAIN       domain of the user (empty for local workgroup)
  --share SHARE         share name to connect to
  --file-path FILE_PATH
                        file path to view / change permissions
  --target-user TARGET_USER
                        target user to change his permission
  --permissions PERMISSIONS
                        permissions to change in the format of <permission char>,<permission char>. example: R,W 

For creating automated scripts and other advanced tasks you can use the PermissionsGetter and PermissionsSetter.

To view permissions

from pyicacls.getter import PermissionsGetter
s = PermissionsGetter('127.0.0.1', 'MyPc', 'MyUsername', 'MyPassword', 'MyDomain')

s.get_permissions('share', 'file.txt')

Example output:

Owner:  Home
Group:  Domain Users
Dacl's: Guest:(R):(W)(X)
        Administrator:(R)(D):(W)(X)
        Martin:(I):(R)(w)(D):(F)
        Everyone:(I):(R)(w)(D):(F)

To set permissions

from pyicacls.setter import PermissionsSetter
s = PermissionsSetter('127.0.0.1', 'MyPc', 'MyUsername', 'MyPassword', 'MyDomain')

s.set_permissions('share', 'file.txt', 'Guest', 'R,W')

The output for this operation will be bool - whether the operation succeeded or not.

To remove permissions

Simply pass None for the permissions parameter of the set_permissions function.

s.set_permissions('share', 'file.txt', 'Guest', None)

This will remove all permissions of the user Guest.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyicacls-1.0.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

pyicacls-1.0.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file pyicacls-1.0.1.tar.gz.

File metadata

  • Download URL: pyicacls-1.0.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1

File hashes

Hashes for pyicacls-1.0.1.tar.gz
Algorithm Hash digest
SHA256 9a0e9b0a167e4f3b93930dabcc48d125e158fcf902c8bdf098440329556a02f7
MD5 36e17bb1eee18a804610c8c5a6f63fc6
BLAKE2b-256 042d0f6ff835f05c001a2f4baa4609b677569950c8b375fc43072c11c67658f2

See more details on using hashes here.

File details

Details for the file pyicacls-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyicacls-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1

File hashes

Hashes for pyicacls-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2b494d919f9e8a9a14cb0a3a0ccb071ae97f082a836471a2f65cb08cc0239f1a
MD5 578c60d9d93a5bab5996d49af5db621e
BLAKE2b-256 f793399b6587a978bc0849ab180a249dcada50b5ccd3e69a275922f70638403b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page