Advertisement
Guest User

gmailAccountGen

a guest
Feb 11th, 2018
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.48 KB | None | 0 0
  1. #! python3
  2.  
  3. #   Author      : Stavros Grigoriou
  4. #   Add On's    : Reece
  5. #   GitHub      : https://github.com/unix121
  6. #   Year        : 2017
  7. #   Description : Script that generates random Gmail account.
  8.  
  9. import pyautogui
  10. import sys
  11. import time
  12. import random
  13. import string
  14.  
  15. # Printing funtion with 3 modes
  16. # 1 : Normal message
  17. # 2 : Information message
  18. # 3 : Caution message
  19. def msg(
  20.         _option_,
  21.         _message_
  22.         ):
  23.     if _option_ == 1:
  24.         print(_message_)
  25.     elif _option_ == 2:
  26.         print(_message_)
  27.     elif _option_ == 3:
  28.         print('\n' , _message_)
  29.     else:
  30.         print('[ERROR]')
  31.  
  32. # Exiting function
  33. def ext():
  34.     msg(1,'Exiting...')
  35.     sys.exit()
  36.  
  37.  
  38. # Function used to open Firefox
  39. def open_firefox():
  40.  
  41.     # Printing basic message
  42.     msg(1, 'Opening Firefox...')
  43.  
  44.     # Location the start button
  45.     _start_button_=pyautogui.locateOnScreen('images/start_button.png')
  46.     _location_=pyautogui.center(_start_button_)
  47.  
  48.     # Clicking the start button
  49.     if not  pyautogui.click(_location_):
  50.         msg(1,'Opened start menu successfully!')
  51.     else:
  52.         msg(3,'Failed to open start menu!')
  53.         ext()
  54.  
  55.     time.sleep(1)
  56.  
  57.     # Search for Firefox in the menu search
  58.     pyautogui.typewrite('firefox')
  59.     pyautogui.typewrite('\n')
  60.    
  61.     # Print message
  62.     msg(1,'Firefox is now open and running.')
  63.  
  64.  
  65. # Function used to locate GMail
  66. def locate_gmail():
  67.    
  68.     #Sleep for a while and wait for Firefox to open
  69.     time.sleep(2)
  70.  
  71.     # Printing message
  72.     msg(1,'Opening Gmail...')
  73.  
  74.     # Typing the website on the browser
  75.     pyautogui.keyDown('ctrlleft');  pyautogui.typewrite('a'); pyautogui.keyUp('ctrlleft')
  76.     pyautogui.typewrite('https://accounts.google.com/SignUp?service=mail&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ltmpl=default')
  77.     pyautogui.typewrite('\n')
  78.    
  79.     # Wait for a while until the website responds
  80.     time.sleep(3)
  81.  
  82.     # Print a simple message
  83.     msg(1,'Locating the form...')
  84.  
  85.     # Locate the form
  86.     _gmail_=pyautogui.locateOnScreen('images/gmail_form.png')
  87.     _form_=pyautogui.center(_gmail_)
  88.    
  89.     # Check and print message
  90.     if not pyautogui.click(_form_):
  91.         msg(1,'Located the form.')
  92.     else:
  93.         msg(3,'Failed to locate the form.')
  94.         ext()
  95.  
  96.  
  97. # Function used to randomize credentials
  98. def randomize(
  99.                 _option_,
  100.                 _length_
  101.             ):
  102.  
  103.     if _length_ > 0 :
  104.  
  105.         # Options:
  106.         #       -p      for letters, numbers and symbols
  107.         #       -l      for letters only
  108.         #       -n      for numbers only
  109.         #       -m      for month selection
  110.         #       -d      for day selection
  111.         #       -y      for year selection
  112.  
  113.         if _option_ == '-p':
  114.             string._characters_='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+'
  115.         elif _option_ == '-l':
  116.             string._characters_='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
  117.         elif _option_ == '-n':
  118.             string._characters_='1234567890'
  119.         elif _option_ == '-m':
  120.             string._characters_='JFMASOND'
  121.  
  122.         if _option_ == '-d':
  123.             _generated_info_=random.randint(1,28)
  124.         elif _option_ == '-y':
  125.             _generated_info_=random.randint(1950,2000)
  126.         else:
  127.             _generated_info_=''
  128.             for _counter_ in range(0,_length_) :
  129.                 _generated_info_= _generated_info_ + random.choice(string._characters_)
  130.  
  131.         return _generated_info_
  132.  
  133.     else:
  134.         msg(3,'No valid length specified...')
  135.         ext()
  136.  
  137.  
  138. # Function used to generate the credential information
  139. def generate_info():
  140.  
  141.     # Print message
  142.     msg(1,'Generating credentials...')
  143.  
  144.     # First and last name
  145.     _first_name_=randomize('-l',7)
  146.     pyautogui.typewrite(_first_name_)
  147.     pyautogui.typewrite('\t')
  148.     _last_name_=randomize('-l',8)
  149.     pyautogui.typewrite(_last_name_)
  150.     pyautogui.typewrite('\t')
  151.     msg(2,'Name: %s %s' % (_first_name_,_last_name_))
  152.  
  153.     # Username
  154.     _username_=randomize('-l',10)
  155.     pyautogui.typewrite(_username_)
  156.     pyautogui.typewrite('\t')
  157.     msg(2,'Username: %s' % _username_)
  158.  
  159.     # Password
  160.     _password_=randomize('-p',16)
  161.     pyautogui.typewrite(_password_+'\t'+_password_+'\t')
  162.     msg(2,'Password: %s' % _password_)
  163.  
  164.     # Date of birth
  165.     _month_=randomize('-m',1)
  166.     _day_=randomize('-d',1)
  167.     _year_=randomize('-y',1)
  168.     pyautogui.typewrite(_month_+'\t'+str(_day_)+'\t'+str(_year_)+'\t')
  169.     msg(2,'Date of birth: %s/%d/%d' % (_month_,_day_,_year_))
  170.  
  171.     # Gender (set to 'Rather not say')
  172.     pyautogui.typewrite('R\t')
  173.     msg(2,'Gender: Rather not say')
  174.  
  175.     # Skip the rest
  176.     pyautogui.typewrite('\t\t\t\t\n')
  177.  
  178.     name = "Name: " + str(_first_name_) + ' ' + str(_last_name_) + '\n'
  179.     username = "Username: " + str(_username_) + '\n'
  180.     password = "Password: " + str(_password_) +'\n'
  181.  
  182.     textFile=randomize('-l',7)+ '.txt'
  183.     file = open(textFile,'w')
  184.    
  185.     file.write(name)
  186.     file.write(username)
  187.     file.write(password)
  188.     file.close()
  189.  
  190. # Main function
  191. if __name__=='__main__':
  192.  
  193.     if open_firefox() :
  194.         msg(3,'Failed to execute "open_firefox" command.')
  195.         ext()
  196.  
  197.     if locate_gmail() :
  198.         msg(3,'Failed to execute "locate_gmail" command.')
  199.         ext()
  200.  
  201.     if generate_info() :
  202.         msg(3,'Failed to execute "generate_info" command.')
  203.         ext()
  204.  
  205.     msg(1,'Done...')
  206.     ext()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement