Difference between revisions of "Netcat"
Jump to navigation
Jump to search
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
| + | # SSH | ||
| + | ``` | ||
| + | banner=$(nc -w 5 -v example.com 22 < /dev/null 2>&1 | grep SSH) && echo $banner | ||
| + | ``` | ||
| + | |||
https://www.digitalocean.com/community/tutorials/how-to-use-netcat-to-establish-and-test-tcp-and-udp-connections | https://www.digitalocean.com/community/tutorials/how-to-use-netcat-to-establish-and-test-tcp-and-udp-connections | ||
| Line 5: | Line 10: | ||
nc -w 1 -z -v host.example.com 443 | nc -w 1 -z -v host.example.com 443 | ||
[[ $(nc -w1 -z -v www.example.com 443 2>&1) == *"succeeded"* ]] && echo ok | [[ $(nc -w1 -z -v www.example.com 443 2>&1) == *"succeeded"* ]] && echo ok | ||
| + | ``` | ||
| + | |||
| + | |||
| + | server | ||
| + | ``` | ||
| + | nc -kl 8080 | ||
| + | ``` | ||
| + | |||
| + | client | ||
| + | ``` | ||
| + | nc 10.x.x.x 8080 | ||
``` | ``` | ||
Latest revision as of 19:07, 22 April 2024
SSH
banner=$(nc -w 5 -v example.com 22 < /dev/null 2>&1 | grep SSH) && echo $banner
nc -zvw 2 host.example.com 443 nc -w 1 -z -v host.example.com 443 [[ $(nc -w1 -z -v www.example.com 443 2>&1) == *"succeeded"* ]] && echo ok
server
nc -kl 8080
client
nc 10.x.x.x 8080