Here we go:
Source code attached
gate mars.php
Code: Select all<?php
include('Crypt/RSA.php');
error_reporting( E_ERROR );
$rsa = new Crypt_RSA();
$PubKey = file_get_contents('public_key.pem');
$rsa ->loadKey($PubKey);
if (isset($_GET['id']) && $_GET['id'] != '0') {
$a = $_GET['id'];
$b = 'RAA';
if (strpos($a, $b) > 0 && strlen ($a) >= 25) {
$filename = "./cl/".$a;
file_put_contents($filename, "", FILE_APPEND | LOCK_EX);
$i = 250;
$bytes = openssl_random_pseudo_bytes($i, $cstrong);
$hex = bin2hex($bytes);
$bytes1 = openssl_random_pseudo_bytes($i, $cstrong);
$hex1 = bin2hex($bytes1);
$bytes2 = openssl_random_pseudo_bytes($i, $cstrong);
$hex2 = bin2hex($bytes2);
$iv = openssl_random_pseudo_bytes($i, $cstrong);
$iv2hex = bin2hex($iv);
$dat_file="counter_tips";
$f=fopen($dat_file,"r");
$count=fgets($f,100000);
fclose($f);
$count=ereg_replace(" ","",$count);
$count++;
$f=fopen($dat_file,"w");
fputs($f,"$count ");
if (strpos($a,"DOUBLE") !== FALSE) {
$dat_file2="double_tips";
$f2=fopen($dat_file2,"r");
$count2=fgets($f2,100000);
fclose($f2);
$count2=ereg_replace(" ","",$count2);
$count2++;
$f2=fopen($dat_file2,"w");
fputs($f2,"$count2 ");
}
$file = "adr_base";
$total_adr = file_get_contents($file);
$total_adr = explode ("END", $total_adr);
$adr = $total_adr[$count-1];
fclose($f);
echo $hex.$hex1.$hex2.$iv2hex,',', $adr,',';
$data = $hex.','.$hex1.','.$hex2.','.$iv2hex.','.$a.','.$adr;
$array_d = explode(',', $data);
$point_r = -1;
$filename = "./cl/".$a;
do {
$point_r += 1;
$encrypted_data[$point_r] = $rsa->encrypt($array_d[$point_r]);
$encrypted_data[$point_r] = $encrypted_data[$point_r]."SEPARATOR";
} while ($point_r < 5);
$enc_str = implode("", $encrypted_data);
file_put_contents($filename, $enc_str, FILE_APPEND | LOCK_EX);
} else {
echo "INVALID ID";
}
} else {
echo "INVALID REQUEST";
}
?>