-
Notifications
You must be signed in to change notification settings - Fork 63
/
protosint.py
268 lines (227 loc) · 8.86 KB
/
protosint.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#!/usr/bin/env python3
#Python libraries
import requests
from datetime import datetime
import re
import ipaddress
#Color setup
class bcolors:
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
BOLD = '\033[1m'
ENDC = '\033[0m'
def printAscii():
"""
ASCII Art
"""
print("""
___ _ _ _
/ _ \_ __ ___ | |_ ___ ___(_)_ __ | |_
/ /_)/ '__/ _ \| __/ _ \/ __| | '_ \| __|
/ ___/| | | (_) | || (_) \__ \ | | | | |_
\/ |_| \___/ \__\___/|___/_|_| |_|\__|
""")
def checkProtonAPIStatut():
"""
This function check proton API statut : ONLINE / OFFLINE
"""
requestProton_mail_statut = requests.get('https://api.protonmail.ch/pks/lookup?op=index&[email protected]')
if requestProton_mail_statut.status_code == 200:
print("Protonmail API is " + f"{bcolors.BOLD}ONLINE{bcolors.ENDC}")
else:
print("Protonmail API is " + f"{bcolors.BOLD}OFFLINE{bcolors.ENDC}")
requestProton_vpn_statut = requests.get('https://api.protonmail.ch/vpn/logicals')
if requestProton_vpn_statut.status_code == 200:
print("Protonmail VPN is " + f"{bcolors.BOLD}ONLINE{bcolors.ENDC}")
else:
print("Protonmail VPN is " + f"{bcolors.BOLD}OFFLINE{bcolors.ENDC}")
def printWelcome():
welcome = """
Let's take a look at your target:
1 - Test the validity of one protonmail account
2 - Try to find if your target have a protonmail account
3 - Find if your IP is currently affiliate to ProtonVPN
"""
print(welcome)
def checkValidityOneAccount():
"""
PROGRAM 1 : Test the validity of one protonmail account
"""
invalidEmail = True
regexEmail = "([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)"
print("You want to know if a protonmail email is real ?")
while invalidEmail:
#Input
mail = input("Give me your email: ")
#Text if the input is valid
if(re.search(regexEmail,mail)):
invalidEmail = False
else:
print("Invalid Email")
invalidEmail = True
#Check if the protonmail exist : valid / not valid
requestProton = requests.get('https://api.protonmail.ch/pks/lookup?op=index&search='+str(mail))
bodyResponse = requestProton.text
protonNoExist = "info:1:0" #not valid
protonExist = "info:1:1" #valid
if protonNoExist in bodyResponse:
print("Protonmail email is " + f"{bcolors.FAIL}not valid{bcolors.ENDC}")
if protonExist in bodyResponse:
print("Protonmail email is " + f"{bcolors.OKGREEN}valid{bcolors.ENDC}")
regexPattern1 = "2048:(.*)::" #RSA 2048-bit (Older but faster)
regexPattern2 = "4096:(.*)::" #RSA 4096-bit (Secure but slow)
regexPattern3 = "22::(.*)::" #X25519 (Modern, fastest, secure)
try:
timestamp = int(re.search(regexPattern1, bodyResponse).group(1))
dtObject = datetime.fromtimestamp(timestamp)
print("Date and time of the creation:", dtObject)
print("Encryption : RSA 2048-bit (Older but faster)")
except:
try:
timestamp = int(re.search(regexPattern2, bodyResponse).group(1))
dtObject = datetime.fromtimestamp(timestamp)
print("Date and time of the creation:", dtObject)
print("Encryption : RSA 4096-bit (Secure but slow)")
except:
timestamp = int(re.search(regexPattern3, bodyResponse).group(1))
dtObject = datetime.fromtimestamp(timestamp)
print("Date and time of the creation:", dtObject)
print("Encryption : X25519 (Modern, fastest, secure)")
#Download the public key attached to the email
invalidResponse = True
print("Do you want to download the public key attached to the email ?")
while invalidResponse:
#Input
responseFromUser = input("""Please enter "yes" or "no": """)
#Text if the input is valid
if responseFromUser == "yes":
invalidResponse = False
requestProtonPublicKey = requests.get('https://api.protonmail.ch/pks/lookup?op=get&search='+str(mail))
bodyResponsePublicKey = requestProtonPublicKey.text
print(bodyResponsePublicKey)
elif responseFromUser == "no":
invalidResponse = False
else:
print("Invalid Input")
invalidResponse = True
def checkGeneratedProtonAccounts():
"""
PROGRAM 2 : Try to find if your target have a protonmail account by generating multiple adresses by combining information fields inputted
"""
#Input
print("Let's go, try to find your protonmail target:")
firstName = input("First name: ").lower()
lastName = input("Last name: ").lower()
yearOfBirth = input("Year of birth: ")
pseudo1 = input("Pseudo 1: ").lower()
pseudo2 = input("Pseudo 2: ").lower()
zipCode = input("zipCode: ")
#Protonmail domain
domainList = ["@protonmail.com","@protonmail.ch","@pm.me"]
#List of combinaison
pseudoList=[]
for domain in domainList:
#For domain
pseudoList.append(firstName+lastName+domain)
pseudoList.append(lastName+firstName+domain)
pseudoList.append(firstName[0]+lastName+domain)
pseudoList.append(pseudo1+domain)
pseudoList.append(pseudo2+domain)
pseudoList.append(lastName+domain)
pseudoList.append(firstName+lastName+yearOfBirth+domain)
pseudoList.append(firstName[0]+lastName+yearOfBirth+domain)
pseudoList.append(lastName+firstName+yearOfBirth+domain)
pseudoList.append(pseudo1+yearOfBirth+domain)
pseudoList.append(pseudo2+yearOfBirth+domain)
pseudoList.append(firstName+lastName+yearOfBirth[-2:]+domain)
pseudoList.append(firstName+lastName+yearOfBirth[-2:]+domain)
pseudoList.append(firstName[0]+lastName+yearOfBirth[-2:]+domain)
pseudoList.append(lastName+firstName+yearOfBirth[-2:]+domain)
pseudoList.append(pseudo1+yearOfBirth[-2:]+domain)
pseudoList.append(pseudo2+yearOfBirth[-2:]+domain)
pseudoList.append(firstName+lastName+zipCode+domain)
pseudoList.append(firstName[0]+lastName+zipCode+domain)
pseudoList.append(lastName+firstName+zipCode+domain)
pseudoList.append(pseudo1+zipCode+domain)
pseudoList.append(pseudo2+zipCode+domain)
pseudoList.append(firstName+lastName+zipCode[:2]+domain)
pseudoList.append(firstName[0]+lastName+zipCode[:2]+domain)
pseudoList.append(lastName+firstName+zipCode[:2]+domain)
pseudoList.append(pseudo1+zipCode[:2]+domain)
pseudoList.append(pseudo2+zipCode[:2]+domain)
#Remove duplicates from list
pseudoListUniq = []
for i in pseudoList:
if i not in pseudoListUniq:
pseudoListUniq.append(i)
#Remove all irrelevant combinations
for domain in domainList:
if domain in pseudoListUniq: pseudoListUniq.remove(domain)
if zipCode+domain in pseudoListUniq: pseudoListUniq.remove(zipCode+domain)
if zipCode[:2]+domain in pseudoListUniq: pseudoListUniq.remove(zipCode[:2]+domain)
if yearOfBirth+domain in pseudoListUniq: pseudoListUniq.remove(yearOfBirth+domain)
if yearOfBirth[-2:]+domain in pseudoListUniq: pseudoListUniq.remove(yearOfBirth[-2:]+domain)
if firstName+domain in pseudoListUniq: pseudoListUniq.remove(firstName+domain)
print("===============================")
print("I'm trying some combinaison: " + str(len(pseudoListUniq)))
print("===============================")
for pseudo in pseudoListUniq:
requestProton = requests.get('https://api.protonmail.ch/pks/lookup?op=index&search='+str(pseudo))
bodyResponse = requestProton.text
protonNoExist = "info:1:0" #not valid
protonExist = "info:1:1" #valid
if protonNoExist in bodyResponse:
print(pseudo + " is " + f"{bcolors.FAIL}not valid{bcolors.ENDC}")
if protonExist in bodyResponse:
regexPattern1 = "2048:(.*)::"
regexPattern2 = "4096:(.*)::"
regexPattern3 = "22::(.*)::"
try:
timestamp = int(re.search(regexPattern1, bodyResponse).group(1))
dtObject = datetime.fromtimestamp(timestamp)
print(pseudo + " is " + f"{bcolors.OKGREEN}valid{bcolors.ENDC}" + " - Creation date:", dtObject)
except AttributeError:
continue
except:
try:
timestamp = int(re.search(regexPattern2, bodyResponse).group(1))
dtObject = datetime.fromtimestamp(timestamp)
print(pseudo + " is " + f"{bcolors.OKGREEN}valid{bcolors.ENDC}" + " - Creation date:", dtObject)
except AttributeError:
continue
except:
timestamp = int(re.search(regexPattern3, bodyResponse).group(1))
dtObject = datetime.fromtimestamp(timestamp)
print(pseudo + " is " + f"{bcolors.OKGREEN}valid{bcolors.ENDC}" + " - Creation date:", dtObject)
def checkIPProtonVPN():
"""
PROGRAM 3 : Find if your IP is currently affiliate to ProtonVPN
"""
while True:
try:
ip = ipaddress.ip_address(input('Enter IP address: '))
break
except ValueError:
continue
requestProton_vpn = requests.get('https://api.protonmail.ch/vpn/logicals')
bodyResponse = requestProton_vpn.text
if str(ip) in bodyResponse:
print("This IP is currently affiliate to ProtonVPN")
else:
print("This IP is currently not affiliate to ProtonVPN")
#print(bodyResponse)
# Entry point of the script
def main():
printAscii()
checkProtonAPIStatut()
printWelcome()
choice = input("Choose a program: ")
if choice == "1":
checkValidityOneAccount()
if choice == "2":
checkGeneratedProtonAccounts()
if choice == "3":
checkIPProtonVPN()
if __name__ == '__main__':
main()