Beispiel #1
0
                     return $backup;
                 }
             }
             return false;
         }
         function GetJobDetails($jobid)
         {
             global $backupjobs;
             foreach ($backupjobs as $backupjob) {
                 if ($backupjob['id'] == $jobid) {
                     return $backupjob;
                 }
             }
             return false;
         }
         $backup = GetBackupDetails($_REQUEST['id']);
         $backupjob = GetJobDetails($backup['id']);
         header('Content-Disposition: attachment; filename="' . basename($_REQUEST['id']) . '"');
         set_include_path($config['path'] . '/libs/phpseclib');
         include 'Crypt/AES.php';
         $cipher = new Crypt_AES(CRYPT_AES_MODE_ECB);
         $cipher->setKey($backupjob['encryptionkey']);
         echo $cipher->decrypt(file_get_contents($config['path'] . '/files/' . $_REQUEST['id']));
         logevent('User ' . $_SESSION['user'] . ' downloaded decrypted backup ' . $_REQUEST['id'], 'activity');
     } else {
         echo 'File not found';
     }
 } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'backupdelete' && isset($_REQUEST['id'])) {
     checkacl('deleteb');
     if (file_exists($config['path'] . '/files/' . $_REQUEST['id'])) {
         if (unlink($config['path'] . '/files/' . $_REQUEST['id'])) {
Beispiel #2
0
    }
} elseif (isset($_GET['id'])) {
    $backups = json_decode(file_get_contents($config['path'] . '/db/db-backups.json'), true);
    $backupjobs = json_decode(file_get_contents($config['path'] . '/db/db-backupjobs.json'), true);
    $backupservers = json_decode(file_get_contents($config['path'] . '/db/db-backupservers.json'), true);
    function GetBackupDetails($backupdata)
    {
        global $backups;
        foreach ($backups as $backup) {
            if ($backup['file'] == $backupdata) {
                return $backup;
            }
        }
        return false;
    }
    $backupdetail = GetBackupDetails($_GET['id']);
    function GetJobDetails($jobid)
    {
        global $backupjobs;
        foreach ($backupjobs as $backupjob) {
            if ($backupjob['id'] == $jobid) {
                return $backupjob;
            }
        }
        return false;
    }
    $jobdetail = GetJobDetails($backupdetail['id']);
    $smarty->assign('backupservers', $backupservers);
    $smarty->assign('backupdetail', $backupdetail);
    $smarty->assign('jobdetail', $jobdetail);
    $smarty->display($config['path'] . '/templates/header.tpl');
Beispiel #3
0
            return $backupjob;
        }
    }
    return false;
}
function GetServerDetails($host)
{
    global $backupservers;
    foreach ($backupservers as $backupserver) {
        if ($backupserver['host'] == $host) {
            return $backupserver;
        }
    }
    return false;
}
$backup = GetBackupDetails($argv[1]);
$backupjob = GetJobDetails($backup['id']);
$backupserver = GetServerDetails($argv[2]);
if (isset($backupjob['encryption']) && $backupjob['encryption'] == 'GPG') {
    echo 'GPG-encrypted backups cannot be automatically restored' . PHP_EOL;
    die;
}
set_include_path($config['path'] . '/libs/phpseclib');
include 'Crypt/AES.php';
if ($backupjob['type'] == 'full' || $backupjob['type'] == 'incremental') {
    set_include_path($config['path'] . '/libs/phpseclib');
    include 'Net/SSH2.php';
    include 'Net/SFTP.php';
    include 'Crypt/RSA.php';
    $ssh = new Net_SSH2($backupserver['host'], $backupserver['port']);
    $sftp = new Net_SFTP($backupserver['host'], $backupserver['port']);