Port 139 is used for file and printer sharing over NetBIOS, running over TCP/IP. On the other hand, port 445 is used for direct SMB communications without the need for NetBIOS.
//anonymous login
smbclient -N //IP/support-tools
//valid
smbclient -L \\\\IP\\ -U admin
smbclient \\\\IP\\public -U admin
//Connecting to the Share
smbclient -N -L //10.129.14.128
> recurse ON [**`get`, `mget`, `put`, `mput`, `del`, `mdir`, etc.) to specify whether the command should operate recursively on directories**]
> prompt [Disable interactive prompts for multiple file downloads]
> mget *
> dir /?
Smbcalcs
Set or get ACLs on an NT file or directory names
smbcacls -N '//10.129.216.197/Department Shares' Users
for i in $(ls); do echo $i; smbcacls -N '//10.129.216.197/Department Shares' $i; done
[Inheritance rights may precede either perm form:] (I) - Inherit. ACE inherited from the parent container. alice create the file alice will get r&w no need to set it. (OI)`` - Object inherit. Objects in this container will inherit this ACE. Applies only to directories. (CI)- Container inherit. Containers in this parent container will inherit this ACE. Applies only to directories. (IO)- Inherit only. ACE inherited from the parent container, but does not apply to the object itself. Applies only to directories. (NP)` - Do not propagate inherit. ACE inherited by containers and objects from the parent container, but does not propagate to nested containers. Applies only to directories.
git clone https://github.com/cddmp/enum4linux-ng.git
cd enum4linux-ng
pip3 install -r requirements.txt
./enum4linux-ng.py 10.129.14.128 -A
Rpcclient
rpcclient -U "" 10.129.14.128
//enum
srvinfo //Server information.
enumdomains //Enumerate all domains that are deployed in the network.
querydominfo //Provides domain, server, and user information of deployed domains.
netshareenumall //Enumerates all available shares.
netsharegetinfo <share> //Provides information about a specific share.
enumdomusers //Enumerates all domain users.
queryuser <RID> //Provides information about a specific user.
Brute Forcing user RIDs
for i in $(seq 500 1100);do rpcclient -N -U "" 10.129.14.128 -c "queryuser 0x$(printf '%x\n' $i)" | grep "User Name\|user_rid\|group_rid" && echo "";done
https://www.hackingarticles.in/impacket-guide-smb-msrpc/ or [[Impacket Guide SMB_MSRPC]]