I tried to create a PHP script which will be invoked when someone click on a button and will be taken to vt.php now I want to download the sample based on the VT hash which is received from previous PHP page now I tried using this logic but it is not working.
<?php
$fileHash = $_POST['hash'];
echo $fileHash;
#$command = escapeshellcmd("python vt_download.py $fileHash");
$command = escapeshellcmd("curl -v --location https://www.virustotal.com/vtapi/v2/file/download?apikey=APIKEY\&hash=$fileHash -o $fileHash");
$output = shell_exec($command);
echo $output;
?>
Output c75b5e2ca63adb462f4bb941e0c9f509
Expected output c75b5e2ca63adb462f4bb941e0c9f509 File Downloding Process ------- curl output
When this page is called it is only printing the hash and not downloading the file.Any suggestions to solve this?
P.S : Error in downloading file from VirusTotal only on server? -- Previously asked this question here,either this or that using python will help.
escaeshellcmdbut you also seem to have done some manual escaping. It should be one or the other.<?php #$fileHash = $_POST['hash']; $fileHash = 'c75b5e2ca63adb462f4bb941e0c9f509'; #echo $5e2ca63adb462f4bb941e0c9f509i9 curl_setopt($ch , CURLOPT_URL , "https://www.virustotal.com/vtapi/v2/file/download?apikey=APIKEY\&hash=$fileHash -o $fileHash"); curl_exec($ch); curl_close($ch); ?>Is it Correct?