Ignore:
Timestamp:
01/28/2010 10:24:53 AM (3 years ago)
Author:
deity
Message:

Tidy of formatting and simplification of is_404

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/nikto_core.plugin

    r290 r291  
    2121# Nikto core functionality 
    2222############################################################################### 
    23 sub change_variables 
    24 { 
     23sub change_variables { 
    2524   # $line is the unfiltered variable 
    2625   my $line=$_[0]; 
     
    3332   $line =~ s/JUNK\(([0-9]+)\)/LW2::utils_randstr($1)/e; 
    3433 
    35    if ($line !~ "\@") 
    36    { 
     34   if ($line !~ "\@") { 
    3735      push(@subtests, $line); 
    3836   } 
    39    else 
    40    { 
    41       foreach my $varname (keys %VARIABLES) 
    42       { 
    43          if ($line =~ "$varname") 
    44          { 
     37   else { 
     38      foreach my $varname (keys %VARIABLES) { 
     39         if ($line =~ "$varname") { 
    4540            # We've found the variable; now to expand it! 
    46             foreach my $value (split(/ /, $VARIABLES{$varname})) 
    47             { 
     41            foreach my $value (split(/ /, $VARIABLES{$varname})) { 
    4842               $cooked = $line; 
    4943               $cooked =~ s/$varname/$value/g; 
     
    5852 
    5953############################################################################### 
    60 sub is_404 
    61 { 
    62  my ($uri, $content, $rescode) = @_; 
    63  $ext=get_ext($uri); 
    64  
    65  if   (($FoF{$ext}{mode} eq "STD") && (($rescode eq 401) || ($rescode eq 403) || ($rescode eq 404) || ($rescode eq 410))) { return 1; } 
    66  elsif ($FoF{$ext}{mode} eq "STD")  { return 0; } 
    67  elsif ($FoF{$ext}{mode} eq "REDIR")  
    68   {  
    69    if ($result{location} eq $FoF{$ext}{location}) { return 1; } 
    70   } 
    71  elsif (($FoF{$ext}{type} eq "CONTENT")  && ($content =~ /$FoF{$ext}{match}/i))    { return 1; }  
    72  elsif (($FoF{$ext}{type} eq "BLANK") && ($content eq ""))                         { return 1; }  
    73  elsif ($FoF{$ext}{type} eq "HASH") 
    74    { 
    75      my $content=rm_active_content($content, $uri); 
    76      if (LW2::md4($content) eq $FoF{$ext}{match}) { return 1; }  
    77    } 
    78 return 0; 
     54sub is_404 { 
     55   my ($uri, $content, $rescode) = @_; 
     56   $ext=get_ext($uri); 
     57   my $pagenf=0; 
     58 
     59   if (($FoF{$ext}{mode} eq "STD") && 
     60       ($rescode =~ /4[0-9][0-9]/)) { 
     61      $pagenf=1; 
     62   } 
     63   elsif ($FoF{$ext}{mode} eq "REDIR") {  
     64      if ($result{location} eq $FoF{$ext}{location}) { 
     65         $pagenf=1; 
     66      } 
     67   } 
     68   elsif (($FoF{$ext}{type} eq "CONTENT") && 
     69          ($content =~ /$FoF{$ext}{match}/i)) { 
     70      $pagenf=1; 
     71   }  
     72   elsif (($FoF{$ext}{type} eq "BLANK") && 
     73          ($content eq "")) { 
     74      $pagenf=1; 
     75   }  
     76   elsif ($FoF{$ext}{type} eq "HASH") { 
     77      my $content=rm_active_content($content, $uri); 
     78      if (LW2::md4($content) eq $FoF{$ext}{match}) { 
     79         $pagenf=1; 
     80      }  
     81   } 
     82 
     83   return $pagenf; 
    7984} 
    8085############################################################################### 
Note: See TracChangeset for help on using the changeset viewer.