Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- http://goo.gl/BEFc5W
- import mechanize
- from bs4 import BeautifulSoup as BS
- import sys
- br = mechanize.Browser()
- print "\nDo you need to use a proxy? y/n"
- proxychoice = raw_input("> ")
- if proxychoice == "y":
- print "\nEnter the IP:port of the proxy:"
- proxyipport = str(raw_input("> "))
- br.set_proxies({"http": proxyipport})
- else:
- pass
- print "\nWhat do you want the root of your nations to be?"
- print "i.e. the xxx in xxx1, xxx2, xxx3 etc."
- print "This root will also be the password for every nation."
- rootchoice = raw_input("> ")#####
- print "\nEnter the details of the main nation, the creator of the alliance."
- print "Username:"
- userchoice = raw_input("> ")
- print "Password:"
- passchoice = raw_input("> ")
- print "Alliance ID (numbers only):"
- idchoice = raw_input("> ")
- print "\nFrom what number do you want to start creating?"
- initialchoice = int(raw_input("> "))
- print "What increment do you want to go up by?"
- incrchoice = int(raw_input("> "))
- i = initialchoice
- while True:
- try:
- print i
- loginresponse = br.open('http://bloc.name/register.php')
- loginhtml = loginresponse.read()
- # loginsoup = BS(loginhtml)
- # print loginsoup.prettify()
- # for form in br.forms():
- # print form
- br.form = list(br.forms())[1]
- # print br.form
- br["username"] = '%(root)s%(increment)d' % {'root':rootchoice,'increment':i}
- br["password"] = '%(root)s' % {'root':rootchoice}
- br["email"] = '%(root)s%(increment)d@%(email)s' % {'root':rootchoice,'increment':i,'email':rootchoice}
- br["nationname"] = '%(root)s%(increment)d' % {'root':rootchoice,'increment':i}
- br.form['region'] = ["Africa"]
- br.form['government'] = ["1"]
- br.form['economy'] = ["10"]
- br.submit()
- # print 'created'
- except:
- print 'no1'
- pass
- try:
- # print "\nLogging in..."
- loginresponse = br.open('http://bloc.name')
- loginhtml = loginresponse.read()
- # loginsoup = BS(loginhtml)
- # for form in br.forms():
- # print form
- br.form = list(br.forms())[0]
- br["username"] = '%(root)s%(increment)d' % {'root':rootchoice,'increment':i}
- br["password"] = '%(root)s' % {'root':rootchoice}
- br.submit()
- # print "Done."
- logoutresponse = br.open('http://bloc.name/logout.php')
- except:
- print 'no2'
- pass
- try:
- # print "\nLogging in..."
- loginresponse = br.open('http://bloc.name')
- loginhtml = loginresponse.read()
- # loginsoup = BS(loginhtml)
- # for form in br.forms():
- # print form
- br.form = list(br.forms())[0]
- br["username"] = '%(root)s' % {'root':userchoice}
- br["password"] = '%(root)s' % {'root':passchoice}
- br.submit()
- # print "Done."
- except:
- print 'no3'
- pass
- try:
- inviteresponse = br.open('http://bloc.name/alliancestats.php?allianceid=%s' % idchoice)
- invitehtml = inviteresponse.read()
- invitesoup = BS(invitehtml)
- # for form in br.forms():
- # print form
- br.form = list(br.forms())[1]
- # print br.form
- br["invite"] = '%(root)s%(increment)d' % {'root':rootchoice,'increment':i}
- # print br.form
- br.submit()
- # print 'invited'
- logoutresponse = br.open('http://bloc.name/logout.php')
- except:
- print 'no4'
- pass
- try:
- # print "\nLogging in..."
- loginresponse = br.open('http://bloc.name')
- loginhtml = loginresponse.read()
- # loginsoup = BS(loginhtml)
- # for form in br.forms():
- # print form
- br.form = list(br.forms())[0]
- br["username"] = '%(root)s%(increment)d' % {'root':rootchoice,'increment':i}
- br["password"] = '%(root)s' % {'root':rootchoice}
- br.submit()
- # print "Done."
- except:
- print 'no5'
- pass
- try:
- acceptresponse = br.open('http://bloc.name/alliancestats.php?allianceid=%s' % idchoice)
- accepthtml = acceptresponse.read()
- acceptsoup = BS(accepthtml)
- # for form in br.forms():
- # print form
- br.form = list(br.forms())[0]
- br.submit()
- # print 'accepted'
- except:
- print 'no6'
- pass
- logoutresponse = br.open('http://bloc.name/logout.php')
- i += incrchoice
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement