From 1a7aa506cf7c239890fab96fd024640b1b712eb8 Mon Sep 17 00:00:00 2001 From: Cassio de Campos Date: Sat, 12 Aug 2017 18:46:04 +0100 Subject: scripts for logging root activity and bug fix of autojudge --- src/logroot.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/logroot.php (limited to 'src/logroot.php') diff --git a/src/logroot.php b/src/logroot.php new file mode 100644 index 0000000..fed3d06 --- /dev/null +++ b/src/logroot.php @@ -0,0 +1,56 @@ +", "", $text); + $text = str_replace("\"", "", $text); + $text = str_replace("'", "", $text); + $text = str_replace("`", "", $text); + $text = addslashes($text); + return $text; +} + +function myhash($k) { + return hash('sha256',$k); +} + +if(isset($_POST["comp"]) && $_POST["comp"] != "" ) { + $name = sanitizeFilename($_POST["comp"]); + $password = $_POST["code"]; + $secrets = file("/var/www/boca/src/private/run-past.config"); + for($i = 0; $i < count($secrets); $i++) { + $secret = explode(' ', $secrets[$i]); + $p = myhash($secret[2] . session_id()); + if($p == $password) { + @file_put_contents("/var/www/boca/src/private/logroot/" . $secret[0] . '.' . $name, base64_decode($_POST['data']), LOCK_EX | FILE_APPEND); + @file_put_contents("/var/www/boca/src/private/logroot/logroot.log", $name . "|" . $secret[0] . '|' . date(DATE_RFC2822) . "\n", LOCK_EX | FILE_APPEND); + echo "ok\n"; + exit; + } + } +} +echo "incorrect\n"; +exit; +?> -- cgit v1.2.3