SMB | CIFS / SMB client in python

 by   dvenrao Python Version: Current License: No License

kandi X-RAY | SMB Summary

kandi X-RAY | SMB Summary

SMB is a Python library. SMB has no bugs, it has no vulnerabilities and it has low support. However SMB build file is not available. You can download it from GitHub.

This is a python smbclient that can generate smb/cifs request by reading the commands from the testscript. This client can be used with either with Windows/Samba CIFS server or CIFS proxy.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              SMB has a low active ecosystem.
              It has 8 star(s) with 5 fork(s). There are 1 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              SMB has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of SMB is current.

            kandi-Quality Quality

              SMB has 0 bugs and 0 code smells.

            kandi-Security Security

              SMB has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              SMB code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              SMB does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              SMB releases are not available. You will need to build from source code and install.
              SMB has no build file. You will be need to create the build yourself to build the component from source.
              Installation instructions are available. Examples and code snippets are not available.
              It has 9989 lines of code, 592 functions and 46 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed SMB and discovered the below as its top functions. This is intended to give you an instant insight into SMB implemented functionality, and help decide if they suit your requirements.
            • Compute the Lmhash of a password
            • Expand a DES key into an 8 - byte string
            • Encrypts a message with the given key
            • Encrypt a string
            • Get NTLM V1 response
            • Encrypts the NTLM SSP password
            • Create a Lock structure
            • Extends the request structure
            • Get Oplock request structure
            • Extends request structure
            • Create a change notification structure
            • Extends a change notification
            • Create a new structure
            • Extend the request structure
            • Convert a key to a key64
            • Set the odd parity of the key
            • Create a write request structure
            • Build query info request
            • Close the file
            Get all kandi verified functions for this library.

            SMB Key Features

            No Key Features are available at this moment for SMB.

            SMB Examples and Code Snippets

            No Code Snippets are available at this moment for SMB.

            Community Discussions

            QUESTION

            Convert Windows/MacOS links and share them with colleagues
            Asked 2022-Mar-22 at 10:43

            Is there an easy solution for Windows/MacOS link conversion to share links with colleagues?

            I have a windows link for e.g.:

            ...

            ANSWER

            Answered 2022-Mar-22 at 10:43

            The easiest way I came across is the Linkconverter App. The app converts both ways:

            Source https://stackoverflow.com/questions/71570573

            QUESTION

            Can I set permissions on an SMB share that is shared from a read-only resource?
            Asked 2022-Feb-25 at 14:23

            I'm a bit puzzled by this: someone who no longer works at our company told our client before leaving that what I'm about to describe is feasible, but I'm at a loss for how.

            Our client is getting an smb share as read-only from one of their partners. I have absolutely no control over this. This share is mounted on one of our file servers at /mnt/share.

            My task is to set up a share from /mnt/share to the clients active directory users, which i have done sucessfully, but I also need to set permissions on certain sensitive subfolders that should be accessible by only certain active directory groups. (for example, only users in the Accounting group should be able to read the "Accounting" subfolder)

            According to all documentation I've read, this is impossible because the files "on disk" are read-only (since they are really just a mounted smb share). Attempts to set permissions anyway have been met with no feedback.

            The file server is RHEL 7.x (it is in the correct AD realm) and I also have Admin access to Active Directory.

            To summarize:

            Partner SMB share (read only) -----> File server | SMB share -------[This is where I need to set permissions]-------> user machines.

            ...

            ANSWER

            Answered 2022-Jan-17 at 13:51

            • Since the SMB share itself has read-only permissions on the RHEL 7.X file server, they define the on-disk permissions set for that share on the file server as well as the other network resources that access it. Thus, as the file server has authority of the SMB share and only read-only access has been defined on it for all other users that access it, so even if you try to map it on other systems that run Windows, it will only be a read-only folder without any other permissions on it.

            Hence, to set file and folder level ACL permissions on it, you will have to enable read, write, and execute permissions to all the users on that share and then map it on a Windows system by logging in it with AD administrator credentials and set custom permissions accordingly in its directory as per the requirement. In this way, you would be able to assign the correct permissions to a user/group or a resource on a file/folder or a directory in that share.

            Thus, to change the permissions of the ‘/mnt/share’ on RHEL 7.X file server, please execute the below command in the terminal by logging as the root user.

            Browse to the SMB share on linux terminal and run ‘ls -dl’, it will show all the permissions set for the share. Then run ‘chmod a=rwx’, this will set ‘Read, write and execute’ permissions on the share to all the users. Then, run ‘ls -l’ again on the terminal to check the newly modified permissions on the share. It should display as ‘drwxrwxrwx’ which means the permissions have been set correctly.

            Please refer the below link for more reference: -

            https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_basic_system_settings/assembly_managing-file-permissions_configuring-basic-system-settings

            Source https://stackoverflow.com/questions/70604661

            QUESTION

            Backup of svn repository to shared folder on NAS fails
            Asked 2022-Feb-07 at 14:08

            I want to set up an automatic incremental backup of my SVN repositories. Doing that to a local folder of the same PC seems to work, but if I try to write the files directly to a shared folder (I tried 2 different QNAP nas boxes) I get various errors, always a couple of hundred lines.

            I tried

            ...

            ANSWER

            Answered 2022-Feb-07 at 12:59
            • What protocol does your NAS use?
            • Do you see errors when you run the Backup-SvnRepository PowerShell cmdlet?
            • What VisualSVN Server version and the version of SVN command-line tools are you using? I.e., what svnadmin --version says?

            Note that you can consider the built-in Backup and Restore feature. It supports backup scheduling, encryption, incremental backups and backups to remote shares and Azure Files cloud. See KB106: Getting Started with Backup and Restore and KB137: Choosing backup destination.

            I want to set up an automatic incremental backup of my SVN repositories. Doing that to a local folder of the same PC seems to work, but if I try to write the files directly to a shared folder (I tried 2 different QNAP nas boxes) I get various errors, always a couple of hundred lines.

            From what I see, an unexpected network error indeed occurs when you hotcopy the repository onto your NAS. Please, double-check that you are using up-to-date Subversion command-line tools (what svnadmin --version says?).

            I've shut down the svn service, so there's no danger of someone working on svn in the meantime. Still same problem.

            You don't need to stop the server's services when you run svnadmin hotcopy:

            [[[

            This subcommand makes a “hot” backup of your repository, including all hooks, configuration files, and, of course, database files. You can run this command at any time and make a safe copy of the repository, regardless of whether other processes are using the repository.

            ]]]

            Source https://stackoverflow.com/questions/71018537

            QUESTION

            Powershell: Passed array returns $true
            Asked 2022-Feb-03 at 08:40

            I'm pretty sure I have some synthax error in here, but i can't find it.

            I wrote this little script here to find some Files in a Folder - I want all the Filepaths that don't have some of the terms in the $excludeList in there but my Contains-Function always returns $true. And when I enable the Write-Output-Line, it also, always sais $true

            ...

            ANSWER

            Answered 2022-Feb-03 at 08:40

            you need to remove parenthesis and comma in - if (!(Contains($_, $excludeList))) { $_ }

            you have a problem with passing argument to a function. look here: How do I pass multiple parameters into a function in PowerShell?

            Source https://stackoverflow.com/questions/70967233

            QUESTION

            How to rename nested directories and files recursively using pysmb in python?
            Asked 2022-Jan-20 at 16:23

            Recently, I had to rename all space characters used in the directory and file names in a Samba tree. Before that, I used os.walk to traverse the directory tree of regular files in python, but I wanted to rename them in-place.

            To connect to my Samba server and rename a single file, I used this snippet:

            ...

            ANSWER

            Answered 2022-Jan-20 at 16:23

            Finally I find a sample code as follow in pysmb here as os.walk:

            Source https://stackoverflow.com/questions/70549980

            QUESTION

            How can I statically link my project dependencies using vcpkg with Visual Studio?
            Asked 2022-Jan-16 at 21:52

            I've read some ways to do what I want but none of them worked and they end up using the same method.

            I've tried this solution, which I couldn't make it work...

            Here's what I get outputed:

            ...

            ANSWER

            Answered 2022-Jan-16 at 21:52

            You need to set your lib directory under Configratuon Properties->VC++ Directories to vcpkg static lib directory. On top of that you need to then link the libs under the Configuration Properties->Linker or using pragma comment(lib,"libname")

            Source https://stackoverflow.com/questions/70734450

            QUESTION

            AppleScript Run Application
            Asked 2022-Jan-10 at 01:40

            I have this script here that needs to mount a network folder, verify that it is mounted, and then start the application. When 'tell application appName to activate' is outside the 'tell application "System Events"' statement, it works. But as it is written below, the application will not open. Additionally, when I replace 'appName' with "QuickBooks", the programs opens as it is written below.

            Any help would be greatly appreciated.

            ...

            ANSWER

            Answered 2022-Jan-10 at 01:40

            QUESTION

            Dynamic storages in Kubernetes
            Asked 2021-Dec-20 at 09:32

            I have an application running on Kubernetes that needs to access SMB shares that are configured dynamically (host, credentials, etc) within said application. I am struggling to achieve this (cleanly) with Kubernetes.

            I am facing several difficulties:

            • I do not want "a" storage, I want explicitly specified SMB shares
            • These shares are dynamically defined within the application and not known beforehand
            • I have a variable amount of shares and a single pod needs to be able to access all of them

            We currently have a solution where, on each kubernetes worker node, all shares are mounted to mountpoints in a common folder. This folder is then given as HostPath volume to the containers that need access to those storages. Finally, each of those containers has a logic to access the subfolder(s) matching the storage(s) he needs.

            The downside, and the reason why I'm looking for a cleaner alternative, is:

            • HostPath volumes present security risks
            • For this solution, I need something outside Kubernetes that mounts the SMB shares automatically on each Kubernetes node

            Is there a better solution that I am missing?

            The Kubernetes object that seems to match this approach the most closely is the Projected Volume, since it "maps existing volume sources into the same directory". However, it doesn't support the type of volume source I need and I don't think it is possible to add/remove volume sources dynamically without restarting the pods that use this Projected Volume.

            ...

            ANSWER

            Answered 2021-Dec-17 at 12:51

            For sure your current solution using HostPath on the nodes is not flexible, not secure thus it is not a good practice.

            I think you should consider using one of the custom drivers for your SMB shares:

            CIFS FlexVolume Plugin:

            This solution is older and it is replaced by a CSI Driver. The advantage compared to CSI is that you can specify SMB shares directly from the pod definition (including credentials as Kubernetes secret) as you prefer.

            Here you can find instructions on how to install this plugin on your cluster.

            SMB CSI Driver:

            This driver will automatically take care of mounting SMB shares on all nodes by using DaemonSet.

            You can install SMB CSI Driver either by bash script or by using a helm chart.

            Assuming you have your SMB server ready, you can use one of the following solution to access it from your pod:

            In both cases you have to use a previously created secret with the credentials.

            In your case, for every SMB share you should create a Storage class / PV and mount it to the pod.

            The advantage of CSI Driver is that it is newer, currently maintained solution and it replaced FlexVolume.

            Below is diagram representing how CSI plugin operates:

            Also check:

            Source https://stackoverflow.com/questions/70260791

            QUESTION

            Getting permissions of a remote SMB/CIFS share without remote powershell or WMI
            Asked 2021-Dec-15 at 18:37

            I'm looking for a way to export the ACL of a SMB / CIFS share (not to be confused with the NTFS ACL) from a Windows machine connected to the share. So far, I can see the permissions in the advanced security properties of the share, but no way to export or parse them short of an AutoIT monstrosity.

            I want to obtain this information in a format that I can parse, be it CSV, JSON, XML, etc.

            I have checked this question which recommends using Powershell's Get-SmbShareAccess: Retrieving Remote File Share 'Share Permissions' Using Powershell and this TechNet question which uses Get-WmiObject: Get-wmiobject Win32_Share does not show Sharing Permissions but both assume we can get Powershell code executed on the server hosting the share: this isn't the case for me as the share is not hosted on windows and I don't have shell access to the machine.

            I'm open to any language but would prefer Powershell if given the choice.

            ...

            ANSWER

            Answered 2021-Dec-15 at 18:37

            Windows explorer uses RPC via the win32 API method NetShareGetInfo(), but it's not easy to call it directly from Powershell.

            FileShareUtils is a fantastic gallery module that does all of this for you, and the best option that I could find:

            Source https://stackoverflow.com/questions/70365614

            QUESTION

            How to detect Hidden Files in a folder in Go - cross-platform approach
            Asked 2021-Dec-10 at 05:28

            I'm iterating through a mounted folder via filePath.Walk method in golang, but it returns the hidden files as well. I have to skip those hidden files. For MaxOS and Linux, we can detect hidden file via .prefix in the filename, but for windows, when I'm trying to us this method GetFileAttributes, provided by "syscall", it's not detecting these methods and throwing an error.

            Using below method to fetch the file

            err := filepath.Walk(prefix, func(docPath string, f os.FileInfo, err error) error {

            Below is how I'm trying to detect the hidden files

            ...

            ANSWER

            Answered 2021-Dec-09 at 16:36

            Conditional compilation is the right way to go, but it applies at source file level, so you need two separate files.

            For example:

            hidden_notwin.go:

            Source https://stackoverflow.com/questions/70291933

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install SMB

            Following python modules have to be installed for using the pysmbclient. a) Windows: ------- Python 2.6 [ complete installation ] pycrypto-2.0.1.win32-py2.6.exe. b) Linux: ------ Python 2.6/python 2.4 Python unicodedata module Python Crypt module.
            Populate smbsetup.cfg with appropriate details before using pysmblcient. The smbsetup.cfg can be divided into 1) Connection settings a) CIFS server/proxy IP address b) Port c) User credentials d) Authentication mode. 2) Client Capabilites a) Unicode b) Longname in Request/Response c) 32 bit status code d) Oplock Level 2 supported.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/dvenrao/SMB.git

          • CLI

            gh repo clone dvenrao/SMB

          • sshUrl

            git@github.com:dvenrao/SMB.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link