-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathssh.php
More file actions
30 lines (22 loc) · 736 Bytes
/
ssh.php
File metadata and controls
30 lines (22 loc) · 736 Bytes
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
<?php
require 'poof.php';
if (!safe($_SESSION['POOFSITE']['login']))
die(header("Location: http://$POOF_HOST$POOF_URL/admin.php"));
foreach ($_SERVER as $var => $value)
putenv("$var=$value");
$fp=popen("shellinaboxd --cgi -t -s \"/:\$(id -u):\$(id -g):HOME:/bin/sh\" 2>&1","r");
$valid=array('X-ShellInABox-Port','X-ShellInABox-Pid','Content-type');
while ($line=trim(fgets($fp)))
{
if ($line=="") break;
$exp=explode(':',$line,2);
if (!in_array($exp[0],$valid))
die("ERROR: ".$line);
header($line);
}
//fpassthru($fp);
while ($line=fgets($fp))
{
echo($line);
if (trim($line)=="</html>") break;
}