GiveYouAMail 1.0.2__tar.gz → 1.0.3__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GiveYouAMail
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: CLI Temporary Email Tool - GYAM Edition
5
5
  Author: MurilooPrDev
6
6
  Requires-Dist: requests
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GiveYouAMail
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: CLI Temporary Email Tool - GYAM Edition
5
5
  Author: MurilooPrDev
6
6
  Requires-Dist: requests
@@ -0,0 +1,106 @@
1
+ import requests, sys, re, json, os, curses
2
+
3
+ API = "https://api.mail.tm"
4
+
5
+ def read_msg(stdscr, token, msg_id):
6
+ headers = {"Authorization": f"Bearer {token}"}
7
+ res = requests.get(f"{API}/messages/{msg_id}", headers=headers).json()
8
+ body = res.get('text', res.get('intro', 'Sem conteúdo'))
9
+
10
+ while True:
11
+ stdscr.clear()
12
+ h, w = stdscr.getmaxyx()
13
+ stdscr.attron(curses.color_pair(1))
14
+ stdscr.addstr(1, 2, "╔" + "═"*(w-6) + "╗")
15
+ stdscr.addstr(2, 2, f"║ CONTEÚDO DA MENSAGEM {' '*(w-29)}║")
16
+ stdscr.addstr(3, 2, "╚" + "═"*(w-6) + "╝")
17
+ stdscr.attroff(curses.color_pair(1))
18
+
19
+ lines = body.split('\n')
20
+ for i, line in enumerate(lines[:h-10]):
21
+ stdscr.addstr(5+i, 4, line[:w-8])
22
+
23
+ stdscr.attron(curses.color_pair(3))
24
+ stdscr.addstr(h-2, 2, " [ESC/B] VOLTAR ", curses.A_REVERSE)
25
+ stdscr.attroff(curses.color_pair(3))
26
+
27
+ stdscr.refresh()
28
+ k = stdscr.getch()
29
+ if k in [27, ord('b'), ord('B')]: break
30
+
31
+ def tui_original(stdscr, token, email):
32
+ curses.start_color()
33
+ curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK)
34
+ curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_BLUE)
35
+ curses.init_pair(3, curses.COLOR_GREEN, curses.COLOR_BLACK)
36
+ curses.curs_set(0)
37
+ idx = 0
38
+
39
+ while True:
40
+ stdscr.clear()
41
+ h, w = stdscr.getmaxyx()
42
+ stdscr.attron(curses.color_pair(1) | curses.A_BOLD)
43
+ stdscr.addstr(1, 2, "╔" + "═"*(w-6) + "╗")
44
+ stdscr.addstr(2, 2, f"║ GiveYouAMail CLI {' '*(w-25)}║")
45
+ stdscr.addstr(3, 2, f"║ User: {email.ljust(w-16)} ║")
46
+ stdscr.addstr(4, 2, "╚" + "═"*(w-6) + "╝")
47
+ stdscr.attroff(curses.color_pair(1) | curses.A_BOLD)
48
+
49
+ headers = {"Authorization": f"Bearer {token}"}
50
+ try:
51
+ r = requests.get(f"{API}/messages", headers=headers, timeout=5)
52
+ items = r.json().get('hydra:member', [])
53
+ except: items = []
54
+
55
+ if not items:
56
+ stdscr.addstr(h//2, w//2-9, ">> NO INCOMING <<", curses.A_BOLD)
57
+ else:
58
+ for i, m in enumerate(items[:h-10]):
59
+ style = curses.color_pair(2) if i == idx else curses.A_NORMAL
60
+ sender = m['from']['address'][:20].ljust(22)
61
+ subj = m['subject'][:w-40].ljust(w-40)
62
+ stdscr.addstr(6+i, 4, f" {sender} | {subj} ", style)
63
+
64
+ stdscr.attron(curses.color_pair(3))
65
+ stdscr.addstr(h-2, 2, " [Q] QUIT [R] REFRESH [ENTER] OPEN ", curses.A_REVERSE)
66
+ stdscr.attroff(curses.color_pair(3))
67
+
68
+ stdscr.refresh()
69
+ k = stdscr.getch()
70
+ if k in [ord('q'), ord('Q'), 27]: break
71
+ elif k == curses.KEY_UP and idx > 0: idx -= 1
72
+ elif k == curses.KEY_DOWN and idx < len(items)-1: idx += 1
73
+ elif k in [10, 13]:
74
+ if items: read_msg(stdscr, token, items[idx]['id'])
75
+ elif k in [ord('r'), ord('R')]: idx = 0
76
+
77
+ def main():
78
+ raw = " ".join(sys.argv)
79
+ m_mail = re.search(r'M:[\s"]*([^\s"]+)', raw)
80
+ m_pswd = re.search(r'pswd:[\s"]*([^\s"]+)', raw)
81
+
82
+ if "-Login" in raw:
83
+ if not m_pswd: return
84
+ try:
85
+ doms = requests.get(f"{API}/domains").json()['hydra:member']
86
+ target_dom = doms[0]['domain']
87
+ except: target_dom = "moakt.cc"
88
+ email = m_mail.group(1) if m_mail else f"user_{os.urandom(2).hex()}@{target_dom}"
89
+ pswd = m_pswd.group(1)
90
+ res = requests.post(f"{API}/accounts", json={"address": email, "password": pswd})
91
+ if res.status_code in [201, 200, 422]:
92
+ with open("session.json", "w") as f:
93
+ json.dump({"email": email, "password": pswd}, f)
94
+ print(f"Sessão Criada: {email}")
95
+ return
96
+
97
+ if "-oauth" in raw:
98
+ if not os.path.exists("session.json"): return
99
+ with open("session.json", "r") as f:
100
+ s = json.load(f); email, pswd = s['email'], s['password']
101
+ res = requests.post(f"{API}/token", json={"address": email, "password": pswd})
102
+ if res.status_code == 200:
103
+ curses.wrapper(tui_original, res.json()['token'], email)
104
+
105
+ if __name__ == "__main__":
106
+ main()
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='GiveYouAMail',
5
- version='1.0.2',
5
+ version='1.0.3',
6
6
  packages=find_packages(),
7
7
  install_requires=['requests'],
8
8
  entry_points={
@@ -1,6 +0,0 @@
1
- #!/data/data/com.termux/files/usr/bin/python3.12
2
- import sys
3
- from gyam.main_script import main
4
- if __name__ == '__main__':
5
- sys.argv[0] = sys.argv[0].removesuffix('.exe')
6
- sys.exit(main())
File without changes
File without changes
File without changes