netcat is a very powerful tool. it can be used in many ways. we define netcat as nc in commands. it is called swiss army knife of a hacker. here, we will talk about various functions of netcat that can help you in the future.

if you don’t have netcat, you can install it by clicking here

• I am performing everything on my local network and if you want to connect to someone who is not in your LAN, you will need to perform port forwarding. I will explain it later.

use netcat as a messenger:

type this command to open a listener:

nc -lvp <port-no.>

the -l key is for listening to a connection that is being sent to your local IP address. -v is to show some output(hard to explain for me) and the -p stands for port-no. which we will assign in our next command.

type this command to send data to a listener:

nc <local-ip> <port-no.>

in this case, we have many ways to send data packets. if you wanna use another option you can use telnet.

now if there is nothing wrong you can talk in a LAN network to a different person.

 

share a file in LAN using netcat:

for sharing files, you will need to install netcat at in both machines that you are using. as I told you before about netcat listener, we will use it here with some modifications.

type this command :

nc -lvp "port-no." > "path to the file"

> is to tell netcat to send the file.

now we are ready to receive the file.

type this command:

nc "local-ip" "port" < "filename"

< is to tell netcat to receive the file. if you have done it well, it would work.

connect to a reverse shell with netcat:

if you haven’t read about the reverse shell, you can check it out> HERE

the situation is-  A reverse shell is sending data to our IP, but the question is how can we listen to it.

for example, we a server in which we have uploaded a PHP reverse shell. by the way, the server is on LAN. now we have netcat tool preinstalled in our Kali Linux. we will be able to listen to a connection if we start a listener.

type this command:

nc -lvp <port-no.>

most important this is, you must have entered the correct IP and port-no. in the Reverse shell. now you can access server as you want.

tip- the shell is some kinda terminal or command prompt that gives you command line access to a machine.

 

thanks for visiting

LEAVE A REPLY

Please enter your comment!
Please enter your name here