Recommend starting point:
nmap -sC -sV -p- $TARGET
Explanation of options:
sC
use default scriptssV
Probe open ports to determine what service and version is running-p-
Scans the whole range of ports. Alteranitvely can be used to specify a particular range by using -p-100,600-
which would scan ports 100 through 600 (inclusive).$TARGET
could either be a single IP or IP range. This can be done in CIDR formatGobuster can be used to brute force directory structure as well as vhosts.
gobuster dir -u <URL>[:PORT] -w /usr/share/dirbuster/wordlists/directory-list-2.3-small.txt
Explanation of options:
dir
tells gobuster that we are looking for subdirectories-u <URL>[:PORT]
what URL to scan and optionally what port to use. Note: when specifying a port, URL will need to be in the form of "http://<IP or DNS name>:<PORT>".-w
specifies a word list. Example above is the location in Kali, unsure of locations in other distributions.gobuster vhost -w /usr/share/dnsrecon/subdomains-top1mil-5000.txt -u <URL>[:PORT]
Explanation of options:
vhost
tells gobuster that we are looking for vhosts (www., mail., ftp. and so on)-w
specifies a word list. Example above is the location in Kali, unsure of locations in other distributions.-u <URL>[:PORT]
what URL to scan and optionally what port to use. Note: when specifying a port, URL will need to be in the form of "http://<IP or DNS name>:<PORT>".Start netcat
listener using:
nc -nvlp 4444
Explanation of options:
-n
specifies numeric only, no DNS-v
makes the output verbose (add another v
to make it very verbose)-l
turns on listen mode for incoming connections-p
specifies the port to listen on; "4444" in the example aboveOutput example:
-Shows incoming connection from 10.129.231.252
When obtaining a reverse shell, you might wish to upgrade it in order to make it more usable. There are a few methods to do this.
python3 -c 'import pty;pty.spawn("/bin/bash/");'
. This should work if python3 is installed and /bin/bash
is availablepython -c 'import pty;pty.spawn("/bin/bash/");'
. This will run with python2script /dev/null -c bash
Example:
Go to Settings
-> Network Settings
and set as per the following screenshot: