From 9197f84f3df98f3e4b0bac2ad4912160dd3dbf17 Mon Sep 17 00:00:00 2001 From: dataking Date: Thu, 27 Apr 2017 13:28:48 -0700 Subject: [PATCH] fix situation where {'details[]'} doesn't exist for JSON output. --- lynis-report-converter.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lynis-report-converter.pl b/lynis-report-converter.pl index 1696897..82a0619 100755 --- a/lynis-report-converter.pl +++ b/lynis-report-converter.pl @@ -219,7 +219,7 @@ if ($json) { push @nlp_new, { 'port' => $port, 'protocol' => $proto, 'owner_process' => $proc }; } $lynis_report_data{'network_listen_port[]'} = \@nlp_new; - my @details = @{$lynis_report_data{'details[]'}}; + my @details = @{$lynis_report_data{'details[]'}} unless (!exists($lynis_report_data{'details[]'}));; my @det_new; foreach my $d ( @details ) { my ($id,$svc,$desc,$nmn) = split(/\|/, $d);