break a time, with break the c0de…

Posts tagged “matrix

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)

matrix.py [matrix in python]


do you know matrix movie ?

here i make some code about matrix in python ..
here you go !

#!/usr/bin/python
# -*- coding: utf-8 -*-
# gunslinger_ 08 feb 2010
# this code is protected under the gpl
# get your copy at <http://www.gnu.org/licenses/>

import os, time, random, sys

class message(str):
    def __new__(cls, text, speed):
        self = super(message, cls).__new__(cls, text)
        self.speed = speed
        self.y = -1*len(text)
        self.x = random.randint(0, display().width)
        self.skip = 0
        return self

    def move(self):
        if self.speed > self.skip:
            self.skip += 1
        else:
            self.skip = 0
            self.y += 1

class display(list):
    def __init__(self):
        self.height, self.width = [int(x) for x in os.popen('stty size', 'r').read().split()]
        self[:] = [' ' for y in xrange(self.height) for x in xrange(self.width)]

    def set_vertical(self, x, y, string):
        string = string[::-1]
        if x < 0:
            x = 80 + x
        if x >= self.width:
            x = self.width-1
        if y < 0:
            string = string[abs(y):]
            y = 0
        if y + len(string) > self.height:
            string = string[0:self.height - y]
        if y >= self.height:
            return
        start = y*self.width+x
        length = self.width*(y+len(string))
        step = self.width

        self[start:length:step] = string

    def __str__(self):
        return ''.join(self)

i_message = raw_input("Input a message: ")
messages = [message(i_message, random.randint(1, 5))]
for t in xrange(1000000):
    messages.append(message(i_message[::-1], random.randint(1, 5)))
    d = display()
    for text in messages:
        d.set_vertical(text.x, text.y, text)
        text.move()
    sys.stdout.write(str(d))
    sys.stdout.flush()
    del d
    time.sleep(0.1)

Belajar Membuat Website dengan Adobe Dreamweaver

for best view, you must install konsole in your system :
to get it just type : sudo apt-get install konsole

and here example


matrix pascal


Iseng bermain2 dgn program matrix pascal lama…

 program matriks;
uses crt;
var
 elemen : array [1..5,1..6] of byte;
 x,y : byte;
begin
 clrscr;
 elemen [1,1] :=5;
 elemen [1,2] :=3;
 elemen [1,3] :=6;
 elemen [2,1] :=7;
 elemen [2,2] :=1;
 elemen [2,3] :=8;
 elemen [3,1] :=9;
 elemen [3,2] :=5;
 elemen [3,3] :=7;
 for x :=1 to 3 do;
 begin
 for y :=1 to 3 do;
 begin
 write (elemen [x,y]);
 end;
 writeln;
end;
end.