Netcat: Difference between revisions
From wikinotes
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
netcat is a tool for using and testing TCP. | |||
{{ NOTE | | |||
netcat has been superceeded by [[ss]] }} | |||
= Install = | |||
<blockquote> | |||
<syntaxhighlight lang="bash"> | |||
pacman -S openbsd-netcat | |||
</syntaxhighlight> | |||
</blockquote><!-- Install --> | |||
< | = Usage = | ||
<blockquote> | |||
<syntaxhighlight lang="bash"> | |||
nc -vz x.x.x.x 80 # ipv4 confirm port 80 open | |||
nc -6 -vz xxxx:xxxx:xxx:xx::xxx::xxxx 80 # ipv6 confirm port 80 open | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="bash"> | |||
nc \ | nc \ | ||
-u # send udp packets \ | -u # send udp packets \ | ||
-v # verbose \ | -v # verbose \ | ||
-z # check if reachable \ | -z # check if reachable \ | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang="bash"> | ||
nc -l -p 6001 # Listen to port 6001 on localhost | nc -l -p 6001 # Listen to port 6001 on localhost | ||
echo "hello" | nc 127.0.0.1 6001 # Send test 'hello' to port 6001 on localhost | echo "hello" | nc 127.0.0.1 6001 # Send test 'hello' to port 6001 on localhost | ||
</ | </syntaxhighlight> | ||
</blockquote><!-- Usage --> | |||
< | |||
Revision as of 00:18, 7 August 2021
netcat is a tool for using and testing TCP.
NOTE:
netcat has been superceeded by ss
Install
pacman -S openbsd-netcat
Usage
nc -vz x.x.x.x 80 # ipv4 confirm port 80 open nc -6 -vz xxxx:xxxx:xxx:xx::xxx::xxxx 80 # ipv6 confirm port 80 opennc \ -u # send udp packets \ -v # verbose \ -z # check if reachable \nc -l -p 6001 # Listen to port 6001 on localhost echo "hello" | nc 127.0.0.1 6001 # Send test 'hello' to port 6001 on localhost