GiveYouAMail 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: GiveYouAMail
3
+ Version: 1.0.0
4
+ Summary: CLI Temporary Email Tool
5
+ Author: MurilooPrDev
6
+ Requires-Dist: requests
7
+ Dynamic: author
8
+ Dynamic: requires-dist
9
+ Dynamic: summary
@@ -0,0 +1,7 @@
1
+ gyam/30MMCLI.py,sha256=GCHPcFx3z7NuwCO0TjG6-3WZEYFNVX2SImMtCcLUw4k,4004
2
+ gyam/__init__.py,sha256=9ci1ihou4EF-iRfYJxTHM4IFmXdtXiDLmh62Af1p1bk,26
3
+ giveyouamail-1.0.0.dist-info/METADATA,sha256=Cy5RJYQ5xjtMeQatVTjH_m5oSgFTtDpiI22ANZI2kEU,191
4
+ giveyouamail-1.0.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
5
+ giveyouamail-1.0.0.dist-info/entry_points.txt,sha256=dK1cFVShMIyqA4nz9007b8h7ZPPdtOjB3kolmbK7KIU,43
6
+ giveyouamail-1.0.0.dist-info/top_level.txt,sha256=FtRwkE3gNQ7_pMjYVSxZBSmUpjt1eOwE7An9fdQJ3Es,5
7
+ giveyouamail-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ 30MM = gyam.30MMCLI:main
@@ -0,0 +1 @@
1
+ gyam
gyam/30MMCLI.py ADDED
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env python
2
+ import requests, time, os, sys, tty, termios, json, re
3
+
4
+ API_URL = "https://api.mail.tm"
5
+
6
+ class TUI:
7
+ def __init__(self, email, token, name):
8
+ self.email, self.token, self.name = email, token, name
9
+ self.messages, self.selected, self.action_idx, self.running = [], 0, 0, True
10
+
11
+ def fetch(self):
12
+ try:
13
+ h = {"Authorization": f"Bearer {self.token}"}
14
+ res = requests.get(f"{API_URL}/messages", headers=h).json()
15
+ self.messages = res.get('hydra:member', [])
16
+ except: pass
17
+
18
+ def read_msg(self, msg_id):
19
+ h = {"Authorization": f"Bearer {self.token}"}
20
+ res = requests.get(f"{API_URL}/messages/{msg_id}", headers=h).json()
21
+ os.system('clear')
22
+ print(f"\033[1;33m--- Message Content ---\033[0m\n\n{res.get('text', 'Empty')}")
23
+ print("\n\033[1;31mPress any key to go back...\033[0m")
24
+ self.get_key()
25
+
26
+ def delete_msg(self, msg_id):
27
+ h = {"Authorization": f"Bearer {self.token}"}
28
+ requests.delete(f"{API_URL}/messages/{msg_id}", headers=h)
29
+ self.fetch()
30
+
31
+ def draw(self):
32
+ os.system('clear')
33
+ print(f"\033[1;44m GiveYouAMail CLI \033[0m\nADDR: {self.email}\n" + "-"*50)
34
+ if not self.messages: print("\n Empty Inbox...")
35
+ for i, m in enumerate(self.messages):
36
+ sel = (i == self.selected)
37
+ pre = "\033[1;37m>\033[0m " if sel else " "
38
+ line = f"{pre}{m['from']['address'][:20]:<20} | {m['subject'][:20]}"
39
+ if sel:
40
+ o = "\033[1;42m OPEN \033[0m" if self.action_idx==0 else " OPEN "
41
+ d = "\033[1;41m DEL \033[0m" if self.action_idx==1 else " DEL "
42
+ line += f" {o} {d}"
43
+ print(line)
44
+ print("-"*50 + "\n[ARROWS] Nav | [ENTER] Exec | [Q] Quit")
45
+
46
+ def get_key(self):
47
+ fd = sys.stdin.fileno()
48
+ old = termios.tcgetattr(fd)
49
+ try:
50
+ tty.setraw(fd)
51
+ ch = sys.stdin.read(1)
52
+ if ch == '\x1b': return ch + sys.stdin.read(2)
53
+ return ch
54
+ finally: termios.tcsetattr(fd, termios.TCSADRAIN, old)
55
+
56
+ def run(self):
57
+ self.fetch()
58
+ while self.running:
59
+ self.draw()
60
+ k = self.get_key()
61
+ if k == 'q': self.running = False
62
+ elif k == '\x1b[A' and self.selected > 0: self.selected -= 1
63
+ elif k == '\x1b[B' and self.selected < len(self.messages)-1: self.selected += 1
64
+ elif k == '\x1b[D': self.action_idx = 0
65
+ elif k == '\x1b[C': self.action_idx = 1
66
+ elif k == '\r' and self.messages:
67
+ mid = self.messages[self.selected]['id']
68
+ if self.action_idx == 0: self.read_msg(mid)
69
+ else: self.delete_msg(mid)
70
+
71
+ def main():
72
+ raw = " ".join(sys.argv)
73
+ if "-Login" in raw:
74
+ try:
75
+ # Regex sagrado: busca o que está entre aspas ou logo após o prefixo
76
+ m_mail = re.search(r'M:\s*"?([^"\s]+)"?', raw)
77
+ m_pswd = re.search(r'pswd:\s*"?([^"\s]+)"?', raw)
78
+ m_nome = re.search(r'nm\s*"?([^"]+)"?', raw)
79
+
80
+ email, pswd, nome = m_mail.group(1), m_pswd.group(1), m_nome.group(1)
81
+
82
+ requests.post(f"{API_URL}/accounts", json={"address": email, "password": pswd})
83
+ with open("session.json", "w") as f:
84
+ json.dump({"email": email, "password": pswd, "name": nome}, f)
85
+ print(f"Session generated for {nome}.")
86
+ except Exception as e:
87
+ print(f"Syntax Error: {e}")
88
+
89
+ elif "-oauth" in raw:
90
+ if not os.path.exists("session.json"): return
91
+ with open("session.json", "r") as f: s = json.load(f)
92
+ res = requests.post(f"{API_URL}/token", json={"address": s['email'], "password": s['password']})
93
+ if res.status_code == 200:
94
+ TUI(s['email'], res.json()['token'], s['name']).run()
95
+ else: print("Auth Error.")
96
+
97
+ if __name__ == "__main__":
98
+ main()
gyam/__init__.py ADDED
@@ -0,0 +1 @@
1
+ from .30MMCLI import main