Skip to content

Commit 5dd139e

Browse files
committed
feat: add defs list functions encoded
1 parent 2be6a30 commit 5dd139e

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

src/Console.php

+10-3
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,14 @@ public static function title($text, $char = ' ', $length = null)
178178
/**
179179
* Print progress.
180180
*
181-
* @param $done
182-
* @param $total
181+
* @param float $done
182+
* @param float $total
183183
* @param int $size
184184
*/
185185
public static function progress($done, $total, $size = 30)
186186
{
187187
static $startTime;
188-
if ($done > $total) {
188+
if ($done > $total || $total === 0) {
189189
return;
190190
}
191191
if (empty($startTime)) {
@@ -534,6 +534,13 @@ public static function helplist($type = null)
534534
$functionsList = implode(self::eol(1) . '- ', Definitions::$FUNCTIONS);
535535
$list .= self::eol(1) . 'Functions:' . self::eol(1) . "- $functionsList";
536536
}
537+
if (empty($type)) {
538+
$list .= self::eol(1);
539+
}
540+
if (empty($type) || $type === 'functions-encoded') {
541+
$functionsList = implode(self::eol(1) . '- ', Definitions::$FUNCTIONS_ENCODED);
542+
$list .= self::eol(1) . 'Functions Encoded:' . self::eol(1) . "- $functionsList";
543+
}
537544
self::displayTitle(trim($type . ' List'), 'black', 'cyan');
538545
self::displayLine($list, 2);
539546
}

src/Scanner.php

+13-7
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ private function arguments($args = null)
349349
// Define Arguments
350350
self::$argv = new Argv(self::$name, self::$description);
351351
self::$argv->addFlag('agile', ['alias' => '-a', 'default' => false, 'help' => 'Help to have less false positive on WordPress and others platforms enabling exploits mode and removing some common exploit pattern']);
352-
self::$argv->addFlag('help', ['alias' => '-h', 'default' => false, 'help' => 'Check only functions and not the exploits']);
352+
self::$argv->addFlag('help', ['alias' => ['-h', '-?'], 'default' => false, 'help' => 'Check only functions and not the exploits']);
353353
self::$argv->addFlag('log', ['alias' => '-l', 'default' => self::$pathLogs, 'has_value' => true, 'value_name' => 'path', 'help' => 'Write a log file on the specified file path']);
354354
self::$argv->addFlag('backup', ['alias' => '-b', 'default' => false, 'help' => 'Make a backup of every touched files']);
355355
self::$argv->addFlag('offset', ['default' => null, 'has_value' => true, 'help' => 'Set file mapping offset']);
@@ -361,9 +361,10 @@ private function arguments($args = null)
361361
self::$argv->addFlag('only-signatures', ['alias' => '-s', 'default' => false, 'help' => "Check only functions and not the exploits.\nThis is recommended for WordPress or others platforms"]);
362362
self::$argv->addFlag('only-exploits', ['alias' => '-e', 'default' => false, 'help' => 'Check only exploits and not the functions']);
363363
self::$argv->addFlag('only-functions', ['alias' => '-f', 'default' => false, 'help' => 'Check only functions and not the exploits']);
364-
self::$argv->addFlag('definitions-list', ['default' => false, 'help' => 'Get default definitions exploit and functions list']);
365-
self::$argv->addFlag('definitions-exploits', ['default' => false, 'help' => 'Get default definitions exploits list']);
366-
self::$argv->addFlag('definitions-functions', ['default' => false, 'help' => 'Get default definitions functions lists']);
364+
self::$argv->addFlag('defs', ['default' => false, 'help' => 'Get default definitions exploit and functions list']);
365+
self::$argv->addFlag('defs-exploits', ['default' => false, 'help' => 'Get default definitions exploits list']);
366+
self::$argv->addFlag('defs-functions', ['default' => false, 'help' => 'Get default definitions functions lists']);
367+
self::$argv->addFlag('defs-functions-encoded', ['default' => false, 'help' => 'Get default definitions functions encoded lists']);
367368
self::$argv->addFlag('exploits', ['default' => false, 'has_value' => true, 'help' => 'Filter exploits']);
368369
self::$argv->addFlag('functions', ['default' => false, 'has_value' => true, 'help' => 'Define functions to search']);
369370
self::$argv->addFlag('whitelist-only-path', ['default' => false, 'help' => 'Check on whitelist only file path and not line number']);
@@ -401,21 +402,26 @@ private function arguments($args = null)
401402
}
402403

403404
// List exploits
404-
if (isset(self::$argv['definitions-list']) && self::$argv['definitions-list']) {
405+
if (isset(self::$argv['defs']) && self::$argv['defs']) {
405406
Console::helplist();
406407
$this->interrupt();
407408
}
408409

409410
// List exploits
410-
if (isset(self::$argv['definitions-exploits']) && self::$argv['definitions-exploits']) {
411+
if (isset(self::$argv['defs-exploits']) && self::$argv['defs-exploits']) {
411412
Console::helplist('exploits');
412413
}
413414

414415
// List functions
415-
if (isset(self::$argv['definitions-functions']) && self::$argv['definitions-functions']) {
416+
if (isset(self::$argv['defs-functions']) && self::$argv['defs-functions']) {
416417
Console::helplist('functions');
417418
}
418419

420+
// List functions encoded
421+
if (isset(self::$argv['defs-functions-encoded']) && self::$argv['defs-functions-encoded']) {
422+
Console::helplist('functions-encoded');
423+
}
424+
419425
// Update
420426
if (isset(self::$argv['update']) && self::$argv['update']) {
421427
$this->update();

0 commit comments

Comments
 (0)