home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / SATAN11.ZIP / SATAN < prev    next >
Text File  |  1995-04-11  |  3KB  |  113 lines

  1. #!/usr/local/bin/perl5
  2. #
  3. # version 3, Tue Apr  4  8:58:13 1995, last mod by wietse
  4. #
  5.  
  6. $running_under_satan = 1;
  7.  
  8. require 'config/version.pl';
  9. require 'config/satan.cf';
  10. require 'perl/satan-data.pl';
  11. require 'perl/run-satan.pl';
  12. require 'perl/misc.pl';
  13. require 'perllib/getopts.pl';    # IRIX needs it at the end.
  14.  
  15. #
  16. # Defaults are taken from the config file. There are three ways to control
  17. # operation: from the command line, from the satan.cf file, and from the
  18. # HTML user interface. That's a bit much.
  19. #
  20. $opt_a = $attack_level;
  21. $opt_A = $proximity_descent;
  22. $opt_d = $satan_data;
  23. $opt_l = $max_proximity_level;
  24. $opt_o = $only_attack_these;
  25. $opt_O = $dont_attack_these;
  26. $opt_s = $attack_proximate_subnets;
  27. $opt_S = $status_file;
  28. $opt_t = 1;
  29. $opt_u = $untrusted_host;
  30. $opt_v = 0;
  31. $opt_z = $sub_zero_proximity;
  32.  
  33. #
  34. # Parse JCL.
  35. #
  36. $usage = "usage: $0 [options] [targets...]
  37.  
  38. Enters interactive mode when no target host is specified.
  39.  
  40. -a        attack level (0=light, 1=normal, 2=heavy, default $opt_a)
  41. -A        proximity descent (default $opt_A)
  42. -c list        change variables (list format: \"name=value; name=value; ...\")
  43. -d database    data directory (default $opt_d)
  44. -i        ignore existing results
  45. -l proximity    maximal proximity level (default $opt_l)
  46. -o list        scan only these (default '$opt_o')
  47. -O list        stay away from these (default '$opt_O')
  48. -s        expand primary hosts to subnets
  49. -S status_file    pathname with scanning status file (default $opt_S)
  50. -t level    timeout (0 = short, 1 = medium, 2 = long, default $opt_t)
  51. -u        running from an untrusted host (for rsh/nfs tests)
  52. -U        running from a trusted host (for rsh/nfs tests)
  53. -v        turn on debugging output
  54. -V        print version number
  55. -z        when attack level becomes negative, continue at level 0
  56. -Z        stop at attack level 0
  57. ";
  58.  
  59. &Getopts("a:A:c:d:e:il:o:O:sS:t:uUvVzZ") || die $usage;
  60.  
  61. if ($opt_V) {
  62.     print "SATAN version $satan_version\n";
  63.     exit 0;
  64. }
  65.  
  66. # The power of PERL never stops to amaze me - Wietse
  67. for (split(/\s*;\s*/, $opt_c)) {
  68.     ${$name} = $value if ($name, $value) = split(/\s*=\s*/, $_, 2);
  69. }
  70.  
  71. print "SATAN is starting up....\n" if $#ARGV < 0;
  72.  
  73. $debug = $opt_v;
  74.  
  75. @all_attacks = (\@light, \@normal, \@heavy);
  76. die "bad attack level: $opt_a\n" unless $all_attacks[$opt_a];
  77. $attack_level = $opt_a;
  78.  
  79. $satan_data = $opt_d;
  80.  
  81. $max_proximity_level = $opt_l;
  82. $proximity_descent = $opt_A;
  83. $sub_zero_proximity = $opt_z;
  84. $sub_zero_proximity = 0 if $opt_Z;
  85.  
  86. $only_attack_these = $opt_o;
  87. $dont_attack_these = $opt_O;
  88.  
  89. $attack_proximate_subnets = $opt_s;
  90. $status_file = $opt_S;
  91.  
  92. @all_timeouts = ($short_timeout, $med_timeout, $long_timeout);
  93. die "bad timeout: $opt_t\n" unless $all_timeouts[$opt_t];
  94. $timeout = $all_timeouts[$opt_t];
  95.  
  96. $untrusted_host = $opt_u;
  97. $untrusted_host = 0 if $opt_U;
  98.  
  99. umask 077;    # DON'T TAKE THIS OUT!!!
  100.  
  101. if ($#ARGV < 0) {
  102.     #
  103.     # The HTML driver will eventually invoke init_satan() and run_satan().
  104.     #
  105.     require 'perl/html.pl';
  106.     &html();
  107. } else {
  108.     &init_satan_data();
  109.     &read_satan_data() unless defined($opt_i);
  110.     &run_satan(join(' ', @ARGV));
  111. }
  112.  
  113.