LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices



Reply
 
Search this Thread
Old 05-10-2009, 02:47 AM   #1
jelezarov
LQ Newbie
 
Registered: Nov 2007
Location: /dev/urandom
Distribution: Slackware
Posts: 25

Rep: Reputation: 17
ASCII to HEX offline generator for WEP connection


Hi,
i'm a happy Slackware 12.2 user on a HP-Mini 2140 netbook. All works just fine including the wireless connection. The only problem is, when traveling, how can i connect to WEP enabled AP with knowing just the passphrase. With WPA i just enter the passphrase in wicd-client (using wpa_supplicant) and i'm connected. I found a couple of online ascii to hex generators (like http://www.powerdog.com/wepkey.cgi) for different WEP encryptions (64,128 etc), but i cannot use it offline.
Is there a possibility with a script, or a program to convert the passphrase to HEX?
for example the phrase "my_wireless" in 64 bit key is 6620AF017C according to that site, and that's exactly what the router wanted.

Thanks in advance!
 
Old 05-11-2009, 12:36 PM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,791
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
If you're using wicd, you can enter a WEP passphrase in the same place you would enter a WEP hex key. You just have to use the drop-down to tell wicd it is the passphrase. Along similar lines, if you use iwconfig to set the configuration, you would just use the s: prefix like this:

iwconfig wlan0 key s:WEPPassphrase


So in other words, you never need an ascii to hex converter.
 
Old 05-13-2009, 05:48 AM   #3
jelezarov
LQ Newbie
 
Registered: Nov 2007
Location: /dev/urandom
Distribution: Slackware
Posts: 25

Original Poster
Rep: Reputation: 17
re: iwconfig <iface> s:passphrase

Thanks for the reply.
Of course i tried that already. The problem is - wicd can't connect, the report from iwconfig is "Error for wireless request "Set Encode" (8B2A)". I searched Google and that appears as common problem. As i understood there is something to do with the length of the passphrase and the used encryption (64 or 128 bit).
And from "man iwconfig" comes little bit frustrating:
"You can also enter the key as an ASCII string by using the s: prefix. Passphrase is currently not supported."
Is it not the same ascii string and a latin passphrase? Anyway it doesn't work.
Any help appreciated.
 
Old 05-13-2009, 08:44 AM   #4
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,791
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
Quote:
Is it not the same ascii string and a latin passphrase?
I always thought so, and I've successfully connected to access points using a latin "passphrase". I'll have to do some digging and see if I can find something that suggests there is a difference between and ascii string and a passphrase for WEP.


In the meantime, check out the xxd command, which is part of Slackware, as it will convert an ascii file to a hex file. It is a little weird (and I haven't been able to get it to accept input from a command line) but it might do the trick for you.
 
Old 05-14-2009, 02:57 PM   #5
jelezarov
LQ Newbie
 
Registered: Nov 2007
Location: /dev/urandom
Distribution: Slackware
Posts: 25

Original Poster
Rep: Reputation: 17
solved

I have read something about that in the linuxquestions.org forums for programmers, and i thing maybe WEP uses a different algorithm. I tried with xxd:
Code:
$ echo my_wireless | xxd
$ 0000000: 6d79 5f77 6972 656c 6573 730a            my_wireless.
which gives exactly hex output, but unfortunately not the expected result (with 64 bit encryption is 6620AF017C, and with 128 bit is 72AA25CD43364D09986BF0B5B9).

Anyway i found a temporary solution - the site http://tv.latinsud.com/wepconv.html - that's all JavaScript and easy to use it offline. The fields "passphrase (prng) -> Hex 64" and "passphrase (md5) -> Hex 128" are the solution for passphrase to HEX for WEP conversion at least for my router. I will try to test that with some other routers.

I thing it would be very nice if someone can translate that JavaScript to C, so that this can be compiled and (maybe?) integrated in some wireless-client program like wicd.

EDIT:
Accidentally i found in the google cache for one german site a link which contains the C code and a Makefile for a program, named lwepgen which does exactly what i wanted.
Here it is: http://dslinux.gits.kiev.ua/tags/ucl...d-ons/lwepgen/
It works just fine, at least for me.

EDIT (08.02.11):
Recently i needed the lwepgen and it seems that this is not working corect anymore - i supose because of the changed openssl libraries during the system updates. The new and best working solution is this litle script based on openwrt wiki. This can be placed somewhere in $PATH and invoked with parameter the string that need to be converted:

Code:
#!/bin/bash
echo -n "$1 (64-bit) : "
echo -n $1 | hexdump -e '5/1 "%02x" "\n"'
echo -n "$1 (128-bit): "
echo -n $1 | hexdump -e '13/1 "%02x" "\n"'

Last edited by jelezarov; 02-08-2011 at 06:39 AM. Reason: simple bash script
 
  


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
[bash] ASCII to HEX and hex to ascii ////// Programming 15 03-20-2014 02:23 PM
Hex output of a hex/ascii input string mlewis Programming 35 04-10-2008 01:05 PM
hex to ascii and ascii to hex ilnli Programming 7 08-31-2007 12:55 PM
display in hex + perl + non ASCII characters kshkid Programming 4 02-06-2007 05:48 PM
Binary to Hex Ascii converter carboncopy Slackware 1 05-28-2004 10:09 AM


All times are GMT -5. The time now is 01:08 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration