-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.go
76 lines (58 loc) · 1.82 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
package main
import (
"fmt"
"log"
"github.com/integrii/flaggy"
)
var version = "0.0.1"
func init() {
flaggy.SetName("evertoken")
flaggy.SetDescription("Extract authentication token from Evernote.")
flaggy.SetVersion(version)
flaggy.DefaultParser.AdditionalHelpPrepend = "https://github.com/vzhd1701/evertoken"
}
func main() {
var exbPath, exbPass string
exbBruteStart := int64(-1)
subcmdNew := flaggy.NewSubcommand("new")
subcmdNew.Description = "Extract token from new Evernote app."
subcmdLegacy := flaggy.NewSubcommand("legacy")
subcmdLegacy.Description = "Extract token from legacy Evernote app."
subcmdLegacyEXB := flaggy.NewSubcommand("legacy-exb")
subcmdLegacyEXB.Description = "Extract token from EXB database file."
subcmdLegacyEXB.AddPositionalValue(&exbPath, "exb", 1, true, "EXB database file path.")
subcmdLegacyEXB.String(&exbPass, "p", "password", "Password to decrypt token data, numeric volume serial.")
subcmdLegacyEXB.Int64(&exbBruteStart, "b", "brute", "Brute force password start number, use either this or password option.")
flaggy.AttachSubcommand(subcmdNew, 1)
flaggy.AttachSubcommand(subcmdLegacy, 1)
flaggy.AttachSubcommand(subcmdLegacyEXB, 1)
flaggy.Parse()
var Users []User
switch {
case subcmdNew.Used:
Users = newGetUsers()
case subcmdLegacy.Used:
Users = legacyGetUsers()
case subcmdLegacyEXB.Used:
Users = append(Users, exbGetUser(exbPath, exbPass, exbBruteStart))
default:
flaggy.ShowHelpAndExit("")
}
if len(Users) == 0 {
fmt.Println("No users found! Make sure Evernote is installed, and there are logged-in users.")
return
}
for _, user := range Users {
printUser(user)
}
}
func panicFail(err error) {
if err != nil {
log.Panic(fmt.Errorf("[ERROR] %w", err))
}
}
func expectedFail(err error) {
if err != nil {
log.Fatal(fmt.Errorf("[ERROR] %w", err))
}
}