Merge pull request #3 from gdfuego/master

Allow input of log file for offline processing
This commit is contained in:
dataking 2017-07-24 12:10:55 -07:00 committed by GitHub
commit e13bc9266d

View File

@ -14,9 +14,10 @@ use Module::Load::Conditional qw( can_load check_install requires );
my $VERSION = '0.3-beta'; my $VERSION = '0.3-beta';
my ($help,$verbose,$excel,$output,$pdf,$debug,$json,$quiet,$xml,$showversion); my ($help,$input,$verbose,$excel,$output,$pdf,$debug,$json,$quiet,$xml,$showversion);
GetOptions( GetOptions(
'h|help' => \$help, 'h|help' => \$help,
'i|input=s' => \$input,
'v|verbose+' => \$verbose, 'v|verbose+' => \$verbose,
'E|excel' => \$excel, 'E|excel' => \$excel,
'o|output=s' => \$output, 'o|output=s' => \$output,
@ -42,6 +43,7 @@ my %systemd_uf_status_color = (
'static' => 'inherit', 'static' => 'inherit',
'masked' => 'goldenrod' 'masked' => 'goldenrod'
); );
my $lynis_report;
if ($json) { $quiet = 1; } if ($json) { $quiet = 1; }
@ -66,8 +68,13 @@ if ($excel) {
$format = 'html'; $format = 'html';
} }
if (defined($input)) {
$lynis_report = $input;
} else {
$lynis_report = '/var/log/lynis-report.dat';
}
my $lynis_log = '/var/log/lynis.log'; my $lynis_log = '/var/log/lynis.log';
my $lynis_report = '/var/log/lynis-report.dat';
my $audit_run = 0; #assume false my $audit_run = 0; #assume false
my %lynis_report_data; my %lynis_report_data;
@ -2381,6 +2388,7 @@ $0 -h|--help -v|--verbose -E|--excel -j|--json -x|--xml -p|--pdf -o|--output
Where: Where:
-h|--help Display this useful message, then exit. -h|--help Display this useful message, then exit.
-i|--input Input log filename. Defaults to /var/log/lynis-report.dat.
-v|--verbose Display more detailed output. This is typically used for debugging, but may provide insight when running into problems. -v|--verbose Display more detailed output. This is typically used for debugging, but may provide insight when running into problems.
-E|--excel Output the report in Microsoft Excel binary format. -E|--excel Output the report in Microsoft Excel binary format.
-j|--json Output the data in JSON format. It is recommended to pipe to /usr/bin/json_pp for easier (human) reading. Output file name is optional for JSON output. -j|--json Output the data in JSON format. It is recommended to pipe to /usr/bin/json_pp for easier (human) reading. Output file name is optional for JSON output.