Giter Club home page Giter Club logo

linux_huawei_unlocker's Introduction

Huawei Modem Unlocker

Copyright (C) 2012 Neil McPhail
	<[email protected]>
Portions Copyright (C) 2010 dogbert
	<[email protected]>

*******************************************************************************
This utility is now deprecated

I cannot maintain this application and do not have the skills to convert it to
python3. Developers with an interest in this utility are encouraged to fork the
repository. I would be happy to pass on the baton of maintenance to anyone who
can demonstrate commitment to modernising the code.

Thank you for your interest in this software.
*******************************************************************************

Licence:
	GNU GPL version 2

Version:
	0.4

Requirements:
	Linux
	Python
	pySerial

Usage:
	./unlocker.py (as root if necessary)

Warranty:
	none!

Huawei wireless broadband modems are well supported in Linux. When bought from
a mobile carrier they are often locked to that carrier's network. This restricts
your freedom to choose your own supplier and SIM.

Unlocking these modems is simple but it has become the domain of malign and
unscrupulous members of the underground warez scene. This program aims to
simplify the process for Linux users.

Method:
	1. Insert the "foreign" SIM into your modem
	2. Insert the modem into a spare USB port. Do not attempt to connect.
	3. Run "./unlocker.py" (you may need to run this as root)
	4. Accept the warning by typing "YES"
	5. Confirm you wish to proceed with the unlocking procedure
		- there are only 10 attempts before the modem is locked for ever
	6. Let me know whether it was a success or failure!

Troubleshooting:
	Make sure python-2 and pySerial are installed
		(e.g. sudo apt-get install python-serial)

	The Windows "Dashboard" software is untouched. Some carrier-modified
	versions of this software prevent unlocked modems connecting to foreign
	networks. You may need to update the Dashboard software to an unbranded
	version. This is of no concern to Linux users and this software does
	not help with that process.

	Early reports suggest that some modems cannot be unlocked by this
	program. When I get hold of one of these devices I will work on it.

	E220 devices will not work. I don not think they will ever work with
	this script.

	Devices beginning "E3" are unlikely to work at this point. I hope to
	support these in a future version. If you have such a device and decide
	to try this script please give me feedback on the link below.

Bugs:
	Please raise issues at https://github.com/mcphail/linux_huawei_unlocker

linux_huawei_unlocker's People

Contributors

mcphail avatar mrtnmtth avatar schlomo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linux_huawei_unlocker's Issues

[Unlock failure] Huawei E3131

Linux distrubution = Ubuntu 12.04 LTS (32bit)
Python 2.7.3
pySerial 2.5
Modem Model = E3131
Country of purchase = Zambia
Original Carrier = MTN
Carrier of the SIM = Airtel (Zambia)
Error message = "The modem is hard locked, This program cannot help you."

It's a great program though!

E153

usb 5-4: new high speed USB device number 4 using ehci_hcd
usb 5-4: New USB device found, idVendor=12d1, idProduct=1446
usb 5-4: New USB device strings: Mfr=3, Product=2, SerialNumber=0
usb 5-4: Product: HUAWEI Mobile
usb 5-4: Manufacturer: HUAWEI Technology
scsi8 : usb-storage 5-4:1.0
scsi9 : usb-storage 5-4:1.1
scsi 8:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
scsi 9:0:0:0: Direct-Access HUAWEI MMC Storage 2.31 PQ: 0 ANSI: 2
sd 9:0:0:0: Attached scsi generic sg4 type 0
sr1: scsi-1 drive
sr 8:0:0:0: Attached scsi CD-ROM sr1
sr 8:0:0:0: Attached scsi generic sg5 type 5
sd 9:0:0:0: [sdd] Attached SCSI removable disk

$ sudo ./unlocker.py
[...]
Trying to find which port is the active modem connection.
Please be patient as this can take a while.

Could not identify active port.

Success with E173s

