p0dalirius / smbclient-ng

smbclient-ng, a fast and user friendly way to interact with SMB shares.

Home Page:https://podalirius.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[enhancement] Add 'mount' command

p0dalirius opened this issue · comments

a command to mount the SMB share on the local filesystem (like with mount.cifs).
example usage: mount C$ /mnt/disk
@jdivincuit

#6

Even in impacket smbclient it seems broken

# mkdir foo
# mount Perflogs ./foo
# ls
drw-rw-rw-          0  Fri Apr 12 13:26:53 2024 $Recycle.Bin
drw-rw-rw-          0  Fri Apr 12 22:22:08 2024 Documents and Settings
drw-rw-rw-          0  Sat Jun  8 10:44:36 2024 foo
-rw-rw-rw-  738197504  Sat Jun  8 19:37:48 2024 pagefile.sys
drw-rw-rw-          0  Fri Apr 12 23:20:53 2024 PerfLogs
drw-rw-rw-          0  Wed Jun  5 13:25:19 2024 poc
drw-rw-rw-          0  Mon May 27 21:15:59 2024 Program Files
drw-rw-rw-          0  Mon Apr 15 11:23:37 2024 Program Files (x86)
drw-rw-rw-          0  Wed Apr 24 13:20:13 2024 ProgramData
drw-rw-rw-          0  Fri Apr 12 22:22:09 2024 Recovery
drw-rw-rw-          0  Tue May 21 10:53:05 2024 smbclient-ng
drw-rw-rw-          0  Fri Apr 12 15:39:00 2024 System Volume Information
drw-rw-rw-          0  Sun May 26 12:52:40 2024 TestShare
drw-rw-rw-          0  Mon May 20 21:14:24 2024 Users
drw-rw-rw-          0  Mon Jun  3 10:04:26 2024 Windows
# cd foo
[-] SMB SessionError: STATUS_REPARSE_POINT_NOT_RESOLVED(The NTFS symbolic link could not be resolved even though the initial file name is valid.)```

Implemented 👀

image

Excellent. but I was thinking of an implementation similar to what mount.cifs does, not a wrapper.
The major problem with mount.cifs is that it does not offer pass-the-hash authentication.
I was thinking it would be an innovation for smbclient-ng, as this feature has always been broken in smbclient.py.
The advantage of the mount command is the ability to use every Linux command such as find, zip etc. directly on the Windows files.

I understand but it is not feasible, the codebase is very fat (https://github.com/aaptel/cifs-utils/blob/master/mount.cifs.c), and that is only for linux systems. I would need to reimplement it for windows and mac too, which is not possible in a reasonable timeframe. It might be easier to do a Pull Request on https://github.com/aaptel/cifs-utils/ I think

It seems that the mount feature in impacket smbclient.py is not a real mount as we intend it to be. Instead it is more of like a symbolic link inside the share.