diff --git a/lynis-report-converter.pl b/lynis-report-converter.pl index 9ba862e..1696897 100755 --- a/lynis-report-converter.pl +++ b/lynis-report-converter.pl @@ -1441,7 +1441,15 @@ END END - print OUT "\t\t\t\t\t\tAvailable shells:".join("
\n", @{$lynis_report_data{'available_shell[]'}})."\n"; + if (exists($lynis_report_data{'available_shell[]'})) { + if (ref($lynis_report_data{'available_shell[]'}) eq 'ARRAY') { + print OUT "\t\t\t\t\t\tAvailable shells:".join("
\n", @{$lynis_report_data{'available_shell[]'}})."\n"; + } else { + print OUT "\t\t\t\t\t\tAvailable shells:$lynis_report_data{'available_shell[]'}\n"; + } + } else { + print OUT "\t\t\t\t\t\tAvailable shells: \n"; + } $lynis_report_data{'locate_db'} = " " if ((!defined($lynis_report_data{'locate_db'})) or ($lynis_report_data{'locate_db'} eq "")); #print STDERR colored($lynis_report_data{'vm'}."\n", "bold magenta"); $lynis_report_data{'vm'} = 0 if ((!defined($lynis_report_data{'vm'})) or ($lynis_report_data{'vm'} eq "")); @@ -1607,10 +1615,34 @@ END IPv6 Only:$to_bool{$lynis_report_data{'ipv6_only'}} END - print OUT "\t\t\t\t\tnetwork interfaces:".join("
\n", @{$lynis_report_data{'network_interface[]'}})."\n"; + if (exists($lynis_report_data{'network_interface[]'})) { + if (ref($lynis_report_data{'network_interface[]'}) eq 'ARRAY') { + print OUT "\t\t\t\t\tnetwork interfaces:".join("
\n", @{$lynis_report_data{'network_interface[]'}})."\n"; + } else { + print OUT "\t\t\t\t\t\tnetwork interfaces:$lynis_report_data{'network_interface[]'}\n"; + } + } else { + print OUT "\t\t\t\t\t\tnetwork interfaces: \n"; + } print OUT "\t\t\t\t\t\tlocalhost mapped to:$lynis_report_data{'localhost-mapped-to'}\n"; - print OUT "\t\t\t\t\tipv4 addresses:".join("
\n", @{$lynis_report_data{'network_ipv4_address[]'}})."\n"; - print OUT "\t\t\t\t\tipv6 addresses:".join("
\n", @{$lynis_report_data{'network_ipv6_address[]'}})."\n"; + if (exists($lynis_report_data{'network_ipv4_address[]'})) { + if (ref($lynis_report_data{'network_ipv4_address[]'}) eq 'ARRAY') { + print OUT "\t\t\t\t\tipv4 addresses:".join("
\n", @{$lynis_report_data{'network_ipv4_address[]'}})."\n"; + } else { + print OUT "\t\t\t\t\tipv4 addresses:$lynis_report_data{'network_ipv4_address[]'}\n"; + } + } else { + print OUT "\t\t\t\t\tipv4 addresses: \n"; + } + if (exists($lynis_report_data{'network_ipv6_address[]'})) { + if (ref($lynis_report_data{'network_ipv6_address[]'}) eq 'ARRAY') { + print OUT "\t\t\t\t\tipv6 addresses:".join("
\n", @{$lynis_report_data{'network_ipv6_address[]'}})."\n"; + } else { + print OUT "\t\t\t\t\tipv6 addresses:$lynis_report_data{'network_ipv6_address[]'}\n"; + } + } else { + print OUT "\t\t\t\t\tipv6 addresses: \n"; + } print OUT "\t\t\t\t\tDefault Gateway$lynis_report_data{'default_gateway[]'}\n"; print OUT "\t\t\t\t\t\n"; #print STDERR "Should be ARRAY: |".ref($lynis_report_data{'network_mac_address[]'})."|\n"; @@ -1647,19 +1679,21 @@ END IP AddressPortProtocolDaemon/Process??? END - foreach my $obj ( sort @{$lynis_report_data{'network_listen_port[]'}} ) { - my ($ipp,$proto,$daemon,$dunno) = split(/\|/, $obj); - my ($ip,$port); - if (grep(/\:/, split(//, $ipp)) > 1) { - # must be an IPv6 address; - my @parts = split(/\:/, $ipp); - $port = pop(@parts); # gets the last element of the array. like $parts[-1]; - $ip = join(":", @parts); # should only be the remaining parts, which should be the ipv6 addr - } else { - # must be IPv4 - ($ip,$port) = split(/\:/, $ipp); + if (exists($lynis_report_data{'network_listen_port[]'})) { + foreach my $obj ( sort @{$lynis_report_data{'network_listen_port[]'}} ) { + my ($ipp,$proto,$daemon,$dunno) = split(/\|/, $obj); + my ($ip,$port); + if (grep(/\:/, split(//, $ipp)) > 1) { + # must be an IPv6 address; + my @parts = split(/\:/, $ipp); + $port = pop(@parts); # gets the last element of the array. like $parts[-1]; + $ip = join(":", @parts); # should only be the remaining parts, which should be the ipv6 addr + } else { + # must be IPv4 + ($ip,$port) = split(/\:/, $ipp); + } + print OUT "\t\t\t\t\t$ip$port$proto$daemon$dunno\n"; } - print OUT "\t\t\t\t\t$ip$port$proto$daemon$dunno\n"; } ####################################### ### SECURITY INFO @@ -1895,13 +1929,15 @@ END

kernel modules loaded:

> show <