From 60bd0ffc369e52e915bf8a504572fc67cb7f0a7f Mon Sep 17 00:00:00 2001 From: dataking Date: Sun, 23 Oct 2016 10:58:53 -0700 Subject: [PATCH 01/15] prepping for travis CI --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7a870ba --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: perl +perl: + - "5.22" + - "5.18" + - "5.16" + - "5.14" From 9a91825434b171e9e23bfbd5a81f5764265ad254 Mon Sep 17 00:00:00 2001 From: dataking Date: Sun, 23 Oct 2016 11:24:33 -0700 Subject: [PATCH 02/15] more travis-ci prep --- .travis.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7a870ba..548056e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,3 +4,17 @@ perl: - "5.18" - "5.16" - "5.14" +before_install: + - sudo apt-get update -q + - sudo apt-get install -y htmldoc + - cpanm -v --installdeps --notest . +branches: + only: + - master +notification: + recipients: + - dataking@gmail.com + email: + on_success: change + on_failure: always +#env: From 2f22d6bb425488faba4978a6e15bf49e257c2be3 Mon Sep 17 00:00:00 2001 From: dataking Date: Sun, 23 Oct 2016 11:27:59 -0700 Subject: [PATCH 03/15] more travis-ci prep --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 548056e..bd74467 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,9 @@ perl: before_install: - sudo apt-get update -q - sudo apt-get install -y htmldoc - - cpanm -v --installdeps --notest . + - cpanm -v --installdeps --notest HTML::HTMLDoc + - cpanm -v --installdeps --notest Excel::Writer::XLS +# - cpanm -v --installdeps --notest . branches: only: - master From 403996e160a186730a5e7cede276edc0f19399e0 Mon Sep 17 00:00:00 2001 From: dataking Date: Sun, 23 Oct 2016 11:30:23 -0700 Subject: [PATCH 04/15] more travis-ci prep --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bd74467..3600ef4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ before_install: - sudo apt-get update -q - sudo apt-get install -y htmldoc - cpanm -v --installdeps --notest HTML::HTMLDoc - - cpanm -v --installdeps --notest Excel::Writer::XLS + - cpanm -v --installdeps --notest Excel::Writer::XLSX # - cpanm -v --installdeps --notest . branches: only: From 7669dc15ce6c77c6c5e452862a6ea9a4c42095c3 Mon Sep 17 00:00:00 2001 From: dataking Date: Sun, 23 Oct 2016 11:42:52 -0700 Subject: [PATCH 05/15] adding Makefile.PL --- Makefile.PL | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Makefile.PL diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..9ae56a0 --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,22 @@ +use 5.010001; + +use strict; +use warnings; + +use ExtUtils::MakeMaker; + +my ($mm) = $ExtUtils::MakeMaker::VERSION =~ /^([^_]+)/; + +WriteMakefile( + NAME => 'lynis_report', + VERSION_FROM => 'lynis_report.pl', + ABSTRACT => 'Because lynis needs a transportable report sometimes.', + AUTHOR => 'Charlie Heselton ', + + ($mm < 6.3002 ? () : ('LICENSE' => 'artistic_2')), + + PREREQ_PM => { + 'HTML::HTMLDoc' => 0, + 'Excel::Writer::XLSX' => 0, + }, +); From 10b0ce2f970825b3b1fdcbab841ada7fa349331f Mon Sep 17 00:00:00 2001 From: dataking Date: Sun, 23 Oct 2016 11:59:49 -0700 Subject: [PATCH 06/15] README.md update --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a48973e..69e8e95 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # lynis_report +[![Build Status](https://travis-ci.org/d4t4king/lynis_report.svg?branch=master)](https://travis-ci.org/d4t4king/lynis_report) Manageable report from lynix text output. ## Help Statement From 0262f38b5020590399e24fbf6c2dc888933d695c Mon Sep 17 00:00:00 2001 From: dataking Date: Sun, 23 Oct 2016 12:00:57 -0700 Subject: [PATCH 07/15] README.md update --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 69e8e95..d1478b7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # lynis_report [![Build Status](https://travis-ci.org/d4t4king/lynis_report.svg?branch=master)](https://travis-ci.org/d4t4king/lynis_report) + Manageable report from lynix text output. ## Help Statement From c45b940563e2d7b2fb7895846a9d792ad4aa5f3a Mon Sep 17 00:00:00 2001 From: dataking Date: Mon, 24 Oct 2016 11:30:20 -0700 Subject: [PATCH 08/15] readme fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d1478b7..c67841a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # lynis_report [![Build Status](https://travis-ci.org/d4t4king/lynis_report.svg?branch=master)](https://travis-ci.org/d4t4king/lynis_report) -Manageable report from lynix text output. +Manageable report from lynis text output. ## Help Statement * HTML out features (default) From 5f7ebe2c264eadba3a21b72a4a9869a41d0af0aa Mon Sep 17 00:00:00 2001 From: dataking Date: Tue, 25 Oct 2016 15:28:04 -0700 Subject: [PATCH 09/15] Updated README; format tweaks --- README.md | 17 ++++++++++++++++- lynis_report.pl | 6 +++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c67841a..7a5c20b 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,26 @@ Manageable report from lynis text output. ## Help Statement +``` +./lynis_report.pl -h|--help -v|--verbose -E|--excel -o|--output + +Where: + +-h|--help Display this useful message, then exit. +-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. This + options is not yet implemented (NYI). +-o|--output Specifies the output file to print the report to. +``` * HTML out features (default) + * Summarizes the lynis report into a single HTML file. * Excel out features + * Breaks out sections into worksheets. * PDF out features + * Copy of the HTML report ported to PDF. + ## TODO: -* Excel out WIP! * PDF out needs refinement * Other output formats? diff --git a/lynis_report.pl b/lynis_report.pl index 52fb996..18257aa 100755 --- a/lynis_report.pl +++ b/lynis_report.pl @@ -2005,10 +2005,10 @@ $0 -h|--help -v|--verbose -E|--excel -o|--output Where: -h|--help Display this useful message, then exit. --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. This - options is not yet implemented (NYI). + options is not yet implemented (NYI). -o|--output Specifies the output file to print the report to. END From 02fa08c6ad75b8363b79d4e7d0ceccade8bb953c Mon Sep 17 00:00:00 2001 From: dataking Date: Tue, 25 Oct 2016 15:30:00 -0700 Subject: [PATCH 10/15] usage tweaks --- lynis_report.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lynis_report.pl b/lynis_report.pl index 18257aa..10320db 100755 --- a/lynis_report.pl +++ b/lynis_report.pl @@ -22,7 +22,8 @@ GetOptions( 'p|pdf' => \$pdf, ); -if ($help) { &usage; } +&usage if ($help); +&usage if (!$output); my %to_bool = ( 0 => 'false', 1 => 'true' ); my %vm_mode = ( 0 => 'false', 1 => 'guest', 2 => 'host' ); From 77b3c916a2350fda8cdb4a78e720200f1ccd9cc8 Mon Sep 17 00:00:00 2001 From: dataking Date: Tue, 25 Oct 2016 16:50:40 -0700 Subject: [PATCH 11/15] Attempts at making modules required only for use. --- lynis_report.pl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lynis_report.pl b/lynis_report.pl index 10320db..c71a45d 100755 --- a/lynis_report.pl +++ b/lynis_report.pl @@ -8,10 +8,7 @@ no if $] ge '5.018', warnings => "experimental::smartmatch"; use Term::ANSIColor; use Getopt::Long qw( :config no_ignore_case bundling ); use Data::Dumper; -#use Spreadsheet::WriteExcel; -use Excel::Writer::XLSX; -#use File::Basename; -use HTML::HTMLDoc; +use Module::Load::Conditional qw( can_load check_install requires ); my ($help,$verbose,$excel,$output,$pdf); GetOptions( @@ -149,6 +146,7 @@ delete($lynis_report_data{'tests_executed'}); #print Dumper(\%warnings); if ($excel) { + require Excel::Writer::XLSX; my $i = 0; # do the Excel thing.... my $wb = Excel::Writer::XLSX->new($output); @@ -1981,6 +1979,7 @@ END } if ($pdf) { + require HTML::HTMLDoc; my $htmlobj = new HTML::HTMLDoc(); $htmlobj->set_input_file($htmldoc); my $pdfdoc = $htmlobj->generate_pdf(); From 225091a764502c69738236c439c972fdd2094435 Mon Sep 17 00:00:00 2001 From: dataking Date: Tue, 25 Oct 2016 17:07:52 -0700 Subject: [PATCH 12/15] added instructions for installing prerequisites. --- README.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a5c20b..8c2fcd8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,60 @@ # lynis_report [![Build Status](https://travis-ci.org/d4t4king/lynis_report.svg?branch=master)](https://travis-ci.org/d4t4king/lynis_report) -Manageable report from lynis text output. +Manageable report from lynis text output. Currently available report formats: HTML, PDF, Microsoft Excel (XLSX)\*. + +If you want to be able to use the PDF or Excel output formats, you must install some additional software. As is, the modules are required regardless of whether you use these features or not. Attempts are being made to change that behavior. + +## Instriuctions for pre-requisite installation: + +### For Debian/Ubuntu +```(as root) +apt update # versions prior to 16.04 LTS should use 'apt-get' +apt -y install htmldoc + +pushd /tmp/ +wget http://search.cpan.org/CPAN/authors/id/M/MF/MFRANKL/HTML-HTMLDoc-0.10.tar.gz +tar xvf HTML-HTMLDoc-0.10.tar.gz +pushd HTML-HTMLDoc-0.10 +perl Makefile.PL +make && make install +popd +wget http://search.cpan.org/CPAN/authors/id/J/JM/JMCNAMARA/Excel-Writer-XLSX-0.95.tar.gz +tar xvf Excel-Writer-XLSX-0.95.tar.gz +pushd Excel-Writer-XLSX-0.95 +perl Makefile.PL +make && make install +popd +popd +``` +### For RHEL/CentOS/Fedora +```(as root) +yum -y install htmldoc perl-Excel-Writer-XLSX +pushd /tmp/ +wget http://search.cpan.org/CPAN/authors/id/M/MF/MFRANKL/HTML-HTMLDoc-0.10.tar.gz +tar xvf HTML-HTMLDoc-0.10.tar.gz +pushd HTML-HTMLDoc-0.10 +perl Makefile.PL +make && make install +popd +popd +``` + +### for Gentoo +```(as root) +emerge -av1 app-text/htmldoc dev-perl/HTML-HTMLDoc + +pushd /tmp/ +wget http://search.cpan.org/CPAN/authors/id/J/JM/JMCNAMARA/Excel-Writer-XLSX-0.95.tar.gz +tar xvf Excel-Writer-XLSX-0.95.tar.gz +pushd Excel-Writer-XLSX-0.95 +perl Makefile.PL +make && make install +popd +popd + + +\* It's possible that the Excel format will load for LibreOffic Calc, but this is currentl untested. YMMV. ## Help Statement ``` From 6819ddcffd66b255caa4d5f106668398bada0a99 Mon Sep 17 00:00:00 2001 From: dataking Date: Tue, 25 Oct 2016 17:09:26 -0700 Subject: [PATCH 13/15] MD bug fix --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8c2fcd8..7dd0205 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,8 @@ If you want to be able to use the PDF or Excel output formats, you must install ## Instriuctions for pre-requisite installation: ### For Debian/Ubuntu -```(as root) +``` +(as root) apt update # versions prior to 16.04 LTS should use 'apt-get' apt -y install htmldoc @@ -28,7 +29,8 @@ popd popd ``` ### For RHEL/CentOS/Fedora -```(as root) +``` +(as root) yum -y install htmldoc perl-Excel-Writer-XLSX pushd /tmp/ wget http://search.cpan.org/CPAN/authors/id/M/MF/MFRANKL/HTML-HTMLDoc-0.10.tar.gz @@ -41,7 +43,8 @@ popd ``` ### for Gentoo -```(as root) +``` +(as root) emerge -av1 app-text/htmldoc dev-perl/HTML-HTMLDoc pushd /tmp/ @@ -52,6 +55,7 @@ perl Makefile.PL make && make install popd popd +``` \* It's possible that the Excel format will load for LibreOffic Calc, but this is currentl untested. YMMV. From 601fc700488cd77ffac54e1838f2bdeab83f2055 Mon Sep 17 00:00:00 2001 From: dataking Date: Tue, 25 Oct 2016 17:10:46 -0700 Subject: [PATCH 14/15] MD bug fix --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7dd0205..78fef5c 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ If you want to be able to use the PDF or Excel output formats, you must install ### For Debian/Ubuntu ``` -(as root) +\# (as root) apt update # versions prior to 16.04 LTS should use 'apt-get' apt -y install htmldoc @@ -30,7 +30,7 @@ popd ``` ### For RHEL/CentOS/Fedora ``` -(as root) +\# (as root) yum -y install htmldoc perl-Excel-Writer-XLSX pushd /tmp/ wget http://search.cpan.org/CPAN/authors/id/M/MF/MFRANKL/HTML-HTMLDoc-0.10.tar.gz @@ -42,9 +42,9 @@ popd popd ``` -### for Gentoo +### For Gentoo ``` -(as root) +\# (as root) emerge -av1 app-text/htmldoc dev-perl/HTML-HTMLDoc pushd /tmp/ From 23739761f34af352ff548b1ce010329496df159b Mon Sep 17 00:00:00 2001 From: dataking Date: Tue, 25 Oct 2016 17:11:24 -0700 Subject: [PATCH 15/15] MD bug fix --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 78fef5c..628b6dd 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ If you want to be able to use the PDF or Excel output formats, you must install ### For Debian/Ubuntu ``` -\# (as root) +# (as root) apt update # versions prior to 16.04 LTS should use 'apt-get' apt -y install htmldoc @@ -30,7 +30,7 @@ popd ``` ### For RHEL/CentOS/Fedora ``` -\# (as root) +# (as root) yum -y install htmldoc perl-Excel-Writer-XLSX pushd /tmp/ wget http://search.cpan.org/CPAN/authors/id/M/MF/MFRANKL/HTML-HTMLDoc-0.10.tar.gz @@ -44,7 +44,7 @@ popd ### For Gentoo ``` -\# (as root) +# (as root) emerge -av1 app-text/htmldoc dev-perl/HTML-HTMLDoc pushd /tmp/