Changeset 186


Ignore:
Timestamp:
10/18/2009 06:50:56 PM (4 years ago)
Author:
sullo
Message:
  • Standardization of ERROR print prefix, as well as matching in nprint to make sure we don't send things to STDERR we don't mean to.
  • If outputfile is - don't send any output to STDOUT, regardless of -F type.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/nikto.pl

    r177 r186  
    224224   my $configfile=$_[0]; 
    225225 
    226    open(CONF, "<$configfile") || return "- ERROR: Unable to open config file '$configfile'"; 
     226   open(CONF, "<$configfile") || return "+ ERROR: Unable to open config file '$configfile'"; 
    227227   my @CONFILE = <CONF>; 
    228228   close(CONF); 
  • trunk/plugins/nikto_core.plugin

    r176 r186  
    9494   }  
    9595   # print errors to STDERR 
    96    if ($line =~ /ERROR\:/) { print STDERR "$line\n"; return; } 
     96   if ($line =~ /^+ ERROR\:/) { print STDERR "$line\n"; return; } 
    9797    
    9898   # don't print to STDOUT if output file is "-" 
    99    if ($CLI{format} =~ /^xml$/i and $CLI{file} eq "-") { return; } 
    100   
    101    # don't print to STDOUT if output file is "-" 
    102    if ($CLI{format} =~ /^html?$/i and $CLI{file} eq "-") { return; } 
    103     
     99   if ($CLI{file} eq "-") { return; } 
    104100 
    105101   # print to scan details to standard output if the users wants another format and is saving results to a file 
     
    596592  
    597593 # verify readable dtd  
    598  if ($CLI{format} =~ /xml/i and !-r $NIKTOCONFIG{NIKTODTD})   { nprint("+ ERROR: reading DTD"); exit; }  
     594 if ($CLI{format} eq 'xml' && !-r $NIKTOCONFIG{NIKTODTD})   { nprint("+ ERROR: reading DTD"); exit; }  
    599595 
    600596 # screen output 
     
    759755         if ($start > $end) 
    760756         { 
    761             nprint("- ERROR port range $port doesn't make sense - assuming 80/tcp"); 
     757            nprint("+ ERROR port range $port doesn't make sense - assuming 80/tcp"); 
    762758            next; 
    763759         } 
     
    10401036           if ($line eq "") { next; } 
    10411037           my @L=parse_csv($line); 
    1042            if ($line !~ /^\".*\"\,\".*\"\,\".*\"$/) { print STDERR "\tERROR: Invalid syntax ($#L): $line\n"; next; } 
    1043            if ($#L ne 3) { print STDERR "\tERROR: Invalid syntax ($#L): $line\n"; next; } 
     1038           if ($line !~ /^\".*\"\,\".*\"\,\".*\"$/) { print STDERR "\t+ ERROR: Invalid syntax ($#L): $line\n"; next; } 
     1039           if ($#L ne 3) { print STDERR "\t+ ERROR: Invalid syntax ($#L): $line\n"; next; } 
    10441040           $ENTRIES{"$L[0]"}++; 
    10451041         } 
    10461042 
    1047           foreach $entry (keys %ENTRIES) { if ($ENTRIES{$entry} > 1) { print STDERR "\tERROR: Duplicate ($ENTRIES{$entry}): $entry\n"; } } 
     1043          foreach $entry (keys %ENTRIES) { if ($ENTRIES{$entry} > 1) { print STDERR "\t+ ERROR: Duplicate ($ENTRIES{$entry}): $entry\n"; } } 
    10481044          nprint "\t" . keys(%ENTRIES) . " entries\n"; 
    10491045     } 
     
    10551051           if ($line !~ /^\"/)  { next; } 
    10561052           my @L=parse_csv($line); 
    1057            if ($L[4] !~ /(GET|POST|TRACE|TRACK|OPTIONS|SEARCH|INDEX)/i) { print STDERR "\tERROR: Possibly invalid method: $L[4] on ($line)\n"; } 
    1058            if ($L[5] eq "") { print STDERR "\tERROR: blank conditional: $line"; next; } 
    1059            if ($line !~ /^\".*\",\".*\",\".*\",\".*\",\".*\"/) { print STDERR "\tERROR: Invalid syntax ($#L): $line\n"; next; } 
    1060            if ($line !~ /^(\".*\",){11}\".*\"/) { print STDERR "\tERROR: Invalid syntax ($#L): $line\n"; next; } 
    1061            if (($L[3] =~ /^\@CGI/) && ($L[3] !~ /^\@CGIDIRS/)) { print STDERR "\tERROR: Possible \@CGIDIRS misspelling: $line"; } 
     1053           if ($L[4] !~ /(GET|POST|TRACE|TRACK|OPTIONS|SEARCH|INDEX)/i) { print STDERR "\t+ ERROR: Possibly invalid method: $L[4] on ($line)\n"; } 
     1054           if ($L[5] eq "") { print STDERR "\t+ ERROR: blank conditional: $line"; next; } 
     1055           if ($line !~ /^\".*\",\".*\",\".*\",\".*\",\".*\"/) { print STDERR "\t+ ERROR: Invalid syntax ($#L): $line\n"; next; } 
     1056           if ($line !~ /^(\".*\",){11}\".*\"/) { print STDERR "\t+ ERROR: Invalid syntax ($#L): $line\n"; next; } 
     1057           if (($L[3] =~ /^\@CGI/) && ($L[3] !~ /^\@CGIDIRS/)) { print STDERR "\t+ ERROR: Possible \@CGIDIRS misspelling: $line"; } 
    10621058           $ENTRIES{"$L[3],$L[4],$L[5],$L[6],$L[7],$L[8],$L[9],$L[10],$L[12]"}++; 
    10631059         } 
    10641060 
    1065        foreach $entry (keys %ENTRIES) { if ($ENTRIES{$entry} > 1) { print STDERR "\tERROR: Duplicate ($ENTRIES{$entry}): $entry\n"; } } 
     1061       foreach $entry (keys %ENTRIES) { if ($ENTRIES{$entry} > 1) { print STDERR "\t+ ERROR: Duplicate ($ENTRIES{$entry}): $entry\n"; } } 
    10661062       nprint "\t" . keys(%ENTRIES) . " entries\n"; 
    10671063     } 
     
    10721068         { 
    10731069           if ($line !~ /^\@/)  { next; } 
    1074            if ($line !~ /^\@.+\=.+$/i ) { print STDERR "\tERROR: Invalid syntax: $line\n"; } 
     1070           if ($line !~ /^\@.+\=.+$/i ) { print STDERR "\t+ ERROR: Invalid syntax: $line\n"; } 
    10751071           $ctr++; 
    10761072         } 
     
    10851081           chomp($line); 
    10861082           my @L=parse_csv($line); 
    1087            if ($#L ne 4) { print STDERR "\tERROR: Invalid syntax: $line\n"; } 
     1083           if ($#L ne 4) { print STDERR "\t+ ERROR: Invalid syntax: $line\n"; } 
    10881084           $ctr++; 
    10891085         } 
     
    16981694     if ($result{'whisker'}{'error'} =~ "Transport endpoint is not connected") 
    16991695     { 
    1700         nprint("ERROR: Could not connect to the defined proxy $NIKTOCONFIG{PROXYHOST}"); 
     1696        nprint("+ ERROR: Could not connect to the defined proxy $NIKTOCONFIG{PROXYHOST}"); 
    17011697        exit 1; 
    17021698     } 
     
    21652161   foreach my $FILE (sort @NIKTOFILES) 
    21662162   { 
    2167       open(FI,"<$NIKTOCONFIG{PLUGINDIR}/$FILE") || die print STDERR "- ERROR: Unable to open '$NIKTOCONFIG{PLUGINDIR}/$FILE': $!\n";;; 
     2163      open(FI,"<$NIKTOCONFIG{PLUGINDIR}/$FILE") || die print STDERR "+ ERROR: Unable to open '$NIKTOCONFIG{PLUGINDIR}/$FILE': $!\n";;; 
    21682164      my @F=<FI>; 
    21692165      close(FI); 
     
    22042200  
    22052201 # make sure the db_outdatedb isn't *too* old 
    2206  open(OD,"<$NIKTOCONFIG{PLUGINDIR}/db_outdated") || die print STDERR "- ERROR: Unable to open '$NIKTOCONFIG{PLUGINDIR}/db_outdated': $!\n";; 
     2202 open(OD,"<$NIKTOCONFIG{PLUGINDIR}/db_outdated") || die print STDERR "+ ERROR: Unable to open '$NIKTOCONFIG{PLUGINDIR}/db_outdated': $!\n";; 
    22072203 @F=<OD>; 
    22082204 close(OD); 
     
    22962292 if ($CONTENT !~ /SUCCESS/)  
    22972293  {  
    2298    print STDERR "- ERROR: ($RES, $CONTENT): Unable to send updated version string(s) to CIRT.net\n";  
     2294   print STDERR "+ ERROR: ($RES, $CONTENT): Unable to send updated version string(s) to CIRT.net\n";  
    22992295  } 
    23002296 else 
     
    23232319   unless (open(IN, "<$filename")) 
    23242320   { 
    2325       nprint("- ERROR: Unable to open database file $dbname: $!."); 
     2321      nprint("+ ERROR: Unable to open database file $dbname: $!."); 
    23262322      return $dbarray; 
    23272323   } 
  • trunk/plugins/nikto_dictionary_attack.plugin

    r152 r186  
    5454   unless (open(IN, "<$dictfile")) 
    5555   { 
    56       nprint("- ERROR: Unable to open dictionary file $dictfile: $!."); 
     56      nprint("+ ERROR: Unable to open dictionary file $dictfile: $!."); 
    5757   } 
    5858 
  • trunk/plugins/nikto_single.plugin

    r41 r186  
    142142 
    143143    my ($hostname, $ip) = resolve($request{'whisker'}{'host'}); 
    144     if ($ip eq "") { print STDERR "ERROR: could not resolve host name\n"; exit; } 
     144    if ($ip eq "") { print STDERR "+ ERROR: could not resolve host name\n"; exit; } 
    145145 
    146146#### do request 
  • trunk/plugins/nikto_tests.plugin

    r165 r186  
    6666            if (defined $result{whisker}->{error})  
    6767            { 
    68                nprint("- ERROR: $uri returned an error: $result{whisker}{error}\n");  
     68               nprint("+ ERROR: $uri returned an error: $result{whisker}{error}\n");  
    6969               next;  
    7070            } 
  • trunk/plugins/nikto_user_enum_apache.plugin

    r152 r186  
    151151   unless (open(IN, "<$filename")) 
    152152   { 
    153       nprint("- ERROR: Unable to open dictionary file $filename: $!."); 
     153      nprint("+ ERROR: Unable to open dictionary file $filename: $!."); 
    154154   } 
    155155 
Note: See TracChangeset for help on using the changeset viewer.