Home > Linux, Mobile Tele-communication, Windows > Unlocking a Huawei 3G Modem, use it on multiple networks

Unlocking a Huawei 3G Modem, use it on multiple networks

Being able to use a locked Huawei 3G modem on another network involves two steps.

  1. Unlock the modem using Simbwa Phillip steps.
  2. Set the APN of the SIM Network whenever initializing the modem

Simbwa Phillip has some steps which I was able to follow to perfectly unlock my Huawei 3G modem.
I will just paste here the steps again so that you don’t have to bounce back and forth.

Unlock the modem using Simbwa Phillip steps

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 . If you choose to go the geeky way, you don’t need the pyhumod. Also if the easy way fails, go the geeky way

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


Set the APN of the SIM Network whenever initializing the modem

For linux if your using wvdial change the wvdial.conf or add the line below which sets the APN name

Init3 = AT+CGDCONT=1,"IP","TelecomNetworkAPNName"

For windows users, go to the device manager -> Modems -> Open properties of the modem -> Under Advanced -> in the extra initialization commands field put the entry

AT+CGDCONT=1,"IP","TelecomNetworkAPNName"

The TelecomNetworkAPNName varies from Telecom, for UTL it is utweb and for Orange it is orange.ug.
So now you can create a connection with a dial number *99# or *99***1#.

Advertisements
  1. sidric
    August 20, 2011 at 6:04 pm

    There is a simpler method for those who are not familiar with code.
    See http://www.sidric.blogspot.com
    If you have a different modem model apart from E160E, you must leave out updating the firmware but follow the other steps.

  2. Sina
    August 27, 2011 at 12:24 pm

    i have done that but still can’t get connected. what could be missing

  3. attie
    October 21, 2011 at 8:56 pm

    Hi! How would one unlock a huawei mobile broadband usb modem which has only ESN and S/n (no EMEI..) e.g huawei EC900. (details;Huawei Mobile Broadband. Model:EC900, CDMA2000 EV-DO REV.A USB MODEM, ESN:0953BB3EB, S/N:M2A9MB10C2600323)??

  4. EDWARD
    December 16, 2011 at 7:57 pm

    Hi! How would one unlock a huawei mobile broadband usb modem which has only ESN and S/n (no EMEI..) e.g huawei EC900. (details;Huawei Mobile Broadband. Model:EC900, CDMA2000 EV-DO REV.A USB MODEM, ESN:0953D449, S/N:M2A9MB10C2600245)??

  5. phiph
    July 10, 2012 at 1:30 pm

    please explain more on how to access the terminal

  6. July 21, 2012 at 2:47 am

    can someone help me unlock this pease??? Found modem : E1780
    Model : Huawei E1780
    IMEI : 352971030344242
    Serial NR. : I87NAD1071700261
    Firmware : 11.126.10.00.524
    Compile date / time : Jun 28 2010 13:50:58
    Hardware ver. : CD68TCPU
    Dashboard version : UTPS16.002.03.00.524_MAC16.001.09.02.524
    Chipset : Qualcomm MSM6290
    Voice feature : enabled
    SIM Lock status : Locked (Card Lock)
    Wrong codes entered : 10 (unlock attempts left : 0)

  7. bibin thomas
    December 11, 2012 at 2:23 pm

    i want to know the card unlock code for huawei e 1731 its imei no is 863791010336709 .please help me

  8. Joseph Ssenyange
    December 11, 2012 at 3:08 pm

    Based on the script above.
    Your Modem unlock code: 37235771

    • December 11, 2012 at 3:41 pm

      i doesnot work it need another one ,i mean with the help of dc unlocker

  9. December 11, 2012 at 4:20 pm

    Huawei E173 Unlock Code Calculator ? is there any available like that ?
    i saw such a thing here http://www.fastgsm.com/en/huawei/huawei/e173/unlock-code. sir please help
    http://modemhacking.blogspot.in/2012/07/unlock-211573100284-unlock-211571300910.html this site also give some details .please check and help me sir
    \

  10. December 14, 2012 at 2:07 pm

    @ Joseph Ssenyange .sir,is there any options left to me ? please help . i am waiting for your help and reply.

  11. Morris
    December 28, 2012 at 2:31 pm

    am having trouble with un locking my huawei E3131.

    • musonda
      August 3, 2015 at 9:13 pm

      i need help i want unlock code for huawei E3131

  12. Morris
    December 28, 2012 at 2:32 pm

    Morris :
    am having trouble with un locking my huawei E3131 can someone please help me.

  13. raghu
    September 3, 2013 at 5:44 pm

    please find the way for unlocking bsnl new huawei lw273 unlocking system

  14. sunil
    February 27, 2014 at 4:55 pm

    hi!!!!!!!!!!!!!!!
    model number:k3772 huwei vodafone modem
    imei 86102004508012
    pls send me unlock code…i used all 10 attempts…pls help me..

  15. August 4, 2014 at 9:42 pm

    Traceback (most recent call last):
    File “huawei_unlocker.py”, line 4, in
    import humod
    ImportError: No module named humod

  16. benja
    September 17, 2014 at 1:13 am

    hi can you show us a real time method…the later is hard for me as a beginner

  17. herbert
    March 14, 2015 at 9:32 pm

    i want to know the card unlock code for huawei EG162G its imei no is 354930030401780 .please help me

  18. musonda
    August 3, 2015 at 9:15 pm

    help me i need unlock code for huawei E3131

  19. vierualenix
    February 3, 2016 at 12:10 am

    help me i need unlock code for huawei E5577

  20. September 8, 2016 at 4:03 pm

    I want to know how to unlock my HUAWEI E5770?

  21. Howard whelan
    October 20, 2016 at 3:34 pm

    Hi Can you help please need unlock code for Huawei e5330 imei869470013570622

    any help would be great thanks

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: