break a time, with break the c0de…

Posts tagged “library

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)

PyProxy | Proxy Hunter and Tester, A high-level cross-protocol proxy-hunter python library


This idea is taken after doing any research with some socket. and finally, i need some proxy for it’s research .
so i’m going to make something to parse proxy in every site and has a proxy checker ability
and i need to use / import that dinamically for the research, so i must play with the object too .

This article will introduce a python library has done by me
the name is PyProxy .
PyProxy is a Proxy Hunter and Tester, A high-level cross-protocol proxy-hunter python library
This is can be use by direct or you can import this to your program

for direct use , you just need to execute this library . you will see the help module along with the library
by adding -h or –help in first argument

PyProxy v.09 by Gunslinger_ <yudha.gunslinger@gmail.com> - Proxy Hunter and Tester Opensource engine
A high-level cross-protocol proxy-hunter

Usage: pyproxy.py [options]

Options:
  -h, --help            show this help message and exit
  -s, --samair          just use samair.ru to hunt proxies
  -l, --sitelist        use all site in the list
  -t, --test            test all proxy !
  -a, --all             do all !
  -v, --version         print current proxy hunter version
  -d, --debug           debug program for more talkable & every proxy will be
                        print to screen
  -o FILE, --outputfile=FILE
                        output proxy will be print
                        [default : proxylist.txt]
  -i FILE, --inputfile=FILE
                        input proxy will be checked
                        [default : proxylist.txt]
  -g FILE, --outputgood=FILE
                        output all good proxy will be saved
                        [default : goodproxy.txt]
  -c NUMBER, --timeout=NUMBER
                        timeout connections being program run
                        [default : 30]

  Example :
    pyproxy.py -s                   | Gather proxy with samair.ru
    pyproxy.py -l                   | Gather proxy in the url list
    pyproxy.py -t proxylist.txt     | Test proxy inside proxylist.txt
    pyproxy.py -a                   | Do all
    pyproxy.py -v                   | Print current version

for advance user / python programmer .
we can use it in PyShell too by import them inside

gunslinger@c0debreaker:~/python/lib$ python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyproxy
>>> help(pyproxy)
Help on module pyproxy:

NAME
    pyproxy

FILE
    /home/gunslinger/python/module/pyproxy/pyproxy.py

DESCRIPTION
    # -*- 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

CLASSES
    __builtin__.object
        proxyhunter
        runengine
    
    class proxyhunter(__builtin__.object)
     |  Instance variables:
     |   
     |  Outputproxy
     |          Output file every proxy will be printed in
     |          Default : proxylist.txt
     |  
     |  Goodproxy
     |          Output file all good proxy will be print
     |          Default : goodproxylist.txt
     |  
     |  Verbose
     |          More noise, every proxy will be print into screen
     |          Default : True
     |  Timeout
     |          Timeout every test proxy connections in socket
     |          Default : 30
     |  
     |  Sitelist
     |          Proxy site for parsing proxy
     |          Default : []
     |  
     |  Methods defined here:
     |  
     |  Cleanitup(self, sorted_output='uniqueproxylist.txt')
     |      proxy will be printed in uniqueproxylist.txt by default
     |  
     |  CoreFreshTester(self, proxy)
     |  
     |  LoadProxy(self)
     |  
     |  MainFreshTester(self, proxy)
     |  
     |  ParseProxy(self, site)
     |  
     |  Samairdotru(self)
     |  
     |  Single(self)
     |  
     |  TestProxy(self)
     |  
     |  __init__(self, OutputProxy='proxylist.txt', GoodProxy='goodproxylist.txt', Verbose=True, TimeOut=30, Sitelist=[])
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
    
    class runengine(__builtin__.object)
     |  Methods defined here:
     |  
     |  __init__(self)
     |  
     |  parseoption(self)
     |  
     |  printversion(self)
     |  
     |  run(self)
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)

FUNCTIONS
    main()

DATA
    __author__ = 'Gunslinger_ <yudha.gunslinger@gmail.com>'
    __copyright__ = 'Copyright (c) 2010 Gunslinger_'
    __date__ = 'Thu Oct  7 00:00:41 2010'
    __version__ = '09'
    __warningregistry__ = {('the sets module is deprecated', <type 'except...

VERSION
    09

DATE
    Thu Oct  7 00:00:41 2010

AUTHOR
    Gunslinger_ <yudha.gunslinger@gmail.com>

(END) q

Need parse proxy in any site ? simply like this

>>> ph = pyproxy.proxyhunter()
>>> ph.ParseProxy("http://aliveproxy.com/high-anonymity-proxy-list/")
[*] Parse proxy from aliveproxy.com/high-anonymity-proxy-list/
218.182.134.23:8080
210.158.6.201:8080
174.142.24.201:3128
217.23.137.56:80
174.142.104.57:3128
205.213.195.70:8080
174.142.24.203:3128
174.142.24.205:3128
24.155.96.93:0080
174.142.24.204:3128
[*] 10 Proxies receieved from : aliveproxy.com/high-anonymity-proxy-list/ 

This module can be use for proxy testing too

>>> import pyproxy
>>> ph = pyproxy.proxyhunter(GoodProxy="goodproxylist.txt")
>>> ph.LoadProxy()
[*] File successfully loaded...
>>> ph.TestProxy()
Error : <urlopen error [Errno 111] Connection refused>
[*] 218.182.134.23:8080 
 '--------------> Bad
Error : <urlopen error [Errno 111] Connection refused>
[*] 210.158.6.201:8080 
 '--------------> Bad
Date: Fri, 08 Oct 2010 12:56:21 GMT
Server: gws
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=UTF-8
X-XSS-Protection: 1; mode=block
Set-Cookie: PREF=ID=3b034e546cd351bf:TM=1286542581:LM=1286542581:S=EmivqSAOZBhj22iF; expires=Sun, 07-Oct-2012 12:56:21 GMT; path=/; domain=.google.ca
Set-Cookie: NID=39=AQ2UnSEV0xbVMzzwrlcIhBN6dBszmQNIrHgh_iggOQh2JB8pBqz8bIrsxWQv-YX_6jaB3HlMJ7U1ghKURQyUM5evLmenr8vy9ByPZcVM-rkOGsf6nMNxxLQST1SkyJZK; expires=Sat, 09-Apr-2011 12:56:21 GMT; path=/; domain=.google.ca; HttpOnly
Connection: close
Transfer-Encoding: chunked

...
[*] 174.142.24.201:3128 
 '--------------> Good
[*] All Fresh proxy has been saved in goodproxylist.txt
>>> 

doesn’t need more noise ? take down the Verbose variable to False

>>> ph = pyproxy.proxyhunter(GoodProxy="goodproxylist.txt", Verbose=False)
>>> ph.LoadProxy()
[*] File successfully loaded...
>>> ph.TestProxy()
[*] 218.182.134.23:8080 
 '--------------> Good
[*] 210.158.6.201:8080 
 '--------------> Good
[*] 174.142.24.201:3128 
 '--------------> Good
[*] 217.23.137.56:80 
 '--------------> Good
[*] 174.142.104.57:3128 
 '--------------> Good
[*] 205.213.195.70:8080 
 '--------------> Bad
[*] 174.142.24.203:3128 
 '--------------> Good
[*] 174.142.24.205:3128 
 '--------------> Good
[*] 24.155.96.93:0080 
 '--------------> Bad
[*] 174.142.24.204:3128 
 '--------------> Good
[*] All Fresh proxy has been saved in goodproxylist.txt
>>> 

For more infomations, you can take a look at the source
you can find the project here https://sourceforge.net/projects/pyproxy/
hope can be useful for you ;)


domainreporter.py | malaysia hate speech domain report


well, sebelumnya mohon maaf blog ini belum terdapat update dalam beberapa minggu
dikarenakan penulis sedang sibuk dengan research yg harus dikerjakan .
ok, awalnya saya tadi liat blog http://indonbodoh.blogspot.com
tentu saya sebagai orang indonesia sangat geram dengan perlakuan ini,
daripada saya ikut berkomentar tidak jelas di blog itu, tentunya saya lebih baik memikirkan bagaimana blog tersebut hilang selamanya
dan ternyata teman saya juga melaporkan list blog yang telah melecehkan indonesia
yep semakin senang saya, karena mudah2an bisa jadi sasaran empuk program ini…
dan listnya sebagai berikut…

http://indonbodoh.blogspot.com/
http://indoncelaka.blogspot.com/
http://ihateindon.blogspot.com/
http://dontvisitindon2008.blogspot.com/
http://kamiantiindon.blogspot.com/
http://arezeo.blogspot.com/
http://sayabenciindon.blogspot.com/
http://www.penipuan-jawa.blogspot.com/

dan saya pun memilih untuk membuat program untuk report ke google
karena site tersebut sangat mengandung hate speech
saya berharap akan lenyap karena telah di report ke database dalam jumlah banyak
tentunya lebih membantu jika teman2 ikut menjalankan program ini
berikut adalah sourcecodenya :

#!/usr/bin/python
# programmer : gunslinger_ <yudha.gunslinger@gmail.com>
# please use this tools to vanish that domain, i hope google responds this !
# this program is defeated form encryption multipart/form-data
# so you need to install http://pypi.python.org/pypi/MultipartPostHandler/0.1.0 python module
# tips :
# - extract the folder
# - python setup.py build
# - sudo python setup.py install
# then program ready to rock !
import urllib2, random, sys
try:
	import MultipartPostHandler
except ImportError:
	print "[*] Please install MultipartPostHandler first"
	
def main():
	try:
		domain		= ['http://indonbodoh.blogspot.com/',
				'http://indoncelaka.blogspot.com/',
				'http://ihateindon.blogspot.com/',
				'http://dontvisitindon2008.blogspot.com/',
				'http://kamiantiindon.blogspot.com/',
				'http://arezeo.blogspot.com/',
				'http://sayabenciindon.blogspot.com/',
				'http://www.penipuan-jawa.blogspot.com/'
				]
		ouruseragent 	= ['Mozilla/4.0 (compatible; MSIE 5.0; SunOS 5.10 sun4u; X11)',
				'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1',
				'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.2pre) Gecko/20100207 Ubuntu/9.04 (jaunty) Namoroka/3.6.2pre',
				'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser;',
				'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)',
		        	'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1)',
		        	'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6)',
		        	'Microsoft Internet Explorer/4.0b1 (Windows 95)',
		        	'Opera/8.00 (Windows NT 5.1; U; en)',
				'amaya/9.51 libwww/5.4.0',
				'Mozilla/4.0 (compatible; MSIE 5.0; AOL 4.0; Windows 95; c_athome)',
				'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
				'Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) (Kubuntu)',
				'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; ZoomSpider.net bot; .NET CLR 1.1.4322)',
				'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; QihooBot 1.0 qihoobot@qihoo.net)',
				'Mozilla/4.0 (compatible; MSIE 5.0; Windows ME) Opera 5.11 [en]']
		success = 'Thanks for reporting this possible Terms of Service violation. We will examine it soon and take action as necessary.'
		opener 	= urllib2.build_opener(MultipartPostHandler.MultipartPostHandler)
		counter = 1
		while 1:	
			opener.addheaders = [('User-agent', random.choice(ouruseragent))]
			params = { 'extra.blog_URL' : random.choice(domain)
				}
			openserver = opener.open('http://www.google.com/support/blogger/bin/request.py?hl=en&ctx=submitted&confirm=hate_speech', params)
			result = openserver.read()
			if success in result:
				sys.stdout.write("%s[*] %s way success reporting domain %s to google ! %s" % ("\r", int(counter), params['extra.blog_URL'], " "*80))
				sys.stdout.flush()
			else:
				print "[*] Failed ! please try again !"
				sys.exit(1)
			counter = int(counter) + 1
	except KeyboardInterrupt:
		print "\n[*] Exiting program\n"
		sys.exit(1)
	except urllib2.HTTPError:
		print "\n[*] Connections problem, please try again !\n"
		sys.stdout(1)

if __name__ == '__main__':
	print "domainreporter.py"
	print "gunslinger_ <yudha.gunslinger@gmail.com>"
	main()

action :

ps : sekali lagi mohon maaf penulis belum bisa menulis beberapa artikel di blog ini, dikarenakan sedang disibukan oleh sesuatu…