-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexecv.php
53 lines (47 loc) · 1.01 KB
/
execv.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
<?php
include "config.php";
include "layout.class.php";
include "bartlby-ui.class.php";
$btl=new BartlbyUi($Bartlby_CONF);
$info=$btl->getInfo();
$layout= new Layout();
$layout->setTemplate("nonav.html");
$layout->MetaRefresh(10);
$layout->Table("100%");
$lib=bartlby_lib_info($btl->RES);
$exi=-1;
$plugin_dir=bartlby_config($btl->CFG, "agent_plugin_dir");
if(!$plugin_dir) {
$cmd_out="agent_plugin_dir not set";
} else {
if(strstr($_GET[cmd], "/") || strstr($_GET[cmd], "..")) {
$cmd_out=".. or / detected skipped cmd";
} else {
$fp=popen($plugin_dir . "/" . $_GET[cmd],"r");
while(!feof($fp)) {
$cmd_out .= nl2br(fgets($fp, 1024));
}
$exi=(fclose($fp)>>8)&0xFF;
}
}
$layout->Tr(
$layout->Td(
Array(
0=>Array(
'colspan'=> 1,
'class'=>'header',
'show'=>"Executing ($_GET[cmd])"
)
)
)
);
$layout->Tr(
$layout->Td(
Array(
0=>$cmd_out . "<br>Exited with: $exi"
)
)
);
$layout->TableEnd();
$layout->display("no");
?>