Created
December 16, 2019 06:23
-
-
Save liejuntao001/6d82534b6c02807f3d7e822c97c53778 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Server side | |
# /etc/knockd.conf | |
[options] | |
UseSyslog | |
[openSSH] | |
sequence = 3000,4000,5000,6000 | |
seq_timeout = 15 | |
command = /sbin/iptables -I INPUT 1 -s %IP% -p tcp --dport 22 -j ACCEPT | |
tcpflags = syn | |
cmd_timeout = 10 | |
stop_command = /sbin/iptables -D INPUT -s %IP% -p tcp --dport 22 -j ACCEPT | |
Client side | |
# Direct network access, knock | |
knock -v server_ip_address 3000 4000 5000 6000 | |
# Direct network access, nmap | |
for x in 3000 4000 5000 6000; do nmap -n -Pn --host-timeout 1s --max-retries 0 -p $x server_ip_address; done | |
# Connect via a squid proxy, nc | |
for x in 3000 4000 5000 6000; do nc -x 127.0.0.1:3128 -X connect -w 1 server_ip_address $x; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment