Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

SMB Connection

Hi,

I am trying to code a simple application that asks the user for a username,password & IP range.

It then takes those inputs and attempts to connect to each host in the IP range over SMB.

I have got the program to prompt a user for a username,password & IP range but I am completely stuck with how to get it to try to connect to the machines.

I don't mind paying if someone can help me with this? Any advise would be very welcome...
Hey! What you re looking for could be the pysmb library. You may want to check the relevant documentation here https://pythonhosted.org/pysmb/

Also have a look to the following practical example
https://gist.github.com/joselitosn/e74dbc2812c6479d3678

If it works for one IP then it's a matter of repeating the same code for a range of IPs with a loop.
I've never messed with SMB in Python so I though I'd try it out. That pysmb library was a big pain in the ass! It was just not going to authenticate even to shares are accessible to everyone on the network. Maybe you'll have better luck, but the documentation or support sucks.


As an alternative, you could use the output of the smbclient in Linux. Where you can use $?, which is the exit status of the program. If successful, your user/pass works, it will be 0. If not, it'll be 1.




Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by Freak_OGAug 17, 2020 07:28 AM 15 777 Aug 17, 2020 07:28 AM
Last Post: MavenGradle
[Python] by ccpikNov 10, 2016 12:17 PM 2 156 Nov 10, 2016 12:17 PM
Last Post: SIM-1866423
[.NET] by geraldososaJan 25, 2014 09:02 AM 4 117 Jan 25, 2014 09:02 AM
Last Post: geraldososa