Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Netcat Cheat Sheet

Netcat Cheat Sheet

Ratings: (0)|Views: 754 |Likes:
Published by b732199

More info:

Published by: b732199 on Jan 03, 2010
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





This cheat sheet provides various tips forusing Netcat on both Linux and Unix,specifically tailored to the SANS 504, 517,and 560 courses. All syntax is designed forthe original Netcat versions, released byHobbit and Weld Pond. The syntax herecan be adapted for other Netcats, includingncat, gnu Netcat, and others.
nc [options] [TargetIPaddr] [port(s)]
is simply the other side’s IPaddress or domain name. It is required in client modeof course (because we have to tell the client where toconnect), and is optional in listen mode.
-l: Listen mode (default is client mode)-L: Listen harder (supported only on Windowsversion of Netcat). This option makes Netcat apersistent listener which starts listening againafter a client disconnects-u: UDP mode (default is TCP)-p: Local port (In listen mode, this is port listenedon. In client mode, this is source port for allpackets sent)-e: Program to execute after connection occurs,connecting STDIN and STDOUT to theprogram-n: Don’t perform DNS lookups on names of machines on the other side-z: Zero-I/O mode (Don’t send any data, just emita packet without payload)-wN: Timeout for connects, waits for N secondsafter closure of STDIN. A Netcat client orlistener with this option will wait for N secondsto make a connection. If the connectiondoesn’t happen in that time, Netcat stopsrunning.-v: Be verbose, printing out messages onStandard Error, such as when a connectionoccurs-vv: Be very verbose, printing even more detailson Standard Error
Netcat Relays on WindowsNetcat Command FlagsPurpose
NetcatCheat Sheet
By Ed Skoudis
To start, enter a temporary directory where we willcreate .bat files:
cd c:\temp
Listener-to-Client Relay: 
echo nc [TargetIPaddr] [port] > relay.bat
nc –l –p [LocalPort] –e relay.bat
Create a relay that sends packets from the local port
to a Netcat Client connected to
on port
Listener-to-Listener Relay: 
echo nc –l –p [LocalPort_2] > relay.bat
nc –l –p [LocalPort_1] –erelay.bat
Create a relay that will send packets from anyconnection on
to any connectionon
Client-to-Client Relay: 
echo nc [NextHopIPaddr] [port2] > relay.bat
nc [PreviousHopIPaddr] [port] –erelay.bat
Create a relay that will send packets from theconnection to
on port
to a Netcat Client connected to
on port
Fundamental Netcat Client: 
nc [TargetIPaddr] [port]
Connect to an arbitrary port
at IP Address
Fundamental Netcat Listener: 
nc –l -p [LocalPort]
 Create a Netcat listener on arbitrary local port
Both the client and listener take input from STDINand send data received from the network to STDOUT

Activity (9)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Dan liked this
Dan liked this
rodrmoreno liked this
sarheeder liked this
kd4pba liked this
Alek Orlov liked this
mevlevi.ali liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->