Netcat

2TiRoj6w
Netcat

Introduction
Netcat, like so many hacker tools, was created to be a network analysis tool. Developed in 1995 by a fellow only known as “Hobbit,” Netcat was given to the IT community without compensation but has received scores of accolades.
However, while still useful, it has not been maintained, so Nmap produced a modern version of it with more up-to-date features. The new version is called Ncat and, for the most part, has the same commands as Netcat so that they can be used interchangeably.
You can use either Netcat or Ncat to open up TCP and UDP connections between two machines over any port your heart desires. Also, these tools can be used for port scanning, similar to Nmap. Netcat and Ncat can be used for port forwarding, proxying, simple web server, and leaving an open backdoor for the hacker, as well.
Features:
It acts as a simple TCP/UDP/SCTP/SSL client for interacting with web servers,
telnet servers, mail servers, and other TCP/IP network services.
It redirects the TCP/UDP/SCTP traffic to other ports or hosts by acting as a
SOCKS or HTTP proxy such that the clients specify their own destinations.
Netcat can even connect to destinations through a chain of anonymous or
authenticated proxies.
Encrypts communication with SSL, and transports it over IPv4 or IPv6.
It acts as a connection broker, allowing two (or far more) clients to connect to each other through a third (brokering) server.

What is Netcat Used For?
Netcat can be a useful tool for any IT team, though the growth of internally managed network services and cloud computing make that particular environment a natural fit. Network and system administrators need to be able to quickly identify how their network is performing and what type of activity is occurring.
Netcat functions as a back-end tool that allows for port scanning and port listening. In addition, you can actually transfer files directly through Netcat or use it as a backdoor into other networked systems. Partnered with a tool like Varonis Edge, you would receive an alert of any unusual activity and could then use Netcat to investigate. Lastly, Netcat is a flexible tool because of how it can be scripted for larger tasks.
Port Scanning with Netcat Commands
When trying to diagnose a network issue or performance problem, executing a port scan with Netcat is a smart first step to take. The scan will check the status of all ports on the given domain or IP address so that you can determine whether a firewall or other blocking mechanism is in place. A basic port scan command for an IP ncat address looks like this:

Result:
UDP Scan with Netcat
We also can scan the UDP ports using Netcat. With the help of the following
command we have scanned the UDP port using netcat.
Result:
Banner Grabbing using Netcat
Banner grabbing is a collection of information from the host machine. We also
can do it using netcat. We run following command to see information of services
running on a specific port:
Result:
Chatting using Netcat

Netcat can also be used to chat between two users. But before that, we need to establish a connection. To set this all up, we’ll be using two devices – one will play the role as an initiator and the other one will be a listener. As soon as this connection is established, the communication can bedone from both ends. Let’s check out this scenario, where two users with different operating systems communicate with each other over a Netcat establishedconnection. Initially, kali’s root user needs to set up his netcat “listener” over a specific port, to build up a network connection. Run the followingcommand to do so:

 

The following screenshot shows that shearing has started
Now we can download it from another system.Here for an example we have used the Metasploitable terminal from pc. From another terminal we need to run the following command to save the file. Here we need the IP address of our Kali Linux machine (we are using local IP).
Result:
Kali root:
Meta User:
File Transfer
Netcat offers us an opportunity to transfer files from one device to another over a network. Let’s follow up with a scenario, where a kali user is exempted from transferring his files to a user at an Metasploitable machine. From the below image the user over the kali machine sets up a listener at port number 5555, and shares file.txt using the “<” parameter.
From the below image you can see that the Meta user has successfully grabbed the file.txt file from 192.168.234.128 which is nothingbut the kali user’s IP.
Linux Reverse Shell
As discussed earlier netcat can perform anything, so now we’ll try to exploit the target’s machine with the help of “msfvenom” to createapayloadandwillsetup a netcat listener to grab a session.
Let’s try to create a payload using the followingcommand:
Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.