diff --git a/lynis-report-converter.pl b/lynis-report-converter.pl index 05d32d0..7205722 100755 --- a/lynis-report-converter.pl +++ b/lynis-report-converter.pl @@ -74,20 +74,20 @@ if (( -e $lynis_report) and ( ! -z $lynis_report )) { } if (($audit_run) and ($audit_run >= 1)) { - print colored("Looks like the audit has been run.", "bold green") unless ($quiet); + print colored("Looks like the audit has been run.", "green") unless ($quiet); print "\n" unless ($quiet); } else { warn colored("Couldn't find one or more of the lynis output files. Try running the audit again. \n", "bold red"); } unless ($quiet) { - print colored("Outputting report to $output, in ", "bold green"); - if ($excel) { print colored("Excel ", "bold green"); } - elsif ($pdf) { print colored("PDF ", "bold green)"); } - elsif ($xml) { print colored("XML ", "bold green"); } - elsif ($json) { print colored("JSON ", "bold green"); } - else { print colored("HTML ", "bold green"); } - print colored("format.", "bold green"); + print colored("Outputting report to $output, in ", "green"); + if ($excel) { print colored("Excel ", "green"); } + elsif ($pdf) { print colored("PDF ", "green)"); } + elsif ($xml) { print colored("XML ", "green"); } + elsif ($json) { print colored("JSON ", "green"); } + else { print colored("HTML ", "green"); } + print colored("format.", "green"); print "\n"; } @@ -148,7 +148,7 @@ if (exists($lynis_report_data{'pam_auth_brute_force_protection_module[]'})) { } } -foreach my $key ( qw( certificates domainname journal_disk_size pop3_daemon imap_daemon printing_daemon ntp_daemon ntp_version apache_version systemd_version systemd_status systemd_builtin_components journal_coredumps_lastday running_service_tool ) ) { +foreach my $key ( qw( certificates domainname journal_disk_size pop3_daemon imap_daemon printing_daemon ntp_daemon ntp_version apache_version systemd_version systemd_status systemd_builtin_components journal_coredumps_lastday running_service_tool service_manager localhost-mapped-to ) ) { # if element is not an array we don't need to flatten it if (ref($lynis_report_data{$key}) ne 'ARRAY') { warn colored("Skipped flatten $key since it's not an array.", "yellow") if ($verbose); @@ -167,7 +167,7 @@ foreach my $key ( sort keys %lynis_report_data ) { if (((ref($lynis_report_data{$key}) ne 'ARRAY') and (ref($lynis_report_data{$key}) ne 'HASH')) and ($lynis_report_data{$key} =~ /\|/)) { - print colored($key."\n", "bold green") if (($verbose) and ($verbose > 1)); + print colored($key."\n", "green") if (($verbose) and ($verbose > 1)); my @fs = split(/\|/, $lynis_report_data{$key}); undef($lynis_report_data{$key}); push @{$lynis_report_data{$key}}, @fs; @@ -339,6 +339,9 @@ if ($json) { } } } else { + if ($key =~ /.*\[\]$/) { + $key =~ s/\[\]//g; + } $writer->dataElement($key, $lynis_report_data{$key}); } } @@ -1217,7 +1220,7 @@ END print OUT "\t\t\t\t\t$warn_id$warn_desc$to_long_severity{$warn_sev}$warn_f4\n"; } } elsif (${$lynis_report_data{'warning[]'}}[0] =~ /[A-Z]{4}\-\d{4}/) { # one warning - print colored(Dumper(\@{$lynis_report_data{'warning[]'}})."\n", "bold green") if ($verbose); + print colored(Dumper(\@{$lynis_report_data{'warning[]'}})."\n", "green") if ($verbose); my $warn_id = ${$lynis_report_data{'warning[]'}}[0]; my $warn_desc = ${$lynis_report_data{'warning[]'}}[1]; my $warn_sev = ${$lynis_report_data{'warning[]'}}[2]; @@ -1278,7 +1281,7 @@ END } foreach my $f ( @{$lynis_report_data{'deleted_file[]'}} ) { print OUT "\t\t\t\t\t