After catching the exception as described in #15 I could unlock the modem Huawei E173s (in Germany known also as "Web'n'Walk Stick basic IV").

Thanks for the unlocker!

unlock failure on Huawei E220

i had an extra Huawei modem around so thought I would try unlocking it for fun.

Ubuntu 12.06 64bit lts.

dpkg -l |grep pytohon-serial
ii python-serial 2.5-2.1build1 pyserial - module encapsulating access for

Huawei E220
CE 0682
Original modem Carrier: 3 (tre)
Simcard carrier: Tele2
Country of purchase :Sweden
error: just got the message failed to unlock.

Unlock successful: two E1750

Details:
Linux Mint 15
Python 2.7.4
pyserial-2.6

E1750
Romania
digi
Orange (RO) sim

just for fun :)
they shouldn't lock them.

Failure with Huawei K3520

I have tried linux_huawei_unlocker with Huawei K3520 modem and had no success.
The program test the ports /dev/ttyUSB2 /dev/ttyUSB1 and /dev/ttyUSB0 (these are automatically created when plugin the modem) and says that the three of them are inactive and then the program exits.
After this, I have successfully unlocked the modem with MobilePartner, connected to the network through the modem and I am actually sending this message through it. (Hence I cannot make further tests, sorry).
According to the HELPME file included in the software, I add the requested information:
- Your Linux distribution and version (e.g. Ubuntu 12.04)
Ubuntu Trusty
- Your version of Python and pySerial (if known)
python 2.7.5-5ubuntu3
python-serial 2.6-1build1
- The model of your modem
Huawei K3520
- The country of purchase of your modem
Spain
- The original carrier for your modem
Vodafone
- The carrier of the SIM you used in the unlock process
Simyo
- Any problems, failures or error messages
Ports /dev/ttyUSB2, ..1 and ...0 regarded as "inactive". The program then exits.
- Any suggestions for improvement.
I do not know, more verbose error messages???
I am affraid I cannot be of more help. Thanks anyway for making this software for the world.

Specify the port

In my K3765, unlocking was unsuccessfully at first, because it was trying all ports and one was raising an exception when reading ([Errno 32] Broken pipe). After specifying the port number here It worked. It would be good to be able to specify the device/port manually, but I'm mostly writing this so somebody that has the same problem can find it in google.

Unlock failed: E372

I've tried to unlock my COSMOTE (RO) Huawei E372 with an Orange (RO) sim.
Details:
Linux Mint 15
Python 2.7.4
pyserial-2.6
Huawei E372
Romania
Cosmote (RO)
Orange (RO) SIM

full output:
If you wish to proceed, please type YES at the prompt

YES
Trying to find which port is the active modem connection.
Please be patient as this can take a while.

Testing port /dev/ttyUSB2
Activity detected

Trying to obtain IMEI.
The modem will be given 5 seconds to respond.
Found probable IMEI: 35314xyzqwerty4 (obfuscated by me)
IMEI checksum OK.

Checking the lock status of the SIM.
The modem will be given 5 seconds to respond.

This SIM should be unlockable...
Remaining attempts: 10
Exceeding this will hard-lock the modem

Unlock code = 45822421
Please be aware that a failed unlocking attempt could break your modem.
This is a risky procedure.
If you wish to proceed, please type YES at the prompt

YES

Attempting to unlock...

Will check result in 5 seconds.

Checking the lock status of the SIM.
The modem will be given 5 seconds to respond.

Unlocking unsuccessful. Sorry.

Unlock with new algo

Seems that there are modems which require a different algorithm for the unlock code. While I don't know how to generate unlock codes for those modems I can help with modifying the script and using a generated unlock code to unlock the device:

  1. Get an unlock code at https://huaweiunlockcalculator.com/huawei-new-algo
  2. Edit unlocker.py
  3. At line 247 replace unlockCode = computeUnlockCode(imei) with unlockCode = "66611394" (replace the code with the code from the website above)
  4. Run the script.

This is how I managed to unlock my K3772 modem.

Unlock failed on Huawei B593s-516

It couldn't unlock the Huawei router. It would be nice to work with you on making the unlocker to work with this router. I'm also able to code if necessary to make it work.

Cannot get IMEI

Well.

I've hardcoded ttyUSB0 as modem device, tries to get IMEI but doesn't work.

Is trying code "AT+CGSN\r\n" but returns ERROR.
I tried to send manually the AT command "ATI\r\n" and returns IMEI along other info.

Manufacturer: huawei
Model: E1612
Revision: 11.806.02.03.18
IMEI: 352201030850216
+GCAP: +CGSM,+DS,+ES
                                                                                
OK   

So, once i've edited that it told me that dongle was previously unlocked. I used networkmanager to create new dialup with just name and APN and worked :D

Actual obtainImei() looks like


def obtainImei(port):
    print "\nTrying to obtain IMEI."
    print "The modem will be given 5 seconds to respond."
    ser = serial.Serial(port = port,
            timeout = 0)
    ser.flushInput()
    #ser.write('AT+CGSN\r\n')
    ser.write('ATI\r\n')
    time.sleep(5)
    response = ser.read(4096)
    ser.close()
    imei = re.findall('\d{15}', response)[0]
    if imei:
        print "Found probable IMEI: " + imei
        return imei
    else:
        print "IMEI not found"
        return ''

Error and Success with Huawei E156G

This modem reports fail when you unlock it, seems something with response parsing or whatever.
I ran script twice and that time worked out of the box.

Many thanks.

Bug: uncaught exception preventing correct probing of connected modems

The following lines were throwing an exception for me and because it went uncaught, the for cycle didn't loop further to probe other ttys which was effectively preventing to work for my modem. After catching the exception and skipping the rest of the iteration, the following iterations probed my modem correctly and the whole thing worked like a charm!

ser = serial.Serial(port = p,
timeout = 15)
ser.write('AT\r\n')
activity = ser.read(5)

(E173 u-1) Could not identify active port

Hi! I have Huawei E173 u-1 and it has refused to unlock.

Let my explain in brief:
I usualy use this modem by way of temporary unlocking because it's firmware is locked.
The software that I use to unlock it resides in my windows 7 os.
The software that I use on windows is called Huawei Modem Unlocker.exe.
Here is the link http://www.doncaprio.com/2012/11/how-to-flash-huawei-usb-modems-and-re-install-the-firmware.html.
When I unlock it, it will remain unlocked unless I unplug or shut down my pc
So I unlock it using windows 7 then I reboot and boot to ubuntu.
If I shut down my pc or unplug the modem it locks again.
So I unlock it in windows then reboot to ubuntu and it works fine.
Now the problem is that I cannot unlock it in ubuntu using linux_huawei_unlocker.

My system is
-Xbuntu 14.04.1 LTS
-Python 2.7.6
-Huawei E173 u-1
-Country: Kenya

  • Original modem carrier is safaricom
  • The carrier of the SIM you used in the unlock process: Orange Kenya
  • It looks for ports for some time and then fails to find the active port
  • Any suggestions: How about making a GUI like the one for Huawei Modem Unlocker.exe.

Thanks alot by the way

success with E1750

