Am providing two ways of unlocking your 3G modem (first-- the easyway,
second, the geeky way).
Prerequisites:
a). Python 2.6  or greater
b). For the easyway (huawei modems), download and install pyhumod 0.03 from
here* * <http://pyhumod.googlecode.com/files/pyhumod-0.03.tar.gz>. If you
choose to go the geeky way, you don't need the pyhumod. Also if the easy way
fails, go the geeky way


   1. *The easy way (Huawei modem:*


   - Paste the following code in your preferred editor (i use vim ) and save
   it as whatever name you choose (i use huawei_unlocker.py)


#!/usr/bin/env python

import hashlib
import humod
UNLOCK_SALT = "5e8dd316726b0335"

def show_code(imei, salt):
    digest = hashlib.md5((imei+salt).lower()).digest()
    code = 0
    for i in range(0,4):
        code +=
(ord(digest[i])^ord(digest[4+i])^ord(digest[8+i])^ord(digest[12+i])) <<
(3-i)*8
        code &= 0x1ffffff
        code |= 0x2000000
    return code

mod = humod.Modem()
imei = mod.show_imei()
status =
humod.at_commands.Command(mod,'AT^CARDLOCK="'+str(show_code(imei,UNLOCK_SALT))+'"\r')

#------------------- code ends here -----------------------------


   - After save the file and quit your editor
   - Check that you have plugged in your modem and has been detected by
   system. ("dmesg | tail" could help. Check that you have ttyUSB0, ttyUSBx
   where x could be 1 or 2)
   - Execute the python script on commandline like so:

python huawei_unlocker.py

   - Thats it!

 2). The geeky way

   - Plug in your modem
   - Check that its has been read by the system
   - Then at your terminal type:

# cat /dev/ttyUSB0 &

   - We then extract the IMEI serial of the modem like so:

# echo -e "ATI\r" > /dev/ttyUSB0

   - Make note of the IMEI serial
   - In your favorite editor paste the following code and save it as
   unlock.py

 #!/usr/bin/env python

import hashlib
UNLOCK_SALT = "5e8dd316726b0335"

def show_codes(imei, salt):
    digest = hashlib.md5((imei+salt).lower()).digest()
    code = 0
    for i in range(0,4):
        code +=
(ord(digest[i])^ord(digest[4+i])^ord(digest[8+i])^ord(digest[12+i])) <<
(3-i)*8
        code &= 0x1ffffff
        code |= 0x2000000
    return code

# PLEASE TYPE YOUR IMEI  BELOW
imei = ' '
if(imei == ' '):
    print 'Please open this script from your editor and enter your IMEI'
else:
    print "Your Modem unlock code: %s" % show_codes(imei,UNLOCK_SALT);


   - Execute the above script to generate your modem unlock code
   - Now its time to unlock the modem and we do it like so:

# echo -e 'AT^CARDLOCK="XXXXXXXX"\r' > /dev/ttyUSB0
(Please use your generated modem unlock code in place of XXXXXXXX)


   - You should see the modem reply with an OK
   - Press CTRL + C
   - A reboot may be necessary if you are using openSuSE 11.3 like me and
   bingo (Fly on any network!)

Thats it my friends ...

Incase you get any issues, please post and i will see how to help.

::Phillip::
_______________________________________________
LUG mailing list
[email protected]
http://kym.net/mailman/listinfo/lug

LUG is generously hosted by INFOCOM http://www.infocom.co.ug/

All Archives can be found at http://www.mail-archive.com/[email protected]/

The above comments and data are owned by whoever posted them (including 
attachments if any). The List's Host is not responsible for them in any way.
---------------------------------------

Reply via email to