Ignore:
Timestamp:
02/28/2010 12:27:58 PM (3 years ago)
Author:
deity
Message:

Merged passfiles plugins into nikto_tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/nikto_tests.plugin

    r300 r333  
    3838sub nikto_tests 
    3939{ 
    40    my ($mark) = @_; 
     40   my ($mark, $parameters) = @_; 
    4141 
    4242   # this is the actual the looped code for all the checks 
     
    172172   } # end check loop 
    173173    
     174   # Perform mutation tests 
     175   if ($parameters->{'passfiles'}) { 
     176      passchecks($mark); 
     177   } 
     178    
    174179   return; 
    175180} 
    176181 
     182sub passchecks { 
     183   my ($mark) = @_; 
     184   my @DIRS   = (split(/ /, $VARIABLES{"\@PASSWORDDIRS"})); 
     185   my @PFILES = (split(/ /, $VARIABLES{"\@PASSWORDFILES"})); 
     186   my @EXTS = qw(asp bak dat data dbc dbf exe htm html htx ini lst txt xml php php3 phtml); 
     187    
     188   nprint("- Performing passfiles mutation", "v"); 
     189 
     190   foreach my $dir (@DIRS) 
     191   { 
     192      foreach my $file (@PFILES) 
     193      { 
     194         next if ($file eq ""); 
     195 
     196         # dir/file 
     197         testfile($mark, "$dir$file", "passfiles", "299998"); 
     198 
     199         foreach my $ext (@EXTS) { 
     200            # dir/file.ext 
     201            testfile($mark, "$dir$file.$ext", "passfiles", "299998"); 
     202 
     203            foreach my $cgi (@CGIDIRS) 
     204            { 
     205               # dir/file.ext 
     206               testfile($mark, "$cgi$dir$file.$ext", "passfiles", "299998"); 
     207 
     208               # dir/file 
     209               testfile($mark, "$cgi$dir$file", "passfiles", "299998"); 
     210            } 
     211         } 
     212      } 
     213   } 
     214} 
     215 
     216sub testfile { 
     217   my ($mark, $uri, $name, $tid) = @_; 
     218   my ($result, $contents, $error) = nfetch( $mark, "$uri", "GET",  "", "", "", "Tests: $name"); 
     219   nprint("- $result for $uri","v"); 
     220   if ($error)  
     221   { 
     222      nprint("+ ERROR: $uri returned an error: $error");  
     223      return;  
     224   } 
     225   if ($result == 200) { 
     226      add_vulnerability( $mark, "$uri: file found during $name mutation", "$tid", "0", "GET"); 
     227   } 
     228} 
     229    
     230    
     231 
    1772321; 
Note: See TracChangeset for help on using the changeset viewer.