-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
82 lines (64 loc) · 1.88 KB
/
main.go
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
package main
import (
"errors"
"fmt"
"os"
"time"
"github.com/gookit/color"
"github.com/pterm/pterm"
)
type CheckMail struct {
Id int `json:"id"`
From string `json:"from"`
Subject string `json:"subject"`
Date string `json:"date"`
Attachments []struct {
Filename string `json:"filename"`
ContentType string `json:"contentType"`
Size int `json:"size"`
}
Body string `json:"body"`
Textbody string `json:"textBody"`
}
var mailsResponse []CheckMail
func main() {
red := color.FgRed.Render
info := color.FgLightCyan.Render
pterm.DefaultBox.
WithRightPadding(10).
WithLeftPadding(10).
WithTopPadding(2).
WithBottomPadding(2).
Println(info("Go Disposable email created by AAVision"))
availableDomains, err := getAvailableDomains()
if err != nil {
fmt.Println(err)
return
}
selectedDomain, _ := pterm.DefaultInteractiveSelect.WithDefaultText("Please select a domain").WithOptions(availableDomains).Show()
generatedName := generateRandomString(10)
email, err := createEmail(generatedName, string(selectedDomain))
if err != nil {
fmt.Println(err)
return
}
if _, err := os.Stat(selectedDomain); errors.Is(err, os.ErrNotExist) {
creationError := os.Mkdir(selectedDomain, os.ModePerm)
if creationError != nil {
fmt.Println(err)
return
}
}
clearConsole()
color.Cyan.Println("Your Temporary Email is:", red(email))
color.Cyan.Println("Mailbox content is refreshed automatically every 5 seconds.")
color.Cyan.Println("All Emails are saved in", string(selectedDomain), "folder and", generatedName, "file")
fmt.Println(red("--------------------------------------------------------"))
handleInterrupt(generatedName, string(selectedDomain))
for {
checkMail(generatedName, string(selectedDomain))
toggleMap(mailsResponse)
saveMailsToFile(generatedName, string(selectedDomain))
time.Sleep(5 * time.Second)
}
}