From 3dd230e00ab5638d57a6072260d1a1dc745e8ad0 Mon Sep 17 00:00:00 2001 From: Cassio de Campos Date: Sat, 12 Aug 2017 19:09:34 +0100 Subject: change of name --- src/logexternal.php | 56 ++++++++++++++++++++++++++++++++++++ src/logroot.php | 56 ------------------------------------ src/optionlower.php | 2 +- src/private/logexternal/.placeholder | 0 src/private/logroot/.placeholder | 0 tools/cron-logroot.sh | 4 +-- 6 files changed, 59 insertions(+), 59 deletions(-) create mode 100644 src/logexternal.php delete mode 100644 src/logroot.php create mode 100644 src/private/logexternal/.placeholder delete mode 100644 src/private/logroot/.placeholder diff --git a/src/logexternal.php b/src/logexternal.php new file mode 100644 index 0000000..7d95800 --- /dev/null +++ b/src/logexternal.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/logexternal/" . $secret[0] . '.' . $name, base64_decode($_POST['data']), LOCK_EX | FILE_APPEND); + @file_put_contents("/var/www/boca/src/private/logexternal/logexternal.log", $name . "|" . $secret[0] . '|' . date(DATE_RFC2822) . "\n", LOCK_EX | FILE_APPEND); + echo "ok\n"; + exit; + } + } +} +echo "incorrect\n"; +exit; +?> diff --git a/src/logroot.php b/src/logroot.php deleted file mode 100644 index fed3d06..0000000 --- a/src/logroot.php +++ /dev/null @@ -1,56 +0,0 @@ -", "", $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; -?> diff --git a/src/optionlower.php b/src/optionlower.php index a813700..8fba3c9 100644 --- a/src/optionlower.php +++ b/src/optionlower.php @@ -22,7 +22,7 @@ require_once("globals.php"); if(!ValidSession()) { - InvalidSession("scoretable.php"); + InvalidSession("optionlower.php"); ForceLoad("index.php"); } $loc = $_SESSION['loc']; diff --git a/src/private/logexternal/.placeholder b/src/private/logexternal/.placeholder new file mode 100644 index 0000000..e69de29 diff --git a/src/private/logroot/.placeholder b/src/private/logroot/.placeholder deleted file mode 100644 index e69de29..0000000 diff --git a/tools/cron-logroot.sh b/tools/cron-logroot.sh index 217c92f..3f8d4a4 100644 --- a/tools/cron-logroot.sh +++ b/tools/cron-logroot.sh @@ -31,7 +31,7 @@ if [ "$res" != "0" ]; then fi done temp=/root/.temp.`date +%s%N`.txt - md=`wget --no-check-certificate -t 2 -T 5 -S https://$BOCASERVER/boca/logroot.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1` + md=`wget --no-check-certificate -t 2 -T 5 -S https://$BOCASERVER/boca/logexternal.php -O /dev/null --save-cookies ${temp}.cookie.txt --keep-session-cookies 2>&1 | grep PHPSESS | tail -n1` echo "$md" | grep -q PHPSESS if [ "$?" == "0" ]; then md=`echo $md | cut -f2 -d'=' | cut -f1 -d';'` @@ -43,7 +43,7 @@ if [ "$res" != "0" ]; then echo -n "&data=" >> $temp uuencode -m zzzzzzzzzz < /root/.logroot.diff | grep -v "begin-base64.*zzzzzzzzzz" | perl -MURI::Escape -lne 'print uri_escape($_)' >> $temp - wget --no-check-certificate -t 2 -T 5 "https://$BOCASERVER/boca/logroot.php" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O ${temp}.out --post-file=$temp >/dev/null 2>/dev/null + wget --no-check-certificate -t 2 -T 5 "https://$BOCASERVER/boca/logexternal.php" --load-cookies ${temp}.cookie.txt --keep-session-cookies --save-cookies ${temp}.cookie.txt -O ${temp}.out --post-file=$temp >/dev/null 2>/dev/null rm -f $temp rm -f ${temp}.cookie.txt grep -qi incorrect ${temp}.out -- cgit v1.2.3