nc linux

server command  prompt
server:
rm -f /tmp/f; mkfifo /tmp/f
cat /tmp/f | /bin/sh -i 2>&1 | nc -l  1234 > /tmp/f
cat /tmp/f | /bin/bash -i 2>&1 | nc -l  8888 > /tmp/f

client:
nc ip-server 1234

#############################################################################


data transfer
server:
nc -l 1234 > filename.out

client:
nc -N host.example.com 1234 < filename.in

#############################################################################

printf "GET / HTTP/1.0\r\n\r\n" | nc host.example.com 80

#############################################################################

 nc [-C] advancedhosters.com 25 << EOF
 HELO host.example.com
 MAIL FROM:<[email protected]>
 RCPT TO:<[email protected]>
 DATA
 Body of email.
 .
 QUIT
 EOF
#############################################################################

PORT SCANNING
nc -zv host.example.com 20-30
nc -zv host.example.com 80 20 22
echo "QUIT" | nc host.example.com 20-30

#############################################################################

Open a TCP connection to port 42 of host.example.com, using port 31337 as the source port, with a timeout of 5 seconds:

     $ nc -p 31337 -w 5 host.example.com 42

Open a UDP connection to port 53 of host.example.com:

     $ nc -u host.example.com 53

Open a TCP connection to port 42 of host.example.com using 10.1.2.3 as the IP for the local end of the connection:

     $ nc -s 10.1.2.3 host.example.com 42

Create and listen on a UNIX-domain stream socket:

     $ nc -lU /var/tmp/dsocket

Connect to port 42 of host.example.com via an HTTP proxy at 10.2.3.4, port 8080.  This example could also be used by ssh(1); see the ProxyCommand
directive in ssh_config(5) for more information.

     $ nc -x10.2.3.4:8080 -Xconnect host.example.com 42

#############################################################################

yes 'hello, hi' | nc -l 127.0.0.1 9999

ссылки

http://rus-linux.net/MyLDP/lvs/useful_netcat_examples_on_linux.html

results matching ""

    No results matching ""