LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-19-2014, 06:41 PM   #1
nix84
Member
 
Registered: Apr 2014
Posts: 276

Rep: Reputation: Disabled
WEP script fails but seems to accept setup


Using the following script to test accessibility:
Code:
#!/bin/bash
#####################################################################
# wifiConek.sh
# Enter network name and key
# This is a script only for root
##########################################################R###########
# Failed
function usage() {
    echo -e "\n\tUsage: `basename $0` \"<essid>\" <key>" \
            "\n\t       Enter <ascii prefaces>\n"
    die
}

# Kill
function die() {
    echo -e "\n\t       `basename $0` ERROR: $1 <*>\n"
    exit 1
}

# Setup
# Get ESSID
if [[ $1 ]]
then echo -e "\n\t>>>Starting by dropping wlan0"
     ifconfig wlan0 down               # Drop wlan0
     sleep 3
     dhclient -r wlan0 -q              # Drop previous connections
     echo -e "\n\t>>>Dropped previous connection(s)"
     ifconfig wlan0 up                 # Activate wlan0
     echo -e "\n\t>>>wlan0 activated"

     echo -e "\n\tESSID set to $1"
     iwconfig wlan0 essid "$1"         # Set wlan0 to connect to $1

# Assign Key
     if [[ $2 ]]
     then echo -e "\n\tKey set to $2"
          iwconfig wlan0 key s:"$2"    # If exists, set wlan0 use key
     fi

# Connect
     echo -e "\n\t>>>Set wlan0 to Managed\n"
     iwconfig wlan0 mode Managed       # Set wlan0 for managed network
     echo -e "\n\t>>>Requesting network IP address\n"
     dhclient wlan0                    # Get IP address
# Success
     if [[ $? -eq 0 ]]
     then echo -e "\n\n\t>>>Connected to $1!"
          exit 0
     else die ">>>Failed to connect to $1"  # Failure
     fi
else usage                             # No variables
fi
The code seems to connect thru ">>>Connected to" but the iwconfig argues NO.
bash-4.1# iwconfig wlan0
wlan0 IEEE 802.11g ESSIDff/any Nickname:"poolside"
Mode:Managed Frequency:2.457 GHz Access Point: Not-Associated
Bit Rate:6.5 Mb/s Tx-Power:20 dBm Sensitivity=0/3
RTS thrff Fragment thrff
Encryption key:4861-7170-7943-6172-5069-7A7A-61 Security mode:restricted
Power Managementff
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

Since I know the AP I was trying to connect with is WPA2 and this script seems to be more for WEP, why did it get thru to >>>Connected to" as tho it was accepting the setup?
Thanx for taking the time to address this!!
bash-4.1$
 
Old 04-21-2014, 03:49 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,954

Rep: Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434
I'd point out that we'd need to know what your network device is. They never bothered to write code for the Broadcom B43 module, as it was no longer regarded as secure and put code there for WPA* instead. I don't know how many other wifi cards that is true of, but I have experience with B43.
 
Old 04-22-2014, 03:58 AM   #3
nix84
Member
 
Registered: Apr 2014
Posts: 276

Original Poster
Rep: Reputation: Disabled
It is a USB wireless adapter from EDUP EP-N8508
 
Old 04-23-2014, 02:26 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,954

Rep: Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434
Can you check if the driver does WEP. Open in the package docs. I had a check for the name on the best source http://wireless.kernel.org but I diidn't find mantion of that model.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
setup squid3 to accept all cookies cccc Linux - Networking 2 02-20-2009 07:06 AM
WEP wireless connection fails from suse 11.0 but fine from windows & iphone VelocideX Linux - Networking 2 01-28-2009 10:56 AM
Pump Fails with WEP jonwatson Linux - Wireless Networking 6 07-18-2005 01:23 PM
Linksys WUSB11 WEP setup aclaunch Linux - Wireless Networking 5 12-23-2003 02:50 PM
WEP 128 key - how to setup? pr1sg Linux - Wireless Networking 2 07-17-2003 07:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration