-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
59 lines (49 loc) · 2.01 KB
/
main.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
import os
import threading
from PyMailGw import MailGwApi
import time
from pystyle import Write, Colors, Center, Colorate, Box
from datetime import datetime
import colorama
import clipboard
banner = """
:::::::::: ::::::::: :::: :::: ::: ::::::::::: :::
:+: :+: +:+:+: :+:+:+ :+: :+: :+: :+:
+:+ +:+ +:+ +:+:+ +:+ +:+ +:+ +:+ +:+
+#++:++# +#+ +#+ +:+ +#+ +#++:++#++: +#+ +#+
+#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+
#+# #+# #+# #+# #+# #+# #+# #+#
########## ######### ### ### ### ### ########### ##########
"""
def printheaders(email):
print('\n')
print(Colorate.Horizontal(Colors.blue_to_purple, Center.XCenter(str(banner)), 1))
print('\n')
print(Colorate.Horizontal(Colors.blue_to_purple, Center.XCenter(Box.Lines(str(email))), 1))
print('\n'*2)
def mailbox():
os.system('cls')
api = MailGwApi(timeout=30)
email = api.get_mail()
clipboard.copy(str(email))
printheaders(email)
showedmails = []
while True:
time.sleep(5)
for mail in api.fetch_inbox():
now = datetime.now()
codedetected = False
if mail['id'] in showedmails:
pass
else:
lastmail = {'subject': mail['subject'], 'mail': mail}
showedmails.append(mail['id'])
current_time = now.strftime("%H:%M:%S")
mailsub = mail['subject']
for s in mailsub.split():
code = s
if str(s.replace('.', '')).isdigit() and len(str(s)) > 2:
clipboard.copy(str(s))
codedetected = True
print(Center.XCenter(Box.SimpleCube(str(f"(at {current_time} | from {mail['from']['name']}) {mailsub} {f'| Copied {code}' if codedetected else ''}"))))
mailbox()