-
Notifications
You must be signed in to change notification settings - Fork 1
/
fakemail.py
124 lines (106 loc) · 4.33 KB
/
fakemail.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
import yaml, requests
class DatabaseManager:
def __init__(self, filename='db.yaml'):
self.filename = filename
self.load_db()
def load_db(self):
try:
with open(self.filename) as f:
self.data = yaml.safe_load(f)
except FileNotFoundError:
self.data = {}
def save_db(self):
with open(self.filename, 'w') as f:
yaml.dump(self.data, f)
def get(self, key):
return self.data[key]
def set(self, key, value):
self.data[key] = value
self.save_db()
def delete(self, key):
del self.data[key]
self.save_db()
proxies = None
session = requests.Session()
session.headers = {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"accept-language": "en-US,en;q=0.9",
"sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "none",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1"
}
session.proxies = proxies
db = DatabaseManager()
def create_mail():
# global session
session = requests.Session()
session.headers = {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"accept-language": "en-US,en;q=0.9",
"sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "none",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1"
}
session.proxies = proxies
r = session.get('https://www.fakemail.net/', timeout=5)
h = {
"accept": "application/json, text/javascript, */*; q=0.01",
"accept-language": "en-US,en;q=0.9",
"sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"x-requested-with": "XMLHttpRequest"
}
h['Cookie'] = r.headers['Set-Cookie']
r = session.get('https://www.fakemail.net/index/index', headers=h)
email = json.loads(r.text.encode())['email']
db.set(f'temp_mail_cookie_{email}', r.headers['Set-Cookie'])
db.set('temp_mail_address', email)
add_expire(email)
return email
def add_expire(email: str):
h = {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"accept-language": "en-US,en;q=0.9",
"sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "same-origin",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1",
'Cookie': db.get(f'temp_mail_cookie_{email}')
}
r = session.get('https://www.fakemail.net/expirace/1209600', headers=h)
def get_emails(email: str):
h = {
"accept": "application/json, text/javascript, */*; q=0.01",
"accept-language": "en-US,en;q=0.9",
"sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"x-requested-with": "XMLHttpRequest",
'Cookie': db.get(f'temp_mail_cookie_{email}')
}
r = session.get('https://www.fakemail.net/index/refresh', headers=h)
h['Reffer'] = 'https://www.fakemail.net/window/id/2'
r = session.get('https://www.fakemail.net/email/id/2', headers=h)
add_expire(email)
return r.text