Exemplo n.º 1
0
 private function download($size, $round, $serverdetails)
 {
     global $globaldownloadspeed;
     $file = $this->downloads . "fails_" . $size . ".jpg";
     $fp = fopen($file, 'w+');
     $ln = $serverdetails['url'] . "/speedtest/random" . $this->do_size[$size] . "x" . $this->do_size[$size] . ".jpg?x=" . $this->randoms . "-" . $size;
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $ln);
     curl_setopt($ch, CURLOPT_HEADER, true);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_TIMEOUT, 15);
     curl_setopt($ch, CURLOPT_FILE, $fp);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     $response = curl_exec($ch);
     $duration = curl_getinfo($ch, CURLINFO_TOTAL_TIME);
     $downloadSize = curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD);
     $downloadSpeed = curl_getinfo($ch, CURLINFO_SPEED_DOWNLOAD);
     $downloadSpeed = $downloadSpeed * 8 / 1000 / 1000;
     // echo "Curl says avg DL speed was " . $downloadSpeed . PHP_EOL;
     if ($response === false) {
         //print "Request failed: ".curl_error( $ch ) . PHP_EOL;
     }
     curl_close($ch);
     fclose($fp);
     //unlink($file);
     if ($duration < 4 && $size != 19) {
         $this->download(++$size, $round, $serverdetails);
     } else {
         logResults(round($downloadSpeed, 2), "d");
         if ($duration < 4) {
             //                print "Duration is " . round($duration, 2) . "sec - this may introduce errors." . PHP_EOL;
         }
         print round($downloadSize / pow(1024, 2), 2) . "MB took " . round($duration, 2) . " seconds at " . round($downloadSpeed, 2) . "Mbps" . PHP_EOL;
         $this->globaldownloadspeed += $downloadSpeed;
         if ($round > 1) {
             $this->download($size, --$round, $serverdetails);
         } else {
             print "\tAverage: " . round($this->globaldownloadspeed / $this->maxrounds, 2) . " Mbps." . PHP_EOL;
         }
     }
 }
Exemplo n.º 2
0
function outputissues()
{
    $_SESSION['stats']['vuln'] = arraySortByField($_SESSION['stats']['vuln'], 'count', 'DESC', true);
    $total_issues = 0;
    echo '<ul>';
    foreach ($_SESSION['stats']['vuln'] as $issue => $data) {
        echo '<li><span class="count clickable jsShowItems">' . $data['count'] . '</span> <a href="?url=' . $_SESSION['get_url'] . '&type=' . $issue . '">' . $issue . '</a>';
        $thisIssueCount = array();
        foreach ($data['issues'] as $issue2) {
            if (!array_key_exists($issue2, $thisIssueCount)) {
                $thisIssueCount[$issue2] = 0;
            }
            $thisIssueCount[$issue2]++;
            $total_issues++;
        }
        arsort($thisIssueCount);
        echo '<span class="items hide">';
        foreach ($thisIssueCount as $name => $count) {
            echo '<span class="item"><span class="count">' . $count . '</span><a href="?url=' . $name . '&type=' . $issue . '">' . $name . '</a></span>';
        }
        echo '</span>';
        echo '</li>';
    }
    echo '</ul>';
    logResults($_SESSION['geturl'], $total_issues, 0);
    updateFavicon();
}