Any time i’ve been using modem (i use huawei e169) for my internet connections. because i like the flexibility and realibility for use on my notebook. but 2 days ago, i was late to pay the bill and my connection was disconnected. i read the bill, and the bill was so high than other provider. i want to move to other provider, but i can’t. because the modem was locked by provider and only can using the sim card from the provider. yes i hear there is any way to unlock the modem, but i must pay at the service. because of that i’m doing some research and looking for the unlock code algorithm used by huawei modem. and i got it and did it in my program. now i can freely use any sim card on my modem. here it is, the source code contains the algorithm or you can use by direct or import it to your own program ;) . hope you enjoy !
<code>
</code>
sumber : http://gunslingerc0de.wordpress.com
<code>
001#!/usr/bin/python
002# -*- coding: utf-8 -*-
003# This library is free software; you can redistribute it and/or
004# modify it under the terms of the GNU Lesser General Public
005# License as published by the Free Software Foundation; either
006# version 2.1 of the License, or (at your option) any later version.
007#
008# This library is distributed in the hope that it will be useful,
009# but WITHOUT ANY WARRANTY; without even the implied warranty of
010# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011# Lesser General Public License for more details.
012#
013# You should have received a copy of the GNU Lesser General Public
014# License along with this library; if not, write to the
015# Free Software Foundation, Inc.,
016# 59 Temple Place, Suite 330,
017# Boston, MA 02111-1307 USA
018#
019# Copyright 2010 Gunslinger_ <yudha.gunslinger@gmail.com>
021
022importhashlib, string
023
024__author__="Gunslinger_ <yudha.gunslinger@gmail.com>"
025__date__="Tue, 14 Jun 2011 23:22:42 +0700"
026__version__="1.0"
027__copyright__="Copyright (c) 2010 Gunslinger_"
028
029classhuawei_modem_unlocker(object):
030"""
031Instance variables:
032
033Imei
034Imei of the modem will be calculated
035Default : '0'
036
037Verbose
038Display how algorithm working
039Default : False
040
041"""
042def__init__(self, imei='0', verbose=False):
043''' Huawei modem unlocker class constructor '''
044self._imei=imei
045self._verbose=verbose
046self._md5u=hashlib.md5(str(imei)+str('5e8dd316726b0335')).hexdigest()
047self._md5f=hashlib.md5(str(imei)+str('97b7bc6be525ab44')).hexdigest()
048self._unlock_code=''
049self._flash_code=''
050# verbose formating
051self._width=21
052self._w=10
053self._header_format='%-*s%*s'
054self._format=' %d | %-*s | %*s '
055
056defxor_digits(self, source, counter):
057''' Get a value and xoring it during looping iteration '''
058digits=int('0x0'+source[0+counter:2+counter],16) ^ \
059int('0x0'+source[8+counter:8+2+counter],16) ^ \
060int('0x0'+source[16+counter:16+2+counter],16) ^ \
061int('0x0'+source[24+counter:24+2+counter],16)
062returndigits
063
064defcalc(self):
065''' Process calculate with the algorithm (read source code) '''
066cnt=0
067cnt2=1
068ifself._verbose:
069"="*(self._width+13)
070" Iter."+"|"+" Unlock byte "+"|"+" Flash byte "
071"-"*(self._width+13)
072whilecnt <8:
073digits_unlock=self.xor_digits(self._md5u, cnt)
074digits_flash=self.xor_digits(self._md5f, cnt)
075unlock_byte=string.zfill(hex(digits_unlock)[2:],2)
076flash_byte=string.zfill(hex(digits_flash)[2:],2)
077self._unlock_code=str(self._unlock_code)+str(unlock_byte)
078self._flash_code=str(self._flash_code)+str(flash_byte)
079ifself._verbose:self._format%(int(cnt2),self._width-self._w,self._unlock_code ,self._w,self._flash_code)
080cnt+=2
081cnt2+=1
082ifself._verbose:
083"="*(self._width+13)
084"\nUNLOCK CODE = %d & %d | %d = %d"%(int('0x0'+self._unlock_code,16),33554431,33554432,eval("int('0x0'+self._unlock_code,16) & 33554431 | 33554432"))
085"FLASH CODE = %d & %d | %d = %d\n"%(int('0x0'+self._flash_code,16),33554431,33554432,eval("int('0x0'+self._flash_code,16) & 33554431 | 33554432"))
086self._unlock_code=int('0x0'+self._unlock_code,16) &33554431|33554432
087self._flash_code=int('0x0'+self._flash_code,16) &33554431|33554432
088return(self._unlock_code,self._flash_code)
089
090defrun(self):
091''' Fire it up ! '''
092self.calc()
093return(self._unlock_code,self._flash_code)
094
095if__name__=='__main__':
096"\nHuawei modem unlock code calculator v.%s by %s \n"%(__version__, __author__)
097inpimei=raw_input("Please input modem IMEI : ")
098cracker=huawei_modem_unlocker(inpimei)
099a, b=cracker.run()
100"\n-> IMEI = %s"%(inpimei)
101"-> UNLOCK CODE = %s"%(a)
102"-> FLASH CODE = %s"%(b)
</code>
sumber : http://gunslingerc0de.wordpress.com
