Results 1 to 3 of 3

Thread: backtrack4 working eepc wifi bash script

Hybrid View

  1. #1
    Just burned his ISO
    Join Date
    Apr 2009
    Posts
    2

    Default backtrack4 working eeepc wifi bash script

    i noticed alot of people complaining that the backtrack4 wifi manager didn't work for them on their atheros chipset eeepc's im using a 700 2g surf and i wrote this script which works for me. works if its currently in monitor mode or not. figured i should share it smile



    Code:
    #!/bin/bash
    echo "Lifi v.01 Apr 4,2009 -Rifken Technologies"
    echo "This version supports OPEN WEP WPA and WPA2-PSK Encrypted AccessPoints."
    echo -n "Press Any Key To Continue..."
    read continue
    echo "---------------------"
    echo "Bringing down the NIC"
    echo "---------------------"
    ifconfig ath0 down
    ifconfig wifi0 down
    echo "---------------"
    echo "Interfaces down"
    echo "---------------"
    echo "-"
    echo -n "Would you like to perform a random MAC spoof for your NIC? y/n: "
    read SPOOF
    if [ $SPOOF == "y" ]
    then
    	echo "Spoofing Mac Address for ath0:"
    	sleep 2
    	echo "------------------------------"
    	macchanger -r ath0
    	echo "------------------------------"
    	sleep 3
    	echo "-"
    	echo "Spoofing Mac address for wifi0:"
    	echo "-------------------------------"
    	macchanger -r wifi0
    	echo "-------------------------------"
    	sleep 2
    	echo "-"
    	echo "Mac Addresses have been spoofed"
    fi
    sleep 1
    ifconfig ath0 up
    ifconfig wifi0 up
    wlanconfig ath0 destroy
    ifconfig wifi0 down
    sleep 1
    wlanconfig ath0 create wlandev wifi0 wlanmode managed &
    sleep 1
    ifconfig ath0 up
    sleep 1
    ifconfig wifi0 up
    echo "-"
    echo "NIC has been brought up!"
    echo "-"
    echo "Scanning For Access Points"
    echo "--------------------------------------------------"
    sleep 4
    wlanconfig ath0 list ap
    sleep 6
    echo "--------------------------------------------------"
    echo -n "Choose ESSID: "
    read ESSID
    sleep 2
    echo "-"
    echo -n "Choose BSSID or type n: "
    read BSSID
    sleep 2
    echo "AP's Encryption: 'OPN' 'WEP' 'WPA'"
    echo -n "> "
    read ENC
    	if [ $ENC == "OPN" ]
    	then
    		if [ $BSSID != "n" ]	
    		then
    			echo "------------------------------------------------------------"
    			echo "Connecting to: OPEN AP '$ESSID' with MAC '$BSSID'"
    			echo "------------------------------------------------------------"
    			sleep 3
    			iwconfig ath0 essid '$ESSID' ap $BSSID
    		else
    			echo "------------------------------------------"
    			echo "Connecting to: OPEN AP '$ESSID'"
    			echo "------------------------------------------"
    			sleep 3
    			iwconfig ath0 essid '$ESSID'
    		fi
    	fi
    	if [ $ENC == "WEP" ]
    	then
    		echo -n "WEP KEY: "
    		read WEPKEY
    		if [ $BSSID != "n" ]
    		then
    			echo "---------------------------------------------------------------"
    			echo "Connecting to: WEP Encrypted AP '$ESSID' with MAC '$BSSID'"
    			echo "---------------------------------------------------------------"
    			sleep 3
    			iwconfig ath0 essid '$ESSID' ap $BSSID key $WEPKEY
    		else
    			echo "----------------------------------------"
    			echo "Connectiong to: WEP Encrypted AP '$ESSID'"
    			echo "----------------------------------------"
    			iwconfig ath0 essid '$ESSID' key $WEPKEY
    		fi
    	fi	
    	if [ $ENC == "WPA" ]
    	then
    		echo -n "WPA PASSPHRASE: "
    		read WPAPASS
    		if [ $BSSID != "n" ]
    		then
    			echo "-"
    			echo "Creating temp wpa_supplicant.conf with AP's Info"
    			L1="network={"
    			L2='ssid="'
    			L3="$ESSID"
    			L4='"'
    			L5="bssid=$BSSID"
    			L6='psk="'
    			L7="$WPAPASS"
    			L8='"'
    			L9="}"
    			rm -rf wpa_supplicant.conf
    			touch wpa_supplicant.conf
    			echo -e $L1 >> wpa_supplicant.conf
    			echo -e $L2$L3$L4 >> wpa_supplicant.conf
    			echo -e $L5 >> wpa_supplicant.conf
    			echo -e $L6$L7$L8 >> wpa_supplicant.conf
    			echo -e $L9 >> wpa_supplicant.conf
    			sleep 4
    			echo "-"
    			echo "File Created"
    			echo "-"
    			echo "-----------------------------------------------------------"
    			echo "Connecting to WPA Encrypted AP '$ESSID' with MAC '$BSSID'"
    			echo "-----------------------------------------------------------"
    			wpa_supplicant -i ath0 -c /mnt/sdb1/wpa_supplicant.conf -B
    		else
    			echo "-"
                            echo "Creating temp wpa_supplicant.conf with AP's Info"
                            L1="network={"
                            L2='ssid="'
                            L3="$ESSID"
                            L4='"'
                            L5='psk="'
                            L6="$WPAPASS"
                            L7='"'
                            L8="}"
                            rm -rf wpa_supplicant.conf
                            touch wpa_supplicant.conf
                            echo -e $L1 >> wpa_supplicant.conf
                            echo -e $L2$L3$L4 >> wpa_supplicant.conf
                            echo -e $L5$L6$L7 >> wpa_supplicant.conf
    			echo -e $L8 >> wpa_supplicant.conf
                            sleep 4
                            echo "-"
                            echo "File Created"
                            echo "-"			
    			echo "-----------------------------------------------------------"
    			echo "Connecting to WPA Encrypted AP '$ESSID'"
    			echo "-----------------------------------------------------------"
                            wpa_supplicant -i ath0 -c /mnt/sdb1/wpa_supplicant.conf -B
    		fi
    	fi
    dhclient ath0
    echo "Successfully Connected To $ESSID"
    exit

    takes your interfaces down. asks if you want to perform a random mac spoof, then gets your interfaces back up with the spoofed macs or without if unnecessary. scans for access points and i tested it and it worked with OPEN,WEP,WPA,WPA2-PSK.




    may have to modify directories depending on your setup. my backtrack4 is liveboot from usb drive so thats why my directories are used as so: /mnt/sdb1/

  2. #2
    ImageverificationSucks
    Guest

    Default

    I can't get this to work on my EeePC 901GO. Copied the code into a .sh file, changed the paths as described and get the following output:

    Code:
    root@bt:~/Desktop# sh cnct.sh
    Lifi v.01 Apr 4,2009 -Rifken Technologies
    This version supports OPEN WEP WPA and WPA2-PSK Encrypted AccessPoints.
    Press Any Key To Continue...
    : bad variable name
    ---------------------
    Bringing down the NIC
    ---------------------
    : Unknown host
    ifconfig: `--help' gives usage information.
    : Unknown host
    ifconfig: `--help' gives usage information.
    ---------------
    Interfaces down
    ---------------
    -
    yould you like to perform a random MAC spoof for your NIC? y/n:
    : bad variable name
    cnct.sh: 98: Syntax error: "fi" unexpected (expecting "then")
    root@bt:~/Desktop#
    any1 can tell me what went wrong?
    Greetings

  3. #3
    Senior Member
    Join Date
    Jan 2010
    Posts
    126

    Default

    thank you for sharing this. i was also having some trouble with the eeepc onboard card and was just using my alfa instead. obviously not a major problem, but this is just tidier. thanks alot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •