之前用wvs_console进行批量扫描生成了大量html报告,下面写了一个perl脚本来帅选出有高危漏洞的站点。

   
   
   
   
  1.  #!/usr/bin/perl -w 
  2.  
  3. use strict; 
  4. use warnings; 
  5. use Cwd; 
  6. use File::Copy; 
  7.  
  8. my $dir = getcwd(); 
  9. my $dstdir = "/lab/report/xss/"
  10. my $count = 0; 
  11. opendir(D,$dir) or die "Cannot open dir: $!"
  12. my @lists = readdir(D); 
  13. foreach my $list(@lists){ 
  14.         count($list); 
  15. closedir(D); 
  16.  
  17. sub count 
  18. my($file, $site, $content) = @_; 
  19. if ($file =~ /.*@\d+-\d+-\d+_(.*)\.html/) { 
  20.         $site = $1;  
  21.     }    
  22. open(F, $file) or die "Cannot open report file: $!"
  23. while () { 
  24.         chomp; 
  25.     $content = $_;  
  26.         if ($content =~ /.*High<\/td>"3" rowspan="4" class="s21">(\d+)<\/td>/) { 
  27.                 if ($1 > 0) { 
  28.                 #       print $file."\n".$dstdir.$file."\n"
  29.                         copy($dir."/".$file, $dstdir.$file) or die "Copy failed: $!"
  30.                 print $site ." Found ". $1." alert(s)\n"
  31.                 last
  32.                 } 
  33.     } 
  34. close(F);