#!/usr/local/bin/python2.4 # -*- coding: iso-8859-2 -*- # # Script: o2acc.py - o2 account creator # Version: 0.2 # Date: 19/10/2005 # Works ONLY with Python 2.4.1 or higher # Copyright (c) 2005, Rodion rodion7(at)o2.pl # License: http://miracle7.info/bsd-license.txt # import cookielib, string, urllib, urllib2 from optparse import OptionParser debug = 1 def register(login, password, question, answer): login = login.lower() baseURL='http://profil.o2.pl' cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) request = urllib2.Request(baseURL + '/rejestracja.php') request.add_header('User-Agent', 'Opera/8.00 (Windows NT 5.0; U; en)') try: result = opener.open(request) if debug: print 'Registering...' except IOError: print 'Connection with %s failed.' % baseURL parmdicta = {'co' : 'go', 'referer' : '', 'login' : login, 'haslo1' : password, 'haslo2' : password, 'pytanie' : question, 'odpowiedz' : answer, 'rok': '1983', 'plec' : '1', 'miejscowosc' : 'Lublin', 'wojewodztwo' : '3', 'wyksztalcenie' : '5', 'branza' : '16', 'sytuacja' : '10', 'skad' : '4', 'zainteresowania%5B%5D' : '10', 'submit' : 'Zakl%2Fadam+konto+%3E%3E'} request = urllib2.Request(baseURL + '/rejestracja.php') postdata = urllib.unquote(urllib.urlencode(parmdicta)) request.add_data(postdata) request.add_header('User-Agent', 'Opera/8.00 (Windows NT 5.0; U; en)') try: result = opener.open(request) for line in result.readlines(): if 'Przy zakładaniu konta pojawiły się błędy.' in line: if debug: print 'Error. Account',login,'not registered. Already exist.' if 'Twoje konto na Portalu o2.pl zostało' in line: if debug: print 'Account',login,'registered successful.' except IOError: print 'Connection with %s failed.' % baseURL def make_profil(login, password, question, answer, od=None, do=None): if len(login) > 2 and login[0].isalpha() and len(password) > 4 and len(password) < 16 and password.isalnum() and len(question) > 4 and len(question) < 41 and len(answer) < 16: if od is None and len(login) < 26: register(login, password, question, answer) elif od.isdigit() and do.isdigit() and len(login+do) < 26: od = int(od) do = int(do) if do > od: for i in range(od, do): register((login + str(i)), password, question, answer) else: print '--l must be 3-25 alnum and first letter must be alpha' print '--t option must be larger than --f option.' else: print print '--l must be 3-25 alnum and first letter must be alpha' print '--p must be 5-15 alnum' print '--q must be 5-40 character' print '--a must be 1-15 character' # Main if __name__ == '__main__': parser = OptionParser() parser.add_option('--l', dest='login', help='account name 3-25 character') parser.add_option('--p', dest='password', help='password for account 5-15 character') parser.add_option('--q', dest='question', help='question for account 5-40 character') parser.add_option('--a', dest='answer', help='answer for account 1-15 character') parser.add_option('--f', dest='fr', help='account + from') parser.add_option('--t', dest='to', help='account + to') (options, args) = parser.parse_args() if options.login and options.password and options.question and options.answer and options.fr and options.to: make_profil(options.login, options.password, options.question, options.answer, options.fr, options.to) elif options.login and options.password and options.question and options.answer: make_profil(options.login, options.password, options.question, options.answer) else: print "Type with --help"