Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)

AHE

By: heidi666 on Sep 25th, 2013  |  syntax: None  |  size: 4.56 KB  |  hits: 101  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. http://goo.gl/BEFc5W
  2.  
  3. import mechanize
  4. from bs4 import BeautifulSoup as BS
  5. import sys
  6.  
  7. br = mechanize.Browser()
  8.  
  9. print "\nDo you need to use a proxy? y/n"
  10. proxychoice = raw_input("> ")
  11. if proxychoice == "y":
  12.     print "\nEnter the IP:port of the proxy:"
  13.     proxyipport = str(raw_input("> "))
  14.     br.set_proxies({"http": proxyipport})
  15. else:
  16.     pass
  17.    
  18. print "\nWhat do you want the root of your nations to be?"
  19. print "i.e. the xxx in xxx1, xxx2, xxx3 etc."
  20. print "This root will also be the password for every nation."
  21. rootchoice = raw_input("> ")#####
  22.  
  23. print "\nEnter the details of the main nation, the creator of the alliance."
  24. print "Username:"
  25. userchoice = raw_input("> ")
  26. print "Password:"
  27. passchoice = raw_input("> ")
  28. print "Alliance ID (numbers only):"
  29. idchoice = raw_input("> ")
  30.  
  31. print "\nFrom what number do you want to start creating?"
  32. initialchoice = int(raw_input("> "))
  33. print "What increment do you want to go up by?"
  34. incrchoice = int(raw_input("> "))
  35.  
  36. i = initialchoice
  37.  
  38. while True:
  39.     try:
  40.         print i
  41.         loginresponse = br.open('http://bloc.name/register.php')
  42.         loginhtml = loginresponse.read()
  43. #        loginsoup = BS(loginhtml)
  44. #        print loginsoup.prettify()
  45. #        for form in br.forms():
  46. #            print form
  47.         br.form = list(br.forms())[1]
  48. #        print br.form
  49.         br["username"] = '%(root)s%(increment)d' % {'root':rootchoice,'increment':i}
  50.         br["password"] = '%(root)s' % {'root':rootchoice}
  51.         br["email"] = '%(root)s%(increment)d@%(email)s' % {'root':rootchoice,'increment':i,'email':rootchoice}
  52.         br["nationname"] = '%(root)s%(increment)d' % {'root':rootchoice,'increment':i}
  53.         br.form['region'] = ["Africa"]
  54.         br.form['government'] = ["1"]
  55.         br.form['economy'] = ["10"]
  56.         br.submit()
  57. #        print 'created'
  58.     except:
  59.         print 'no1'
  60.         pass
  61.        
  62.     try:    
  63. #        print "\nLogging in..."
  64.         loginresponse = br.open('http://bloc.name')
  65.         loginhtml = loginresponse.read()
  66. #        loginsoup = BS(loginhtml)
  67. #        for form in br.forms():
  68. #            print form
  69.         br.form = list(br.forms())[0]
  70.         br["username"] = '%(root)s%(increment)d' % {'root':rootchoice,'increment':i}
  71.         br["password"] = '%(root)s' % {'root':rootchoice}
  72.         br.submit()
  73. #        print "Done."
  74.         logoutresponse = br.open('http://bloc.name/logout.php')  
  75.     except:
  76.         print 'no2'
  77.         pass
  78.            
  79.        
  80.     try:    
  81. #        print "\nLogging in..."
  82.         loginresponse = br.open('http://bloc.name')
  83.         loginhtml = loginresponse.read()
  84. #        loginsoup = BS(loginhtml)
  85. #        for form in br.forms():
  86. #            print form
  87.         br.form = list(br.forms())[0]
  88.         br["username"] = '%(root)s' % {'root':userchoice}
  89.         br["password"] = '%(root)s' % {'root':passchoice}
  90.         br.submit()
  91. #        print "Done."
  92.     except:
  93.         print 'no3'
  94.         pass
  95.    
  96.     try:        
  97.         inviteresponse = br.open('http://bloc.name/alliancestats.php?allianceid=%s' % idchoice)
  98.         invitehtml = inviteresponse.read()
  99.         invitesoup = BS(invitehtml)
  100. #        for form in br.forms():
  101. #            print form
  102.         br.form = list(br.forms())[1]
  103. #        print br.form
  104.         br["invite"] = '%(root)s%(increment)d' % {'root':rootchoice,'increment':i}
  105. #        print br.form
  106.         br.submit()
  107. #        print 'invited'
  108.         logoutresponse = br.open('http://bloc.name/logout.php')
  109.     except:
  110.         print 'no4'
  111.         pass
  112.            
  113.        
  114.     try:    
  115. #        print "\nLogging in..."
  116.         loginresponse = br.open('http://bloc.name')
  117.         loginhtml = loginresponse.read()
  118. #        loginsoup = BS(loginhtml)
  119. #        for form in br.forms():
  120. #            print form
  121.         br.form = list(br.forms())[0]
  122.         br["username"] = '%(root)s%(increment)d' % {'root':rootchoice,'increment':i}
  123.         br["password"] = '%(root)s' % {'root':rootchoice}
  124.         br.submit()
  125. #        print "Done."
  126.     except:
  127.         print 'no5'
  128.         pass
  129.        
  130.     try:        
  131.         acceptresponse = br.open('http://bloc.name/alliancestats.php?allianceid=%s' % idchoice)
  132.         accepthtml = acceptresponse.read()
  133.         acceptsoup = BS(accepthtml)
  134. #        for form in br.forms():
  135. #            print form
  136.         br.form = list(br.forms())[0]
  137.         br.submit()
  138. #        print 'accepted'
  139.     except:
  140.         print 'no6'
  141.         pass
  142.            
  143.     logoutresponse = br.open('http://bloc.name/logout.php')
  144.        
  145.     i += incrchoice