#VERSION,1.01 #LASTMOD,12.30.2002 # mutated file checks # This software is distributed under the terms of the GPL, which should have been received # with a copy of this software in the "LICENSE.txt" file. sub nikto_mutate { if ($NIKTO{mutate} !~ /1/) { return; } my $mctr=0; my ($c, %DIRS, %FS) = ""; # build a hash of all the unique directories foreach $c (@CGIDIRS) { $DIRS{$c}=""; } foreach my $cn (keys %FILES) { my $dir=LW::utils_get_dir($FILES{$cn}); my $file=$FILES{$cn}; my $rdir=$dir; $rdir=~s/([^a-zA-Z0-9])/\\$1/g; $file =~ s/$rdir//; $DIRS{$dir}="" unless $dir eq ""; $FS{$file}="" unless $file eq ""; } # add anything from the config file my @t=split(/ /,$CONFIG{MUTATEDIRS}); foreach $c (@t) { $DIRS{$c}=""; } @t=split(/ /,$CONFIG{MUTATEFILES}); foreach $c (@t) { $FS{$c}=""; } # add the directory/file combos to the request hashes foreach my $root (keys %DIRS) { foreach my $file (keys %FS) { # skip self referencing stuff if (($root !~ /[^\.\/]/) && ($file !~ /[^\.\/]/)) { next; } # args with no file if (($root eq "/") && ($file =~ /^\?/)) { next; } if (($root eq "") && ($file =~ /^\?/)) { next; } $mctr++; $ITEMCOUNT++; $FILES{$ITEMCOUNT}="$SERVER{root}$root$file"; $INFOS{$ITEMCOUNT}="URL created via mutate option."; $RESPS{$ITEMCOUNT}=200; $METHD{$ITEMCOUNT}="GET"; } } vprint("- $mctr mutate checks loaded\n"); return; } 1;