Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
thanks to @tashan022 to open the issue
  • Loading branch information
HanzCEO authored Jan 6, 2020
1 parent 11819b8 commit f4bef06
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
43 changes: 30 additions & 13 deletions emailinbox.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
from prettytable import PrettyTable
from colorama import Fore, Back, Style, init
import os, threading, argparse, requests, time, json, random
from secmail.api import inbox, message, attachment
from secmail.api import *

'''
BUG FIXES
BUG #1:
- Can't open the email by id
SOLVED: it was a <built_in_id> i should use another thanks to https://github.com/tashan022
'''

# clear screen
def ClrScrn():
Expand Down Expand Up @@ -53,16 +60,26 @@ def ClrScrn():
#############################################

##################### MAIN FUNCTIONS ########
def goRead(id, login, domain):
theRes = message(login, domain, id)
def goRead(login, domain, eid):
theRes = mes(login, domain, eid)
ClrScrn()
print(theRes)
table = PrettyTable()
table.field_names = [f"{flgreen}Body"]
#table.add_row(f"{flwhite+str(theRes['body'])}")
print(table)
os.system('pause')
tableTheInbox(login, domain)
if theRes == "Message not found":
print(theRes)
os.system('pause')
tableTheInbox(login, domain)
else:
theRes = loads(theRes)
table = PrettyTable()
table.field_names = [f"{flgreen}Body", f"{fcyan}Attachments{fwhite}"]
try:
for x in range(1000):
table.add_row([flwhite+theRes["textBody"], fcyan+theRes["attachments"][x]+fwhite])

except IndexError:
table.add_row([flwhite+theRes["textBody"], ""])
print(table)
os.system('pause')
tableTheInbox(login, domain)


def tableTheInbox(login, domain):
Expand All @@ -79,14 +96,14 @@ def tableTheInbox(login, domain):
if inp == "r":
tableTheInbox(login, domain)
else:
goRead(str(inp), login, domain)
goRead(login, domain, str(inp))
def hlp():
ClrScrn()
table = PrettyTable()
table.field_names = [f"{flred}Full Argument", f"{flgreen}Less Argument", f"{fwhite}Description"]
table.add_row([f"{fred}--help", f"{fgreen}-h", f"{fwhite}Help. show this message"])
table.add_row([f"{fred}--login", f"{fgreen}-l", f"{fwhite}username of email (ex. {bcyan}hanzo221{bgreen}@1secmail.com{resetall} the cyan colored is 'login')"])
table.add_row([f"{fred}--domain", f"{fgreen}-d", f"{fwhite}host of email (ex. {bcyan}hanzo221{bgreen}@1secmail.com{resetall} the green colored is 'domain')"])
table.add_row([f"{fred}--login", f"{fgreen}-l", f"{fwhite}username of email (ex. {bcyan}hanzo221{bmagenta}@{bgreen}1secmail.com{resetall} the cyan colored is 'login')"])
table.add_row([f"{fred}--domain", f"{fgreen}-d", f"{fwhite}host of email (ex. {bcyan}hanzo221{bmagenta}@{bgreen}1secmail.com{resetall} the green colored is 'domain')"])
print(table)

def initme():
Expand Down
10 changes: 4 additions & 6 deletions secmail/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
url = "https://www.1secmail.com/api/v1/"

def inbox(login, domain): #id, from, subject, date
resjson = loads(get('https://www.1secmail.com/api/v1/?action=getMessages&login='+login+'&domain='+domain).text)
resjson = loads(get(f"http://1secmail.com/api/v1/?action=getMessages&login={login}&domain={domain}").text)

return resjson

def message(login, domain, id):
resjson = loads(get('https://www.1secmail.com/api/v1/?action=readMessages&login='+login+'&domain='+domain+'&id='+id).text)

return resjson
def mes(login, domain, id):
return get(f"https://www.1secmail.com/api/v1/?action=readMessage&login={login}&domain={domain}&id={id}").text

def attachment(login, domain, id, file):
shell('https://www.1secmail.com/api/v1/?action=download&login='+login+'&domain='+domain+'&id='+id+'&file='+file)
shell('http://1secmail.com/api/v1/?action=download&login='+login+'&domain='+domain+'&id='+id+'&file='+file)

0 comments on commit f4bef06

Please sign in to comment.