break a time, with break the c0de…

Posts tagged “modem

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)

cara setting telkomflash di backtrack


yah biar penulis juga ga lupa suatu saat nanti maka ga ada salahnya juga ditulis di mari hehehe…
ok berikut adalah langkah langkahnya…

pertama buka konsole
lalu ketik : sudo kate /etc/wvdial.conf
lalu ganti semua dan overwrite dengan script di bawah .

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1, \"IP\", \"internet\"
Modem Type = USB Modem
ISDN = 0
New PPPD = yes
Phone = *99#
Modem = /dev/ttyUSB0
Username = PPP
Password = PPP
Baud = 3600000
Auto DNS = 1

ok setelah itu save atau simpan.

lalu check dengan ketik : cat /etc/wvdial.conf
lalu kita akan mendapat seperti ini…

root@bt:/etc# cat wvdial.conf
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1, \"IP\", \"internet\"
Modem Type = USB Modem
ISDN = 0
New PPPD = yes
Phone = *99#
Modem = /dev/ttyUSB0
Username = PPP
Password = PPP
Baud = 3600000
Auto DNS = 1

ok berarti sudah benar perlu di perhatikan lakukanlah semua yang di tutorial ini dengan root atau sudo

lalu saatnya kita sambungkan koneksi kita. dengan mengetik : wvdial &
perhatian : jangan lupa dengan tanda dengan (&) agar wvdial yang kita jalankan tadi berjalan di background agar jika kita menutup konsole si wvdial tidak ikut tertutup .

ok berikut setelah kita mengetik wvdial & di konsole.

root@bt:~# wvdial &
[1] 6024
WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1, "IP", "internet"
AT+CGDCONT=1, "IP", "internet"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
--> Carrier detected.  Waiting for prompt.
root@bt:~# --> Don't know what to do!  Starting pppd and hoping for the best.
--> Starting pppd at Thu Jun 24 13:08:50 2010
--> Pid of pppd: 6025
--> pppd: 0õÎ[08][08]øÎ[08]XøÎ[08]
--> Using interface ppp0
--> pppd: 0õÎ[08][08]øÎ[08]XøÎ[08]
--> pppd: 0õÎ[08][08]øÎ[08]XøÎ[08]
--> pppd: 0õÎ[08][08]øÎ[08]XøÎ[08]
--> pppd: 0õÎ[08][08]øÎ[08]XøÎ[08]
--> pppd: 0õÎ[08][08]øÎ[08]XøÎ[08]
--> pppd: 0õÎ[08][08]øÎ[08]XøÎ[08]
--> local  IP address 182.1.204.151
--> pppd: 0õÎ[08][08]øÎ[08]XøÎ[08]
--> remote IP address 10.64.64.64
--> pppd: 0õÎ[08][08]øÎ[08]XøÎ[08]
--> primary   DNS address 114.127.208.84
--> pppd: 0õÎ[08][08]øÎ[08]XøÎ[08]
--> secondary DNS address 202.3.208.11
--> pppd: 0õÎ[08][08]øÎ[08]XøÎ[08]
root@bt:~#

pada saat tersebut maka flash kita akan menyala . tidak berkedip – kedip lagi menandakan kita sudah terkoneksi ke internet .
ok di situ juga di jelaskan kita menggunakan koneksi modem (ppp0) dengan menggunakan ip 182.1.204.151 dan remote ipnya 10.64.64.64 . DNS utama : 114.127.208.84 dan DNS kedua : 202.3.208.11

ok anda bisa langsung menutup konsole anda dan buka browser . selamat berinternetan !