break a time, with break the c0de…

Posts tagged “object

Huawei modem unlock calculator


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 !

#!/usr/bin/python
# -*- coding: utf-8 -*-
#   This library is free software; you can redistribute it and/or
#   modify it under the terms of the GNU Lesser General Public
#   License as published by the Free Software Foundation; either
#   version 2.1 of the License, or (at your option) any later version.
#
#   This library is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   Lesser General Public License for more details.
#
#   You should have received a copy of the GNU Lesser General Public
#   License along with this library; if not, write to the
#      Free Software Foundation, Inc.,
#      59 Temple Place, Suite 330,
#      Boston, MA  02111-1307  USA
#
#   Copyright 2010 Gunslinger_ <yudha.gunslinger@gmail.com>
#   http://bit.ly/c0debreaker

import hashlib, string

__author__	= "Gunslinger_ <yudha.gunslinger@gmail.com>"
__date__ 	= "Tue, 14 Jun 2011 23:22:42 +0700"
__version__ 	= "1.0"
__copyright__ 	= "Copyright (c) 2010 Gunslinger_"

class huawei_modem_unlocker(object):
	"""
	Instance variables:

	Imei
		Imei of the modem will be calculated
		Default : '0'

	Verbose
		Display how algorithm working
		Default : False

	"""
	def __init__(self, imei='0', verbose=False):
		''' Huawei modem unlocker class constructor '''
		self._imei 		= imei
		self._verbose		= verbose
		self._md5u 		= hashlib.md5(str(imei)+str('5e8dd316726b0335')).hexdigest()
		self._md5f 		= hashlib.md5(str(imei)+str('97b7bc6be525ab44')).hexdigest()
		self._unlock_code 	= ''
		self._flash_code 	= ''
		# verbose formating
		self._width		= 21
		self._w			= 10
		self._header_format 	= '%-*s%*s'
		self._format       	= '   %d  | %-*s | %*s  '

	def xor_digits(self, source, counter):
		''' Get a value and xoring it during looping iteration '''
		digits = int('0x0'+source[0+counter:2+counter],16)	^ \
			 int('0x0'+source[8+counter:8+2+counter],16)	^ \
			 int('0x0'+source[16+counter:16+2+counter],16) 	^ \
			 int('0x0'+source[24+counter:24+2+counter],16)
		return digits

	def calc(self):
		''' Process calculate with the algorithm (read source code) '''
		cnt = 0
		cnt2 = 1
		if self._verbose:
			print "="*(self._width+13)
			print " Iter."+"|"+ " Unlock byte "+"|"+" Flash byte "
			print "-"*(self._width+13)
		while cnt < 8:
			digits_unlock 	= self.xor_digits(self._md5u, cnt)
			digits_flash 	= self.xor_digits(self._md5f, cnt)
			unlock_byte 	= string.zfill(hex(digits_unlock)[2:],2)
			flash_byte	= string.zfill(hex(digits_flash)[2:],2)
			self._unlock_code = str(self._unlock_code)+str(unlock_byte)
			self._flash_code  = str(self._flash_code)+str(flash_byte)
			if self._verbose: print self._format % (int(cnt2), self._width - self._w, self._unlock_code , self._w, self._flash_code)
			cnt  +=2
			cnt2 +=1
		if self._verbose:
			print "="*(self._width+13)
			print "\nUNLOCK CODE = %d & %d | %d = %d" % (int('0x0'+self._unlock_code,16), 33554431, 33554432, eval("int('0x0'+self._unlock_code,16) & 33554431 | 33554432"))
			print "FLASH CODE  = %d & %d | %d = %d\n" % (int('0x0'+self._flash_code,16), 33554431, 33554432, eval("int('0x0'+self._flash_code,16) & 33554431 | 33554432"))
		self._unlock_code 	= int('0x0'+self._unlock_code,16) & 33554431 | 33554432
		self._flash_code 	= int('0x0'+self._flash_code,16) & 33554431 | 33554432
		return (self._unlock_code, self._flash_code)

	def run(self):
		''' Fire it up ! '''
		self.calc()
		return (self._unlock_code, self._flash_code)

if __name__ == '__main__':
	print "\nHuawei modem unlock code calculator v.%s by %s \n" % (__version__, __author__)
	inpimei = raw_input("Please input modem IMEI : ")
	cracker = huawei_modem_unlocker(inpimei)
	a, b 	= cracker.run()
	print "\n-> IMEI		= %s" % (inpimei)
	print "-> UNLOCK CODE	= %s" % (a)
	print "-> FLASH CODE	= %s" % (b)
Advertisements

python programming ebook


Here i have python programming books
i hope you can enjoy !

Get cash from your website. Sign up as affiliate.

Apress Beginning Python From Novice To Professional
Click Here To Download

Beginning Game Development With Python And Pygame
Click Here To Download

Beginning Python From Novice To Professional
Click Here To Download

Beginning Python Apress
Click Here To Download

Beginning Python From Novice To Professional Second Editiontqw darksiderg
Click Here To Download

Beginning Python W-r-o-x
Click Here To Download

Beginning Python
Click Here To Download

Computer Programming Python Programming Language Tutorial
Click Here To Download

Core Python Programming.
Click Here To Download

Distributing Python Modules
Click Here To Download

Foundations Of Agile Python Development
Click Here To Download

Game1 Programming With Python Lua And Rubye Book
Click Here To Download

Game Programming With Python Lua and Ruby 2
Click Here To Download

How To Think Like A Computer Scientist With Python
Click Here To Download

John Wiley And Sons Making Use of Python e-Book
Click Here To Download

Learning Python
Click Here To Download

Learning Python 3rd
Click Here To Download

Lessa Python Developers Handbook Sams
Click Here To Download

LM15 Python
Click Here To Download

Python How To Program
Click Here To Download

Python 21 Bible
Click Here To Download

Python Cookbook
Click Here To Download

Python Essential Reference 2nd Edition
Click Here To Download

Python Library Reference
Click Here To Download

Python Scripting For Computational Science
Click Here To Download

Python XML
Click Here To Download

Python For Unix And Linux System Administration
Click Here To Download

Python Developers Handbook Sams
Click Here To Download

Python 2 1 Bible
Click Here To Download

python notes
Click Here To Download

Rapid GUI Programming with Python and QtOct
Click Here To Download

Rapid Python Web Application Development
Click Here To Download

Springer Python Scripting For Computational Science 3rd Edition
Click Here To Download

Thinking in Python Bruce Eckel Rev
Click Here To Download

webpython The Definitive Guide To Plone
Click Here To Download

Get cash from your website. Sign up as affiliate.