diff --git a/index.php b/index.php index 212c799f..100caa46 100644 --- a/index.php +++ b/index.php @@ -1,48 +1,47 @@ json(); + if ($path == 'request') { + $request = new Request(); + echo $request->json(); } else { - $route = new Route(); - echo $route->template($path); + $route = new Route(); + echo $route->template($path); } - - } else { +} else { $route = new Route(); - if($requestUrl == '/callback') { - if ($_SERVER['REQUEST_METHOD'] == 'POST') { - echo $route->callback(file_get_contents('php://input')); - } + if ($requestUrl == '/callback') { + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + echo $route->callback(file_get_contents('php://input')); + } } - if($requestUrl == '/') { - header('Content-Type: application/x-javascript'); - echo $route->jsPayload(); + if ($requestUrl == '/') { + header('Content-Type: application/x-javascript'); + echo $route->jsPayload(); } - - } +} diff --git a/src/Autoload.php b/src/Autoload.php index 3c46091d..40ab065f 100644 --- a/src/Autoload.php +++ b/src/Autoload.php @@ -1,8 +1,8 @@ base32Characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; + public function __construct() + { + $this->base32Characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; } - public function domain() { - return htmlspecialchars($_SERVER['SERVER_NAME']); + public function screenshotPath($screenshotName) + { + return ''; } - public function screenshotPath($screenshotName) { - return ''; + public function domain() + { + return htmlspecialchars($_SERVER['SERVER_NAME']); } - public function getCode($secret) { - $secretKey = $this->baseDecode($secret); - $hash = hash_hmac('SHA1', chr(0) . chr(0) . chr(0) . chr(0) . pack('N*', floor(time() / 30)), $secretKey, true); - $value = unpack('N', substr($hash, ord(substr($hash, -1)) & 0x0F, 4)); - $value = $value[1] & 0x7FFFFFFF; - return str_pad($value % pow(10, 6), 6, '0', STR_PAD_LEFT); + public function getCode($secret) + { + $secretKey = $this->baseDecode($secret); + $hash = hash_hmac('SHA1', chr(0) . chr(0) . chr(0) . chr(0) . pack('N*', floor(time() / 30)), $secretKey, true); + $value = unpack('N', substr($hash, ord(substr($hash, -1)) & 0x0F, 4)); + $value = $value[1] & 0x7FFFFFFF; + return str_pad($value % pow(10, 6), 6, '0', STR_PAD_LEFT); } - private function baseDecode($data) { - $characters = $this->base32Characters; - $buffer = 0; - $bufferSize = 0; - $result = ''; - for ($i = 0; $i < strlen($data); $i++) { - $position = strpos($characters, $data[$i]); - $buffer = ($buffer << 5) | $position; - $bufferSize += 5; - if ($bufferSize > 7) { - $bufferSize -= 8; - $position = ($buffer & (0xff << $bufferSize)) >> $bufferSize; - $result .= chr($position); + private function baseDecode($data) + { + $characters = $this->base32Characters; + $buffer = 0; + $bufferSize = 0; + $result = ''; + for ($i = 0; $i < strlen($data); $i++) { + $position = strpos($characters, $data[$i]); + $buffer = ($buffer << 5) | $position; + $bufferSize += 5; + if ($bufferSize > 7) { + $bufferSize -= 8; + $position = ($buffer & (0xff << $bufferSize)) >> $bufferSize; + $result .= chr($position); + } } - } - return $result; + return $result; } - public function htmlBlocks($htmlBlock) { - if($htmlBlock == 'menu') { - return <<
You already enabled 2FA. Enter the code to disable it.
Turn's off the ezXSS platform. Can be re-activated by visiting https://{{setting[payload-domain]}}/?pass=
+ +