Skip to content

Instantly share code, notes, and snippets.

@bldewolf
Last active August 29, 2015 14:00
Show Gist options
  • Save bldewolf/11069648 to your computer and use it in GitHub Desktop.
Save bldewolf/11069648 to your computer and use it in GitHub Desktop.
State table exploder
#!/usr/bin/perl
#
# Tired of your firewall working? Want to have new connections mysteriously
# rejected? Look no further! Use this handy script to flood your iptables
# nf_conntrack table with useless entries!
#
# Originally used to verify nf_conntrack_max settings. Empirically determined
# that 1 million states ~= 500MB.
use warnings;
use strict;
use IO::Socket::INET;
my $port = 1024;
my $addr = 1;
while(1) {
my $socket = new IO::Socket::INET (LocalHost => "127.0.0.$addr",
LocalPort => $port,
PeerHost => "127.0.0.$addr",
PeerPort => $port,
Proto => "udp");
$socket->send("hi\n");
$socket->send("hi\n");
$port++;
if($port > 65000) {
$addr++;
$port = 1024;
}
if($addr > 254) {
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment