Changeset 703


Ignore:
Timestamp:
12/15/2011 05:26:31 AM (18 months ago)
Author:
sullo
Message:

Ticket 229: Don't repeat XML headers if appending to an existing report file, thanks to digininja for idea

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/CHANGES.txt

    r702 r703  
    112011-12-11 
     2        - Ticket 229: Don't repeat XML headers if appending to an existing report file, thanks to digininja for idea 
    23        - Ticket 228: Add client SSL certificate support. Thanks to monnerat for code submission! 
    34        - Ticket 226: Add GMT offset to time outputs 
  • trunk/plugins/nikto_core.plugin

    r701 r703  
    14211421 
    14221422            if ($res) { 
    1423  
    1424       # this will fix for some Apaches that are smart enough to answer non ssl reqs on an ssl server 
     1423                        # this will fix for some Apaches that are smart enough to answer non ssl reqs on an ssl server 
    14251424                if (defined $content 
    14261425                    && $content =~ /speaking plain HTTP to an SSL/) { 
    14271426                    dump_var("Result Hash", \%result); 
    14281427                    next; 
    1429                 } 
     1428                        } 
    14301429                nprint("- $checkssl Server found: " 
    14311430                         . ($hostname || $ip) 
  • trunk/plugins/nikto_report_xml.plugin

    r702 r703  
    4343sub xml_head { 
    4444    my ($file) = @_; 
    45  
    46     # Write header for xml file, return file handle 
     45     
     46    # check for xml headers 
     47    $header_present=0; 
     48 
     49    if (-e $file) {  
     50        open(IN,"<$file") || die print STDERR "+ ERROR: Unable to open '$file' for read: $@\n"; 
     51        my $linectr=0; 
     52        while (<IN>) {  
     53                $linectr++; 
     54                if ($_ =~ /DOCTYPE niktoscan/) { $header_present=1; last; } 
     55                if ($linectr > 10) { last; } 
     56                        } 
     57                close(IN); 
     58        } 
     59 
    4760    open(OUT, ">>$file") || die print STDERR "+ ERROR: Unable to open '$file' for write: $@\n"; 
    48  
    49     my $xml = xml_change_vars($TEMPLATES{xml_start}); 
    50     $xml =~ s/\#NIKTODTD#/$CONFIGFILE{NIKTODTD}/; 
    51     print OUT "$xml"; 
    52  
     61  
     62        # If file doesn't contain a header, write it 
     63        if (!$header_present) {  
     64            my $xml = xml_change_vars($TEMPLATES{xml_start}); 
     65        $xml =~ s/\#NIKTODTD#/$CONFIGFILE{NIKTODTD}/; 
     66            print OUT "$xml"; 
     67            } 
     68 
     69        # Return file handle 
    5370    return OUT; 
    5471} 
  • trunk/templates/xml_host_head.tmpl

    r702 r703  
     1<niktoscan hoststest="#TEMPL_NIKTO_HOSTS_TESTED#" options="#TEMPL_NIKTO_CLI#" version="#TEMPL_NIKTO_VER#" scanstart="#TEMPL_SCAN_START#" scanend="#TEMPL_SCAN_END#" scanelapsed="#TEMPL_SCAN_ELAPSED#" nxmlversion="1.2"> 
     2 
    13<scandetails targetip="#TEMPL_IP#" targethostname="#TEMPL_HOSTNAME#" targetport="#TEMPL_PORT#" targetbanner="#TEMPL_BANNER#" starttime="#TEMPL_START#" sitename="#TEMPL_LINK_NAME#" siteip="#TEMPL_LINK_IP#" hostheader="#TEMPL_HOST_HEADER#" errors="#TEMPL_ERRORS#" checks="#TEMPL_CTR#"> 
    24#TEMPL_SSL_INFO# 
  • trunk/templates/xml_start.tmpl

    r702 r703  
    11<?xml version="1.0" ?> 
    22<!DOCTYPE niktoscan SYSTEM "#NIKTODTD#"> 
    3 <niktoscan hoststest="#TEMPL_NIKTO_HOSTS_TESTED#" options="#TEMPL_NIKTO_CLI#" version="#TEMPL_NIKTO_VER#" scanstart="#TEMPL_SCAN_START#" scanend="#TEMPL_SCAN_END#" scanelapsed="#TEMPL_SCAN_ELAPSED#" nxmlversion="1.2"> 
Note: See TracChangeset for help on using the changeset viewer.