Hi everyone,

Like i promised, i have finished the 1 click 3g modem unlock app with GUI. I
have called it 3G Flare..

Some could test run it on Linux or Mac OSX  and give me some feedback... I
haven't tested it thoroughly coz all the modems around me are now unlocked!

To run this little baby, please follow the instructions below:

1. 3G Flare requires the following python modules to be already installed
- pySerial (available here
<http://pypi.python.org/packages/source/p/pyserial/pyserial-2.5.tar.gz#md5=34340820710239bea2ceca7f43ef8cab>
)
- pyhumod (available here
)<http://pyhumod.googlecode.com/files/pyhumod-0.03.tar.gz>
- easygui (available
here<http://easygui.sourceforge.net/download/current_version/easygui_v0.95.zip>)

2. If you already have the above modules installed proceed with coping the
code below and saving it as flare.py

#!/usr/bin/env python

from easygui import *
import sys, os, hashlib, humod

UNLOCK_SALT = "5e8dd316726b0335"
USB_DEV = "/dev/ttyUSB"
USB_DEV_MAX = 5

# This class ensures that we don't kinda get choked by stderr issues
class NullDevice:
        def write(self,s):
                pass

def release_link(data):
        os.system("kill -15 `lsof "+data+" | awk \"{print$2}\"`")

def enum_usbdev():
        devs = []
        for i in xrange(USB_DEV_MAX):
                usbdev = USB_DEV+str(i)
                if os.path.exists(usbdev):
                        devs.append(usbdev)
        return devs

def show_code(imei,salt):
        digest = hashlib.md5((imei+salt).lower()).digest()
        code = 0
        for i in xrange(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

def unlock_modem():
        sys.stderr = NullDevice()
        serial_conn = enum_usbdev()
        data = serial_conn[0]
        ctrl = serial_conn[1]
        release_link(data)
        mod = humod.Modem(data,ctrl)
        imei = mod.show_imei()
        if os.system("cat "+data+" &"):
                return False
        if os.system("echo -e
'AT^CARDLOCK=\""+str(show_code(imei,UNLOCK_SALT))+"\"\\r' > "+data):
                return False
        release_link(data)
        return Trueif(__name__ == "__main__"):
        sys.stderr = NullDevice()
        while 1:
                msg = "Select Modem Operation"
                title = "::3G Flare Easy & Geeky Way:: Unlock your 3G Modem"
                actions = ['1. Unlock 3G Modem', '2. Load Airtime', '3.
Check Airtime balance','4. Terminate Flare']

                action = buttonbox(msg,title,actions)

                if(action == '1. Unlock 3G Modem'):
                        unlocked = unlock_modem()
                        if(unlocked):
                                msgbox("3G Modem unlocked. Fly on any
network my friend","3G Flare")
                        else:
                                msgbox("Unlocking failed","3G Flare")

                if(action == '2. Load Airtime'):
                        msgbox("Load Airtime module still under beta
testing.. Coming soon","3G Flare")

                if(action == '3. Check Airtime balance'):
                        msgbox("Check Airtime balance module under beta
testing.. Coming soon","3G Flare")
                if(action == '4. Terminate Flare'):
                        sys.exit(0)

# ------------------------- Code ends here
---------------------------------------------


3. The app needs to be run as root since  it tries to free data link of the
modem in case its being held by another program like wvdial
  Hence on your terminal start flare like so:

# python flare.py

4. Then the rest is self explanatory

Cheers,

::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