mirror of
https://github.com/scr34m/php-malware-scanner.git
synced 2026-06-16 12:30:35 +00:00
Short argument names
This commit is contained in:
17
scan.php
17
scan.php
@@ -182,7 +182,7 @@ class MalwareScanner
|
||||
private function parseArgs()
|
||||
{
|
||||
$options = getopt(
|
||||
'd:e:i:abmcxlhkwnspt',
|
||||
'd:e:i:o:abmcxlhkwnsptL',
|
||||
array(
|
||||
'directory:',
|
||||
'extension:',
|
||||
@@ -267,13 +267,12 @@ class MalwareScanner
|
||||
if (isset($options['time']) || isset($options['t'])) {
|
||||
$this->setFlagTime(true);
|
||||
}
|
||||
if (isset($options['line-number'])) {
|
||||
if (isset($options['line-number']) || isset($options['L'])) {
|
||||
$this->setFlagLineNumber(true);
|
||||
}
|
||||
if (isset($options['output-format'])) {
|
||||
$this->setOutputFormat(
|
||||
is_array($options['output-format']) ? $options['output-format'] : array ($options['output-format'])
|
||||
);
|
||||
if (isset($options['output-format']) || isset($options['o'])) {
|
||||
$tmp = isset($options['output-format']) ? $options['output-format'] : $options['o'];
|
||||
$this->setOutputFormat(is_array($tmp) ? $tmp : array($tmp));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -571,7 +570,7 @@ class MalwareScanner
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
$this->printPath($found, $path, $toSearch, $comment, $hash, -1);
|
||||
$this->printPath($found, $path, $toSearch, $comment, $hash, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -628,7 +627,7 @@ class MalwareScanner
|
||||
if ($hash === '') {
|
||||
$hash = md5($fileContent);
|
||||
}
|
||||
$lineNumber = 1;
|
||||
$lineNumber = 0;
|
||||
if ($this->flagLineNumber) {
|
||||
if ($pos = strrpos(substr($fileContent, 0, $position), "\n")) {
|
||||
$lineNumber = substr_count(substr($fileContent, 0, $pos + 1), "\n") + 1;
|
||||
@@ -663,6 +662,8 @@ class MalwareScanner
|
||||
echo ' -s --no-stop Continue scanning file after first hit' . PHP_EOL;
|
||||
echo ' -p --pattern Show Patterns next to the file name' . PHP_EOL;
|
||||
echo ' -t --time Show time of last file change' . PHP_EOL;
|
||||
echo ' -L --line-number Display matching pattern line number in file' . PHP_EOL;
|
||||
echo ' -o --output-format Custom defined output format' . PHP_EOL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user