Results 1 to 10 of 23

Thread: Connecting to WEP, and WPA/WPA2 networks for n00bs.

Hybrid View

  1. #1
    Member imported_vvpalin's Avatar
    Join Date
    Apr 2009
    Posts
    442

    Default Connecting to WEP, and WPA/WPA2 networks for n00bs.

    This is the second script ive ever written and ive only been on linux for about a week so please no bashing the code as this was completed as a learning experience. I have added support for WEP as my other script only worked on WPA/WPA2.

    All credit goes to ptrakk without his post on connecting to wpa's i wouldn't have known how to make this.

    To run this stop any scanning, then save the code to a text file and name it connect.sh, place it on the desktop, open bash and do "cd Desktop" watch out for the D , then type "sh connect.sh" and follow the directions. When your all finished run dhclient wlan0 "or whatever your interface is" to set up dhcp.

    This WILL work on BT4 and your ALFA card as thats what im using.

    UPDATED:You can now connect to WPA/WPA2's that have a space in them. Just type the ssid "Like This" ... Also its is sensitive to Upper/lower case so make sure you get it correct.



    #start
    rm wpa.conf
    rm wep.conf
    killall NetworkManager
    killall knetworkmanager
    killall wpa_supplicant
    killall dhclient
    clear
    echo "Enter the interface name (eth1, wlan0, rausb0, etc)"
    read IFACE
    clear
    echo "it takes a little bit"
    airmon-ng stop wlan0
    airmon-ng stop mon0
    clear
    echo "dont worry its not frozen it just takes a moment"
    echo "about 30 seconds so be patient"
    echo "and dont hit enter"
    ifconfig $IFACE up
    wait 20
    clear
    echo "Is this WEP?"
    echo "Type yes or no"
    read YN
    clear

    if [ "$YN" != "no" ]
    then
    echo "Enter the WEP's SSID!"
    read SSIDWEP
    clear
    echo 'network={ \n ssid="'$SSIDWEP'" \n key_mgmt=NONE \n wep_key0="fakeauth" \n }' > wep.conf
    wpa_supplicant -c wep.conf -i $IFACE -Dwext -B
    echo "Enter the WEP key!"
    read WEPKEY
    iwconfig $IFACE key $WEPKEY
    clear
    echo "Now just dhclient your interface or write iptabels"
    fi

    if [ "$YN" != "yes" ]
    then
    echo "Enter the WPA/WPA2's SSID!"
    read SSIDWPA
    clear
    echo "Enter the WPA/WPA2 key!"
    read WPAKEY
    clear
    F=">"
    echo wpa_passphrase $SSIDWPA $WPAKEY $F wpa.conf > wpas.sh
    echo iwconfig $IFACE essid $SSIDWPA > iw.sh
    clear
    sh wpas.sh
    sh iw.sh
    rm wpas.sh
    rm iw.sh
    clear
    wpa_supplicant -B -Dwext -i $IFACE -c wpa.conf
    clear
    echo "Now just dhclient your interface or write iptabels"
    fi
    #end
    Comment if you like / use it and i might make some other nifty tools. Also if someone could tell me why i needed to reverse the " if [ "$YN" != "no" ] " part im all ears.
    Using backtrack for the first time is like being 10 years old again with the keys to a Ferrari.

  2. #2
    Just burned his ISO
    Join Date
    Nov 2007
    Posts
    22

    Default

    I just tried this script on BT3 final using the Alfa AWUS036H card. The script itself works fine for the most part, I am trying it currently on a WPA2-PSK access point of mine.

    The issue seems to be when your outputting to wpa.conf with a access point that has a space in its SSID, even when I put the AP in quotes. Try running the command for example "wpa_passphrase "blah blah" testingkey", that will output the psk key.

    Although if you give your script for WPA "blah blah" (including quotes when entered), the output wpa.conf file just says "Passphrase must be 8..63 characters".

    Cheers mate nice work just small issue.

  3. #3
    Member imported_vvpalin's Avatar
    Join Date
    Apr 2009
    Posts
    442

    Default

    Quote Originally Posted by PostalService View Post
    I just tried this script on BT3 final using the Alfa AWUS036H card. The script itself works fine for the most part, I am trying it currently on a WPA2-PSK access point of mine.

    The issue seems to be when your outputting to wpa.conf with a access point that has a space in its SSID, even when I put the AP in quotes. Try running the command for example "wpa_passphrase "blah blah" testingkey", that will output the psk key.

    Although if you give your script for WPA "blah blah" (including quotes when entered), the output wpa.conf file just says "Passphrase must be 8..63 characters".

    Cheers mate nice work just small issue.
    I feel pretty darn good rite now! I found 3 different ways to get it to work, in the end tho this was the best i think.

    any other issues let me know

    cheers
    Using backtrack for the first time is like being 10 years old again with the keys to a Ferrari.

  4. #4
    Just burned his ISO
    Join Date
    Apr 2009
    Posts
    3

    Default Help pls

    I tried connecting to my wireless router with your script but unsucessfully . I am running the live cd directly. I also have tried with the NerworkManager but it didnt connect aswell.
    I copied the text from your post saved it as connect.sh on the desktop and here is the shell log . Btw i am noob



    eth0 Link encap:Ethernet HWaddr 00:1e:68:68:50:df
    BROADCAST MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
    Interrupt:18

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    wlan0 Link encap:Ethernet HWaddr 00:16:44:ce:b9:8f
    BROADCAST MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    wmaster0 Link encap:UNSPEC HWaddr 00-16-44-CE-B9-8F-00-00-00-00-00-00-00-00-00-00
    BROADCAST MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    root@bt:~# cd Desktop
    root@bt:~/Desktop# sh connect.sh
    rm: cannot remove `wpa.conf\r': No such file or directory
    rm: cannot remove `wep.conf\r': No such file or directory
    : no process killed
    : no process killed
    : no process killed
    : no process killed
    : not found 8: clear
    Enter the interface name (eth1, wlan0, rausb0, etc)
    wlan0
    : bad variable name
    : not found 11: clear
    it takes a little bit


    Interface Chipset Driver

    wlan0 RTL8187 rtl8187 - [phy0]



    Interface Chipset Driver

    wlan0 RTL8187 rtl8187 - [phy0]

    : not found 15: clear
    dont worry its not frozen it just takes a moment
    about 30 seconds so be patient
    and dont hit enter
    up: error fetching interface information: Device not found
    : not found 19:
    : not found 21: clear
    Is this WEP?
    Type yes or no
    yes
    : bad variable name
    : not found 25: clear
    : not found 26:
    connect.sh: 62: Syntax error: end of file unexpected (expecting "then")
    root@bt:~/Desktop#

  5. #5
    My life is this forum Barry's Avatar
    Join Date
    Jan 2010
    Posts
    3,817

    Default

    Not trying to bash the new guys, but how many "how to connect with wireless" how-to's do we really need?
    Of course, if you really wanted to have some fun, go to Wal-Mart late at night and ask the greeter if they could help you find trashbags, roll of carpet, rope, quicklime, clorox and a shovel. See if they give you any strange looks. --Streaker69

  6. #6
    Super Moderator Archangel-Amael's Avatar
    Join Date
    Jan 2010
    Location
    Somewhere
    Posts
    8,012

    Default

    Quote Originally Posted by Barry View Post
    Not trying to bash the new guys, but how many "how to connect with wireless" how-to's do we really need?
    One less than the number of "how-to install bt on a usb stick"
    To be successful here you should read all of the following.
    ForumRules
    ForumFAQ
    If you are new to Back|Track
    Back|Track Wiki
    Failure to do so will probably get your threads deleted or worse.

  7. #7
    Member imported_vvpalin's Avatar
    Join Date
    Apr 2009
    Posts
    442

    Default

    Quote Originally Posted by Barry View Post
    Not trying to bash the new guys, but how many "how to connect with wireless" how-to's do we really need?
    Searching here is a little biased for stuff that is posted recently, I also couldn't find anything else about how to connect in bt4 other than ptrakk's guide and his doesnt seem to work for WPA2's.

    This is just meant to be a quick and dirty way to get a n00b online without having to learn what wpa_suplicant is and does. Knowing from experience it can be incredibly frustrating not being able to get something to work the rite way especially when its something so basic like connecting to the net.

    @ fasa im not sure but it seems your problem is here ": bad variable name" did you make sure you copied everything correctly? I just checked the code and it all seems to work fine on my end. If it still doesn't work you might want to try inputting the commands yourself and see if you can get it working.
    Using backtrack for the first time is like being 10 years old again with the keys to a Ferrari.

Posting Permissions

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