Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: WPA - Connect Script

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    31

    Default WPA - Connect Script

    can you include the script from the newbiews area?

    #!/usr/bin/bash

    iwconfig eth0 mode managed essid "linksys"
    printf "* - Configured interface\n"
    ifconfig eth0 up
    printf "* - Interface up\n"
    wpa_supplicant -B -Dwext -ieth0 -c/etc/wpa_supplicant.conf
    printf "* - wpa_supplicant running, sleeping for 5...\n"
    sleep 5
    printf "* - Running dhcpcd\n"
    dhcpcd eth0
    ifconfig eth0 | grep inet

    something like that so it make it easy to connect to WPA networks instead of having to go thru all that please

  2. #2
    My life is this forum thorin's Avatar
    Join Date
    Jan 2010
    Posts
    2,629

    Default

    Why not just make the script you need for your system and create a custom ISO with MySLAX creator which adds it with the rootcopy functionality?

    They can't really include the script because they don't know the details of your network (ie: essid, which interface to bring up, etc etc.....)

  3. #3
    Member
    Join Date
    Jan 2006
    Posts
    66

    Default

    I whipped up a new version of that script, and if anybody wants to help beta test it please feel free. Just save it to a fresh document and make it executable (chmod +x SCRIPT_NAME).

    Code:
    #!/usr/bin/bash
    
    #wpa_connect script by Hobz of #remote-exploit
    #Currently in beta, needs testing
    #April 2, 2007
    
    INT=$1
    ESSID=$2
    
    if [ -z "$2" ]; then
     printf "Usage: $0 [interface] [ESSID]\n"
     printf "$0 will create a /etc/wpa_supplicant.conf file if none exists"
     printf "Default driver: wext\n"
     exit
    fi
    
    function connect {
     ifconfig $INT down
     iwconfig $INT mode managed essid "$ESSID"
     printf "* - Configured interface\n"
     ifconfig $INT up
     printf "* - Interface up\n"
     wpa_supplicant -B -Dwext -i$INT -c/etc/wpa_supplicant.conf
     printf "* - wpa_supplicant running, sleeping for 10...\n"
     sleep 10
     printf "* - Running dhcpcd\n"
     dhcpcd $INT
     ifconfig $INT | grep inet
    }
    
    function conf_create {
     printf "What is your passphrase?\n"
     read "PASSPHRASE"
     printf "* - running wpa_passphrase\n"
     wpa_passphrase "$ESSID" "$PASSPHRASE" > /etc/wpa_supplicant.conf
    printf "* - done.  Starting to connect...\n"
    }
    
    if [ -f /etc/wpa_supplicant.conf ]; then
     connect
    else
     conf_create
     connect
    fi
    ---
    Useful HowTo Threads <-- Why do people think I'm joking when I link this?

  4. #4
    Just burned his ISO
    Join Date
    Mar 2007
    Posts
    12

    Default

    tested it and approved it :-)

    works like a charm

  5. #5
    Just burned his ISO
    Join Date
    Jan 2010
    Posts
    20

    Default

    thanks alot

  6. #6
    Junior Member
    Join Date
    Mar 2007
    Posts
    76

    Default

    works perfect here also. Thanks

  7. #7
    Just burned his ISO
    Join Date
    Aug 2006
    Posts
    2

    Question

    BT ~ # chmd +x wpa.sh

    BT ~ # ./wpa.sh

    Error:
    -bash: ./wpa.sh: /usr/bin/bash^M: bad interpreter: No such file or directory


  8. #8
    Member
    Join Date
    Jan 2006
    Posts
    66

    Default

    Quote Originally Posted by DHCP-Tom
    Error:
    -bash: ./wpa.sh: /usr/bin/bash^M: bad interpreter: No such file or directory
    I'm not sure where that's coming from. Try copying the script over again. Or, you can test out the new version for me.

    Code:
    #!/usr/bin/bash
    
    #wpa_connect script for BT2 by Hobz of #remote-exploit
    #April 2, 2007
    #
    #
    #CHANGE LOG
    #
    #Modified April 22 by Hobz
    #added pingcheck function using ping -f flag
    ###
    
    INT=$1
    ESSID=$2
    
    if [ $1 = "P" ]; then
     pingcheck
     exit
    fi
    
    if [ -z "$2" ]; then
     printf "Usage: $0 [interface] [ESSID] <P>\n"
     printf "$0 will create a /etc/wpa_supplicant.conf file if none exists\n"
     printf "Default driver: wext\n"
     printf "Optional: use 'P' to check signal, one dot '.' = one dropped packet\n"
     printf "More dots means worse signal."
     exit
    fi
    
    function connect {
     ifconfig $INT down
     iwconfig $INT mode managed essid "$ESSID"
     printf "* - Configured interface\n"
     ifconfig $INT up
     printf "* - Interface up\n"
     wpa_supplicant -B -Dwext -i$INT -c/etc/wpa_supplicant.conf
     printf "* - wpa_supplicant running, sleeping for 10...\n"
     sleep 10
     printf "* - Running dhcpcd\n"
     dhcpcd $INT
     ifconfig $INT | grep inet
    }
    
    function conf_create {
     printf "What is your passphrase?\n"
     read "PASSPHRASE"
     printf "* - running wpa_passphrase\n"
     wpa_passphrase "$ESSID" "$PASSPHRASE" > /etc/wpa_supplicant.conf
     printf "* - done.  Starting to connect...\n"
    }
    
    function pingcheck {
     echo "Enter host to ping, or press Enter to use default gateway: "
     read "HOST"
     if [ -z "$HOST" ]; then
      route | grep "default" | awk '{ system("ping -w 10 -f " $2) }'
     else 
      ping -w 10 -f $HOST
     fi
    }
    
    if [ -f /etc/wpa_supplicant.conf ]; then 
     connect
      if [ "$3" = "P" ]; then
       pingcheck
      fi
    else
     conf_create
     connect
      if [ "$3" = "P" ]; then
       pingcheck
      fi
    fi
    ---
    Useful HowTo Threads <-- Why do people think I'm joking when I link this?

  9. #9
    Junior Member
    Join Date
    Jan 2010
    Posts
    79

    Default

    I think that happens when you use certain Windows editors to paste and save from. In any case, check out this link http://www.freebsddiary.org/control-m.php
    Quote Originally Posted by DHCP-Tom View Post
    BT ~ # chmd +x wpa.sh

    BT ~ # ./wpa.sh

    Error:
    -bash: ./wpa.sh: /usr/bin/bash^M: bad interpreter: No such file or directory


  10. #10
    Just burned his ISO
    Join Date
    Aug 2006
    Posts
    2

    Talking

    Thank You !!

Page 1 of 2 12 LastLast

Posting Permissions

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