Skip to content

Instantly share code, notes, and snippets.

@HacKanCuBa
Last active September 14, 2018 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HacKanCuBa/2c04c435b7812f9bc718e9351aa87791 to your computer and use it in GitHub Desktop.
Save HacKanCuBa/2c04c435b7812f9bc718e9351aa87791 to your computer and use it in GitHub Desktop.
Safe phpinfo file
<?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