Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 10.15 KB | None | 0 0
  1. import sys
  2. import csv
  3. import json
  4. import string
  5. import math
  6. import requests
  7. import threading
  8. import random
  9.  
  10. import deathbycaptcha
  11.  
  12. word_array = ["","Karil","Kiler","K1ler","Kil3r","K1ll3r","Noob2","N3wb","Favor","Hand","Slack","Fad","Bruh","D34D","Paige","Larry","Th3","M4ny","P1ll","Junki3","L4b0r","P4rty","W1ldy","Fallen","xx","6969","Fun","B33F","DEADBEEF","Dad","Lob","Deb","Koh","Gary","Garry","G4ry","Jerry","J3rry","E4rth","Bearer","Guthan","Glien","Gnome","Sara","Domin","Guthix","Varack","Ride","Raider","Fallout","Flying","Machine","Dob","Rob","Bot","Life","L1f3","Otter","W4ter","Fire","Read","Gi4nt","Hilt","Conqr","Speer","Edge","Slay","Guide","lyf3","lyf3","4lyfe","Seal"]
  13.  
  14. #Posts captchas to DeathByCaptcha and information to Runescape
  15. class Poster:
  16.     def __init__(self,dbc_user,dbc_passw,datah):
  17.         self.client = deathbycaptcha.HttpClient(dbc_user,dbc_passw)
  18.         self.datah = datah
  19.        
  20.     def postRunescape(self,account_number,infoGen):
  21.         email = infoGen.getEmail(account_number)
  22.         passw = infoGen.getPassword(6)
  23.         name = infoGen.getName()
  24.         while self.checkName(name) == False:
  25.             name = infoGen.getName()
  26.        
  27.         day = random.randint(1,28)
  28.         month = random.randint(1,12)
  29.         year = random.randint(1987,2000)
  30.        
  31.         captcha = self.solveCaptcha()
  32.        
  33.         print("Account Info Generated:")
  34.         print("    %s" % (email))
  35.         print("    %s" % (passw))      
  36.         print("    %s" % (name))       
  37.         print("    %s" % (captcha))
  38.         print("POSTING")       
  39.        
  40.         r = requests.post("https://secure.runescape.com/m=account-creation/create_account",data={
  41.             'day':day,
  42.             'displayname':name,
  43.             'email1':email,
  44.             'g-recaptcha-response':captcha["text"],
  45.             'month':month,
  46.             'onlyOneEmail':1,
  47.             'onlyOnePassword':1,
  48.             'password1':passw,
  49.             'submit':'Play+Now',
  50.             'theme':['oldschool','oldschool'],
  51.             'year':year
  52.         })
  53.        
  54.         print("POST reponse: %s" % (r))
  55.         if r.ok:
  56.             print("Checking Created...")
  57.             if self.checkName(name) == False:
  58.                 print("Successfully Created! Saving")
  59.                 acc = [name,email,passw]
  60.                 self.datah.writeAccount(acc)
  61.             else:
  62.                 print ("Error creating account: %s"%(email))
  63.                 print("Reporting captcha, exiting thread...")
  64.                 self.client.report(captcha["captcha"])
  65.                 sys.exit()
  66.         else:
  67.             print ("Error creating account: %s"%(email))
  68.             print("Reporting captcha, exiting thread...")
  69.             self.client.report(captcha["captcha"])
  70.             sys.exit()
  71.    
  72.     def checkName(self,name):
  73.         print("Checking name: %s" % (name))
  74.         r = requests.post("https://secure.runescape.com/m=account-creation/check_displayname.ajax",headers={'Referer':'https://secure.runescape.com/m=account-creation/create_account?theme=oldschool'},data={'displayname':name})
  75.         output = str(r.content)
  76.         if "true" in output:
  77.             print("Output from displayname check: True")
  78.             return True
  79.         else:
  80.             print("Output from displayname check: False")
  81.             return False
  82.        
  83.    
  84.     def solveCaptcha(self):
  85.         captcha_in = {
  86.             'googlekey': '6LccFA0TAAAAAHEwUJx_c1TfTBWMTAOIphwTtd1b',
  87.             'pageurl': 'https://secure.runescape.com/m=account-creation/create_account?theme=oldschool'
  88.         }
  89.         captcha_json = json.dumps(captcha_in)
  90.         try:
  91.             solved_captcha = self.client.decode(type=4,token_params=captcha_json)
  92.             if solved_captcha:
  93.                 #print ("CAPTCHA %s solved: %s" % (solved_captcha["captcha"], solved_captcha["text"]))
  94.                 if solved_captcha["text"] == '':
  95.                     self.client.report(solved_captcha["captcha"])
  96.                     print ("'' captcha, exitting")
  97.                     sys.exit()
  98.                     return
  99.                 if solved_captcha["text"] == '?':
  100.                     self.client.report(solved_captcha["captcha"])
  101.                     print ("? captcha, exitting")
  102.                     sys.exit()
  103.                     return
  104.                 if solved_captcha["text"] == None:
  105.                     self.client.report(solved_captcha["captcha"])
  106.                     print ("None captcha, exitting")
  107.                     sys.exit()
  108.                     return
  109.                 return (solved_captcha)
  110.             else:
  111.                 print ("error with captcha, exitting")
  112.                 sys.exit()
  113.                 return
  114.         except deathbycaptcha.AccessDeniedException:
  115.             print ("error: Access to DBC API denied, check your credentials and/or balance")
  116.             sys.exit()
  117.             return
  118.        
  119. #Generates calculated emails, pseudorandom names, and random passwords
  120. class InfoGenerator:
  121.     def __init__(self,word_array,email_pre,email_suf):
  122.         self.word_array = word_array
  123.         self.email_pre = email_pre
  124.         self.email_suf = email_suf
  125.  
  126.     #Generates a single email
  127.     #{email_pre}{number}@{email_suf}
  128.     def getEmail(self,number):
  129.         email = self.email_pre+str(number)+"@"+email_suf
  130.         return email
  131.    
  132.     #Generate an arbitary amount of emails
  133.     #{email_pre}{starting_number+i(amount_to_create)}@{email_suf}
  134.     def getEmails(self,starting_number,amount_to_create):
  135.         emails = []
  136.         for n in range(amount_to_create):
  137.             emails.append(self.getEmail(starting_number+n))
  138.         return emails
  139.    
  140.     #Generates a single password of an arbitrary length
  141.     def getPassword(self,length):
  142.         paas = ''.join(random.choices(string.ascii_uppercase + string.ascii_lowercase + string.digits, k=length))
  143.         return paas
  144.        
  145.     #Generates an arbitary amount passwords of an arbitrary length
  146.     def getPasswords(self,length,amount_to_create):
  147.         paass = []
  148.         for n in range(amount_to_create):
  149.             paass.append(''.join(random.choices(string.ascii_uppercase + string.ascii_lowercase + string.digits, k=length)))
  150.         return paass
  151.        
  152.        
  153.     #Generates a single name
  154.     def getName(self):
  155.         first_word = self.getFirstWord()
  156.         name = self.finishName(first_word)
  157.         return name
  158.    
  159.     #Generate an arbitary amount of names
  160.     def getNames(self,amount_to_create):
  161.         names = []
  162.         for n in range(amount_to_create):
  163.             first_word = self.getFirstWord()
  164.             names.append(self.finishName(first_word))
  165.         return names
  166.        
  167.     #Picks a random word from the word_array and adds numbers before and/or after
  168.     def getFirstWord(self):
  169.         self.sortWords()
  170.         rand = random.randint(0,len(self.lt_array)-1)
  171.         rand_lt = self.lt_array[rand]
  172.         rand_word = rand_lt[random.randint(0,len(rand_lt)-1)]
  173.         num_chance = random.randint(1,4)
  174.        
  175.         #Random Chance to add Numbers before and/or after the first word
  176.         #Can be modified for different "more realistic" name scheme
  177.         if num_chance == 4:
  178.             first_word = str(random.randint(0,99))+rand_word
  179.         elif num_chance == 3:
  180.             first_word = rand_word+str(random.randint(0,99))
  181.         elif num_chance == 2:
  182.             first_word = str(random.randint(0,99))+rand_word+str(random.randint(0,99))
  183.         elif num_chance == 1:
  184.             first_word = rand_word
  185.        
  186.         return first_word
  187.    
  188.     #Gets a second word from the word_array and adds numbers to the rest of the name if applicable
  189.     def finishName(self,first_word):
  190.         able_lt = self.calculateSpacesLeft(first_word)
  191.         sec_word = able_lt[random.randint(0,len(able_lt)-1)]
  192.         proto_name = first_word+sec_word
  193.         name_len = len(proto_name)
  194.         if name_len<12:
  195.             name=proto_name+str(random.randint(1,10**((12-name_len)-1)))
  196.         else:
  197.             name=proto_name
  198.         return name
  199.    
  200.     #Calculates the spaces left in the name given the first word
  201.     #returns a word array of words that can still fit
  202.     def calculateSpacesLeft(self,first_word):
  203.         able_calc = 12-len(first_word)
  204.         if able_calc >= 10:
  205.             able_lt = self.lt10
  206.         elif able_calc == 9:
  207.             able_lt = self.lt9
  208.         elif able_calc == 8:
  209.             able_lt = self.lt8
  210.         elif able_calc == 7:
  211.             able_lt = self.lt7
  212.         elif able_calc == 6:
  213.             able_lt = self.lt6
  214.         elif able_calc == 5:
  215.             able_lt = self.lt5
  216.         elif able_calc == 4:
  217.             able_lt = self.lt4
  218.         elif able_calc == 3:
  219.             able_lt = self.lt3
  220.         elif able_calc == 2:
  221.             able_lt = self.lt2
  222.         elif able_calc == 1:
  223.             able_lt = self.lt1
  224.            
  225.         return able_lt
  226.        
  227.    
  228.     def sortWords(self):
  229.         self.lt10 = []
  230.         self.lt9 = []
  231.         self.lt8 = []
  232.         self.lt7 = []
  233.         self.lt6 = []
  234.         self.lt5 = []
  235.         self.lt4 = []
  236.         self.lt3 = []
  237.         self.lt2 = []
  238.         self.lt1 = []
  239.         for ea in self.word_array:
  240.             if len(ea) > 10:
  241.                 print ("Discarded word: %s"%(ea))
  242.             if len(ea) <= 10:
  243.                 self.lt10.append(ea)
  244.             if len(ea) <= 9:
  245.                 self.lt9.append(ea)
  246.             if len(ea) <= 8:
  247.                 self.lt8.append(ea)
  248.             if len(ea) <= 7:
  249.                 self.lt7.append(ea)
  250.             if len(ea) <= 6:
  251.                 self.lt6.append(ea)
  252.             if len(ea) <= 5:
  253.                 self.lt5.append(ea)
  254.             if len(ea) <= 4:
  255.                 self.lt4.append(ea)
  256.             if len(ea) <= 3:
  257.                 self.lt3.append(ea)
  258.             if len(ea) <= 2:
  259.                 self.lt2.append(ea)
  260.             if len(ea) <= 1:
  261.                 self.lt1.append(ea)
  262.         self.lt_array = [self.lt10,self.lt9,self.lt8,self.lt7,self.lt6,self.lt5,self.lt4,self.lt3,self.lt2,self.lt1]
  263.  
  264. class DataHandler:
  265.    
  266.     def __init__(self,dbc=None):
  267.         if dbc == None:
  268.             self.dbc = "accounts.csv"
  269.         else:
  270.             self.dbc = dbc;
  271.  
  272.     def writeAccount(self,data):
  273.         if self.dbc == "accounts.csv":
  274.             with open(self.dbc,"a") as accFile:
  275.                 writer = csv.writer(accFile)
  276.                 writer.writerow(data)
  277.         else:
  278.             print("shitfuck not implemented yet")
  279.  
  280. #Our abstract code
  281. if len(sys.argv) == 8 or len(sys.argv) == 9:
  282.     dbc_user = str(sys.argv[1])
  283.     dbc_passw = str(sys.argv[2])
  284.     email_pre = str(sys.argv[3])
  285.     email_suf = str(sys.argv[4])
  286.     amount_to_create = int(sys.argv[5])
  287.     starting_number = int(sys.argv[6])
  288.     group_count = int(sys.argv[7])
  289.     if len(sys.argv) == 9:
  290.         dbconn = int(sys.argv[8])
  291.     else:
  292.         dbconn = None
  293.    
  294.     print ("Creating %d accounts, assigned to email %s@%s starting at %d" % (amount_to_create, email_pre, email_suf, starting_number))
  295.     print ("Using %d threads at a time" % (group_count))
  296.     #print("Creating one account cuz test")
  297.    
  298.     infoGen = InfoGenerator(word_array,email_pre,email_suf)
  299.     datah = DataHandler(dbconn)
  300.     poster = Poster(dbc_user,dbc_passw,datah)
  301.    
  302.     groups = int(math.ceil(amount_to_create/group_count))
  303.     created = amount_to_create
  304.    
  305.     for ea in range(groups):
  306.         if (created-group_count)<0:
  307.             create = (created-group_count)+group_count
  308.         else:
  309.             create = group_count
  310.         thr = [None]*create
  311.         for i in range(create):
  312.             thr[i] = threading.Thread(target=poster.postRunescape, args=(int(((ea*create)+i)+starting_number),infoGen), kwargs={})
  313.             thr[i].start()
  314.             created-=1
  315.         thr[-1].join()
  316.    
  317. else:
  318.     print ("Missing arguments, exitting")
  319.     print ("Usage:")
  320.     print ("    python asyncCreator.py deathbycaptcha_username deathbycaptcha_password email_prefix email_suffix amount_to_create starting_number thread_count")
  321.     print ("For information about each param see the forum thread:")
  322.     print ("    https://dreambot.org/forums/index.php?/topic/16139-python-account-generator/")
  323.     sys.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement