forked from VSRC-Arsenal/cookiemonster-custom
/
messages.go
50 lines (40 loc) · 1.39 KB
/
messages.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
package main
import (
"fmt"
"os"
"github.com/iangcarroll/cookiemonster/pkg/monster"
)
// Say hello!
func sayHello() {
fmt.Println("🍪 CookieMonster", version)
}
// Output a sadder failure message if we cannot decode the cookie.
func failureMessage(message string) {
fmt.Println(ColorRed + "❌ " + message + ColorReset)
os.Exit(1)
}
// Output a nice success message if we decode the cookie.
func keyDiscoveredMessage(cookie *monster.Cookie) {
_, key, decoder := cookie.Result()
if *fileOutput != "" {
var outStr string
if *cookieFlag != "" {
outStr = fmt.Sprintf("%s,,%s,,%s", *cookieFlag, decoder, string(key))
} else if *urlFlag != "" {
outStr = fmt.Sprintf("%s,,%s,,%s", *urlFlag, decoder, string(key))
}
writeOutput(*fileOutput, outStr)
}
if isASCII(string(key)) {
fmt.Printf(ColorGreen+"✅ Success! I discovered the key for this cookie with the %s decoder; it is \"%s\".\n"+ColorReset, decoder, string(key))
} else {
fmt.Printf(ColorGreen+"✅ Success! I discovered the key for this cookie with the %s decoder; it is (in base64): \"%s\"."+ColorReset, decoder, base64Key(key))
}
}
// Output a nice success message if we decode the cookie.
func resignedMessage(out string) {
fmt.Printf(ColorGreen+"✅ I resigned this cookie for you; the new one is: %s\n"+ColorReset, out)
}
func warningMessage(message string) {
fmt.Printf(ColorYellow+"⚠️ %s\n"+ColorReset, message)
}