merge; help update

This commit is contained in:
dataking 2016-10-25 19:33:45 -07:00
commit ff3c40d095
4 changed files with 125 additions and 7 deletions

22
.travis.yml Normal file
View File

@ -0,0 +1,22 @@
language: perl
perl:
- "5.22"
- "5.18"
- "5.16"
- "5.14"
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::XLSX
# - cpanm -v --installdeps --notest .
branches:
only:
- master
notification:
recipients:
- dataking@gmail.com
email:
on_success: change
on_failure: always
#env:

22
Makefile.PL Normal file
View File

@ -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 <dataking@gmail.com>',
($mm < 6.3002 ? () : ('LICENSE' => 'artistic_2')),
PREREQ_PM => {
'HTML::HTMLDoc' => 0,
'Excel::Writer::XLSX' => 0,
},
);

View File

@ -1,12 +1,86 @@
# lynis_report
Manageable report from lynix text output.
[![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. 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
```
./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?

View File

@ -8,8 +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 File::Basename;
use Module::Load::Conditional qw( can_load check_install requires );
my ($help,$verbose,$excel,$output,$pdf);
GetOptions(
@ -20,7 +19,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' );
@ -146,7 +146,7 @@ delete($lynis_report_data{'tests_executed'});
#print Dumper(\%warnings);
if ($excel) {
use Excel::Writer::XLSX;
require Excel::Writer::XLSX;
my $i = 0;
# do the Excel thing....
my $wb = Excel::Writer::XLSX->new($output);
@ -1979,7 +1979,7 @@ END
}
if ($pdf) {
use HTML::HTMLDoc;
require HTML::HTMLDoc;
my $htmlobj = new HTML::HTMLDoc();
$htmlobj->set_input_file($htmldoc);
my $pdfdoc = $htmlobj->generate_pdf();