# PORT KNOCKING

```

==========================================================
======Some Knowledge : 

#Nothing on the nmap scan? But you found a cool and strange sequence of numbers? Lets try Port knocking.

When you "knock" on a port you are really just sending TCP-packets with SYN-flag to that port. The closed port will then respond with a ACK/RST. This basically means that the host has received the TCP-packet and - it ACKnolwdge it, but responds with a Reset (RST) flag.

RST just means that the port is closed.

======Nmap & Bash Script : 
for x in 4000 5000 6000; do  #change the range with your
nmap -Pn --host-timeout 201 --max-retries 0 -p $x $IP;
done
ssh User@$IP -p <port>  #or you can use ‘nc -nv $IP 22’

===================================================================

=================port knocking :https://en.wikipedia.org/wiki/Port_knocking : 

>>> knock   10.10.29.172 	7864 	8273		 9241		 12007 	60753 		&&		 sleep 1		 && 	rustscan -a	 10.10.29.172	 -b	 65535

>>>for x in 4000 5000 6000; do nmap -Pn --host_timeout 201 --max-retries 0 -p $x server_ip_address; done

>>> nc <IP> port

>>>knock  <IP> port

>>> for x in 7000 8000 9000; do nmap -Pn –host_timeout 201 –max-retries 0 -p $x 1.1.1.1; done
NOTE : after knocking the port  urgently run  a full port scan.
```

