| 1 | #VERSION,2.02 |
|---|
| 2 | # $Id: nikto_reports.plugin 87 2008-11-11 19:13:19Z deity $ |
|---|
| 3 | |
|---|
| 4 | ############################################################################### |
|---|
| 5 | # Copyright (C) 2007 CIRT, Inc. |
|---|
| 6 | # |
|---|
| 7 | # This program is free software; you can redistribute it and/or |
|---|
| 8 | # modify it under the terms of the GNU General Public License |
|---|
| 9 | # as published by the Free Software Foundation; version 2 |
|---|
| 10 | # of the License only. |
|---|
| 11 | # |
|---|
| 12 | # This program is distributed in the hope that it will be useful, |
|---|
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | # GNU General Public License for more details. |
|---|
| 16 | # |
|---|
| 17 | # You should have received a copy of the GNU General Public License |
|---|
| 18 | # along with this program; if not, write to the Free Software |
|---|
| 19 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 20 | ############################################################################### |
|---|
| 21 | |
|---|
| 22 | ############################################################################### |
|---|
| 23 | # PURPOSE |
|---|
| 24 | # Reporting |
|---|
| 25 | ############################################################################### |
|---|
| 26 | sub nikto_report_text_init |
|---|
| 27 | { |
|---|
| 28 | my $id = |
|---|
| 29 | { |
|---|
| 30 | name => "reports_text", |
|---|
| 31 | full_name => "Text reports", |
|---|
| 32 | author => "Deity", |
|---|
| 33 | description => "Produces a text report.", |
|---|
| 34 | report_head => \&text_open, |
|---|
| 35 | report_host_start => \&text_host, |
|---|
| 36 | report_item => \&text_item, |
|---|
| 37 | report_format => 'txt', |
|---|
| 38 | copyright => "2008 CIRT Inc." |
|---|
| 39 | }; |
|---|
| 40 | return $id; |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | sub text_open |
|---|
| 44 | { |
|---|
| 45 | my ($file) = @_; |
|---|
| 46 | # Open file and produce header |
|---|
| 47 | open(OUT, ">>$file") || die print STDERR "+ ERROR: Unable to open '$file' for write: $@\n"; |
|---|
| 48 | |
|---|
| 49 | # Write header |
|---|
| 50 | print OUT "- $NIKTO{name} v$NIKTO{version}/$NIKTO{core_version}\n"; |
|---|
| 51 | |
|---|
| 52 | return OUT; |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | sub text_host |
|---|
| 56 | { |
|---|
| 57 | my ($handle, $mark) = @_; |
|---|
| 58 | my $curr_host, $curr_port; |
|---|
| 59 | print $handle "+ Target Host: $mark->{hostname}\n"; |
|---|
| 60 | print $handle "+ Target Port: $mark->{port}\n"; |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | sub text_item |
|---|
| 64 | { |
|---|
| 65 | my ($handle, $mark, $item) = @_; |
|---|
| 66 | |
|---|
| 67 | foreach my $uri (split(' ',$item->{uri})) |
|---|
| 68 | { |
|---|
| 69 | my $line="+ "; |
|---|
| 70 | if ($item->{osvdb}) { $line.="OSVDB-$item->{osvdb}: " }; |
|---|
| 71 | if ($item->{method}) { $line.="$item->{method} " }; |
|---|
| 72 | if ($uri) { $line.="${uri}: " }; |
|---|
| 73 | $line.=$item->{message}; |
|---|
| 74 | print $handle "$line\n"; |
|---|
| 75 | } |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | 1; |
|---|