As requested here my success story:
Just used this successfully on an very old E1750 that was locked to austrian provider orange. (That doesn't exist anymore.)

Thanks a lot for your nice tool!

Unlock E220 Worked... but...

I got unlock code from '3'.

Your script generated a different code.

I changed your code to use number I got from '3'.

It said it worked. But I can not connect

Sucessfully unlocked E1750 (Viettel Vietnamese network)

Thank you so much for the project.

Just want to assure that your code works fine. It took me several hard hours try to figure out why #17 and #18 only solve half of my problem.

My E1750 (which I got about 10 years ago) is locked to one network provider. Running your code will spit out broken pipe trying to connect to ttyUSB1 and ttyUSB2.

I want to share my solution here. Hope it helps others. My guess is that some providers, like mine, will ask Huawei to immediately disconnect the device if not suitable sim card is detected.

==== THE WRONG WAY ====

  1. I plugged in another provider's sim card.
  2. Plug the usb in.
  3. Run usb_modeswitch.
    The computer will still "see" E1750 but there is no way your code will be able to write to the device. When I run

func@func:~$ dmesg | grep tty
[ 0.000000] console [tty0] enabled
[ 0.876305] 00:04: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 5.703661] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB0
[ 5.703754] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB1
[ 5.704306] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB2
[ 142.438319] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[ 157.432343] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[ 157.432434] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[ 158.020234] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB0
[ 158.088221] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB1
[ 158.108213] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB2
[ 162.516724] option1 ttyUSB0: usb_wwan_indat_callback: resubmit read urb failed. (-2)
[ 162.516729] option1 ttyUSB0: usb_wwan_indat_callback: resubmit read urb failed. (-2)
[ 162.516731] option1 ttyUSB0: usb_wwan_indat_callback: resubmit read urb failed. (-2)
[ 162.518285] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[ 162.576415] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[ 162.576528] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[ 167.220233] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB0
[ 167.304267] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB1
[ 167.348225] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB2
[ 167.373931] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[ 168.172328] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[ 168.172450] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[ 173.188233] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB0
[ 173.252218] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB1
[ 173.284209] usb 1-5: GSM modem (1-port) converter now attached to ttyUSB2
[ 186.516118] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0

You can clearly see that ttyUSB0 has been disconnected.. Sad!

==== THE CORRECT WAY ====

  1. First plug a valid sim card from the original provider to keep the device connected to your machine.
  2. Do all the usb_modeswitch and any other stuff you need to do to load your device.
  3. Execute the unlock script. Everything should be running as expected.

I am writing this comment to you using the unlocked E1750 dongle via the initially 'unsupported' sim card.
Kudo to you.

Error E1756

hi, when try : sudo ./unlocker.py

same with root account

If you wish to proceed, please type YES at the prompt

YES
Trying to find which port is the active modem connection.
Please be patient as this can take a while.

Testing port /dev/ttyUSB2

An error occurred when probing for active ports.
This may be because you need to run this program as root.

Failure in unlock Huawei E303: Could not identify active port

I am running on Ubuntu 13.04. I was trying to unlock my Huawei E303 dongle. I found this application by posting a question on How to unloack a USB Broadband Modem ? at askubuntu.com.

I tried to unlock using this application. But the result was Could not identify active port.

In my system python-serial was already installed. There was python2.7 installed. I followed all the steps in README.

This is good work done by you. Wish you all the best to improve this further !

Below is the terminal dialogue :

`dumindumahawela@dumindumahawela:~$ su
Password:
root@dumindumahawela:/home/dumindumahawela# cd /home/dumindumahawela/Downloads/linux_huawei_unlocker-0.3
root@dumindumahawela:/home/dumindumahawela/Downloads/linux_huawei_unlocker-0.3# ./unlocker.py


Huawei modem unlocker
By Neil McPhail and dogbert
This is Free Software as defined by the GNU GENERAL PUBLIC
LICENSE version 2

This software comes with NO WARRANTY
This software can damage your hardware
Use it at your own risk

Not all modems can be unlocked with this software.
Users have reported problems with the following devices:
    E220, E353
Attempting to unlock these devices with this software is not
recommended. I hope to fix this in a later release.

If you wish to proceed, please type YES at the prompt

YES
Trying to find which port is the active modem connection.
Please be patient as this can take a while.

Could not identify active port.
root@dumindumahawela:/home/dumindumahawela/Downloads/linux_huawei_unlocker-0.3#`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.