Netcat: Difference between revisions

From My Mnemonic Rhyme
Jump to navigation Jump to search
>Homaar
No edit summary
 
(No difference)

Latest revision as of 21:51, 6 June 2017

                          Hacking With Your Cat
				   /\_/\		
       			          / 0 0 \		
     			         ====v====		
      			          \  W  /		
      			          |     |     _
     			          / ___ \    / `>
     			         / /   \ \  |
    			        (((-----)))-'
      			         /
    			        (      ___
     			         \__.=|___E
            			        /
  • Portscan
nc -w 1 -zv tobias-weiss.org 1-1024 2>&1 | grep succeeded
  • Port forward
at /tmp/f | nc 192.168.1.123 1234 | nc -l 127.0.0.1 1234 > /tmp/f

ggf. mit -k für dauerhaften Spaß

  • File transfer
     Server: nc -v -w 30 -p 10000 -l > some.file.backup
     Client: nc -v -w 2 server_ip_address 10000 < some.file

dd über das Netz: Client

export NC_SERVER=192.168.56.2
export NC_PORT=33333
export NC_SRC=/dev/random
dd if=$NC_SRC bs=1 count=1k | gzip | nc -v $NC_SERVER $NC_PORT
unset NC_SERVER NC_PORT NC_SRC

Server

export NC_PORT=33333
export NC_SRC=/test.img
nc -v -l -p $NC_PORT | gzip -dc | dd of=$NC_SRC
unset NC_PORT NC_SRC
  • HTTP
printf "GET / HTTP/1.0\r\n\r\n" | nc host.example.com 80
  • SMTP
nc [-C] localhost 25 << EOF
HELO host.example.com
MAIL FROM:<user@host.example.com>
RCPT TO:<user2@host.example.com>
DATA
Body of email.
.
QUIT
EOF