#!/usr/bin/perl # # Version 1.3 # Changelog: 1.3: added iwpriv wds command # 1.2: added in interface question # # Another in a long line of stupid scripts # ...This one to put your laptop in "AP" mode and bridge wireless to a # wired network. # # Coded by a poo flinging monkey in the bowels of the cybersniper research labs # printf "\n\n---------- bridgeap.pl - Bridge script ------------\n"; printf "\nCoded by pfm\@cybersniper research labs...\n\n"; printf "---------------------------------------------------"; printf "\nDestroying the Original ath0 interface\n"; system "wlanconfig ath0 destroy"; printf "\nCreating VAP on ath\n"; system "wlanconfig ath create wlandev wifi0 wlanmode ap"; system "iwconfig"; printf "\nWhich interface do you want to use: "; $int = ; chomp($int); printf "\nEnter the ESSID you want to create: "; $ap = ; chomp($ap); system "iwconfig $int essid $ap"; printf "\nEnter the channel the AP will operate on: "; $ch = ; chomp($ch); system "iwconfig $int channel $ch"; printf "\nDo you want WEP [ Y or N]: "; $wep = uc; chomp($wep); if ($wep eq "N") { printf "\nUnprotected? Okay, your funeral!\n"; } else { printf "\nEnter your WEP key: "; $key = ; chomp($key); system "iwconfig $int key $key"; } # Set WDS to enable address frames necessary for bridging system "iwpriv $int wds 1"; # Now we work on the interface system "ifconfig"; printf "\nWhat is your wired interface (eth0?): "; $wired = ; chomp($wired); #printf "\nDo you want access to your AP box [ Y or N ]: "; #$acc = uc; #chomp($acc); # if ($acc eq "N") { # printf "\nOkay, no IP access for you\n"; # } # else { # printf "\nEnter the IP address for the wireless side: "; # $wip = ; # chomp($wip); # system "ifconfig ath0 $wip"; # } printf "\nActivating your interfaces\n"; system "ifconfig $int up"; system "ifconfig $wired 0.0.0.0"; system "ifconfig $wired up"; printf "\nCreating the Bridge from Wireless to Wired\n"; printf "\nWhat IP address should the bridge use (wired side IP): "; $brip = ; chomp($brip); system "brctl addbr br0"; system "brctl addif br0 $wired"; system "brctl addif br0 $int"; system "ifconfig br0 $brip"; printf "\nThings should be working now...connect using the following parms:"; printf "\nESSID: $ap"; printf "\nChannel: $ch"; printf "\nWEP Key: $key\n"; printf "\nYou can connect to the AP using the br0 IP $brip\n"; exit 0;