Last active
September 14, 2018 22:10
-
-
Save HacKanCuBa/2c04c435b7812f9bc718e9351aa87791 to your computer and use it in GitHub Desktop.
Safe phpinfo file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Safe PHPInfo file by HacKan | |
// You should prefer to delete it after using it, but we know how that can go... at least, be safe | |
// create passwd with: | |
// php -r '$pass = bin2hex(random_bytes(10)); echo "Plain: ", $pass, PHP_EOL, "Encrypted: ", password_hash($pass, PASSWORD_DEFAULT), PHP_EOL;' | |
define('PASSWD',''); | |
$p = filter_input(INPUT_GET, 'p', FILTER_SANITIZE_STRING); | |
if (!empty(PASSWD) && !empty($p) && password_verify($p, PASSWD)) { | |
phpinfo(); | |
} else { | |
http_response_code(403); | |
die('Access denied'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment