NMAP# Alive hostsnmap -sn 10.0.0.0/24# scan the 1024 most common ports, run OS detection, run default nmap scriptsnmap -A -oA nmap <targetip># Scan more deeply, scan all 65535 ports on $targetip with a full connect scannmap -v -sT <targetip> -p-# more optionsnmap -sV -sC -v -A <targetip> -p-nmap -sT -sV -A -O -v -p 1–65535 <targetip># my preferencenmap -sV -sC -v -oA output <targetip>nmap -p- -v <targetip>------------------------SMBPort 139 and 445- SMB/Samba sharesSamba is a service that enables the user to share files with other machinesworks the same as a command line FTP client, may browse files without even having credentials# Share List:smbclient --list <targetip>smbclient -L <targetip># Check SMB vulnerabilities:nmap --script=smb-check-vulns.nse <targetip> -p445# basic nmap scripts to enumerate shares and OS discoverynmap -p 139,445 192.168.1.1/24 --script smb-enum-shares.nse smb-os-discovery.nse# Connect using Usernameroot@kali:~# smbclient -L <targetip> -U username -p 445# Connect to Sharessmbclient \\\\<targetip>\\ShareNamesmbclient \\\\<targetip>\\ShareName -U john# enumarete with smb-shares, -a “do everything” optionenum4linux -a 192.168.1.120# learn the machine name and then enumerate with smbclientnmblookup -A 192.168.1.102smbclient -L <server_name> -I 192.168.1.105# rpcclient - Connect with a null-session (only works for older windows servers)rpcclient -U james 10.10.10.52rpcclient -U "" 192.168.1.105(press enter if asks for a password)rpcclient $> srvinforpcclient $> enumdomusersrpcclient $> enumalsgroups domainrpcclient $> lookupnames administratorsrpcclient> querydominforpcclient> enumdomusersrpcclient> queryuser john# scan for vulnerabilities with nmapnmap --script "vuln" <targetip> -p139,445------------------------SMTP# telnet or netcat connectionnc <targetip> 25VRFY root# Check for commandsnmap -script smtp-commands.nse <targetip>------------------------Port 111 - RPCRpcbind can help us look for NFS-shares. So look out for nfs. Obtain list of services running with RPC:rpcbind -p <targetip>rpcinfo –p x.x.x.x# using nmap, see which port NFS is listeninglocate *rpc*.nsenmap --script rpcinfo.nse <targetip> -p 111-------------------------NFS# to find the public sharelocate *nfs*.nsenmap --script nfs-showmount.nse <targetip># mount the share to a folder under /tmpmkdir /tmp/nfs/sbin/mount.nfs <targetip>:/home/box /tmp/nfs