Advertisement
Guest User

runescape_account.py

a guest
Aug 17th, 2013
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.61 KB | None | 0 0
  1. # Account creator
  2. import urllib
  3. from urllib2 import urlopen
  4. from ClientForm import ParseResponse
  5. import random
  6. url = 'https://create.runescape.com/index.ws'
  7. api_url = 'https://create.runescape.com/checkusername.ajax?username='
  8. a = raw_input('Type a username here. Put nothing for a random one ')
  9. password = raw_input('Type a password for the account. Must be over 5 characters ')
  10. findstring = 'has now been created with the password you have chosen. We recommend you make a note of it on a bit of paper and keep it somewhere <strong>really</strong> safe, in case you forget it.</p>'
  11. used_usernames = ['ox',
  12.                   'lol',
  13.                   'ownage',
  14.                   'killer']
  15.  
  16. def make_username(username):
  17.     # Lets check if its blank
  18.     if username == '':
  19.         # Choose a random used username out of the list
  20.         check_name = random.choice(used_usernames)
  21.         z = username_get(check_name).split(',')
  22.         # Split the string into a list of usernames
  23.         # Choose a random one!
  24.         jew = random.choice(z)
  25.         print 'Username chosen: %s'%jew
  26.         return jew
  27.     else:
  28.         # Check if the username is in use allready:
  29.         if username_check(username):
  30.             # Not in use!
  31.             return username
  32.         else:
  33.             print username+' is in use. Finding a match closest to it'
  34.             a = 0
  35.             while 1:
  36.                 a = random.randint(a,a+100)
  37.                 check_name = username+str(a)
  38.                 if username_check(check_name):
  39.                     break
  40.                 print check_name+' in use - trying another'
  41.             print check_name+' not in use! - using'
  42.             return check_name
  43.  
  44. def username_check(username):
  45.     if urllib.urlopen(api_url+username).read() == '17':
  46.         return True
  47.     else:
  48.         return False
  49. def username_get(username):
  50.     return urllib.urlopen(api_url+username).read().replace('18,','')
  51.    
  52. username = make_username(a)
  53.  
  54. country = "88"
  55. response = urlopen(url)
  56. forms = ParseResponse(response,backwards_compat=False)
  57. form = forms[0]
  58. form['username'] = username
  59. form['password1'] = password
  60. form['password2'] = password
  61. form['day'] = [str(random.randint(1,31))]
  62. form['month'] = [str(random.randint(0,11))]
  63. form['year'] = str(random.randint(1950,1990))
  64. form['country'] = ["225"]
  65. form['agree_privacy'] = ['on']
  66. form['agree_terms'] = ['on']
  67. print '---------------------'
  68. print 'Details:'
  69. print 'Username: %s'%username
  70. print 'Password: %s'%password
  71. print '---------------------'
  72. print ' '
  73. print 'Creating account...'
  74. form.click()
  75. print 'Account created'
  76. while 1:
  77.     pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement