-
Notifications
You must be signed in to change notification settings - Fork 235
/
log.go
69 lines (63 loc) · 1.4 KB
/
log.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
package pkg
import (
"fmt"
"github.com/logrusorgru/aurora"
"github.com/projectdiscovery/gologger"
"os"
"strings"
)
var NoColor bool
var Output = ""
func GoPocLog(log string) {
builder := &strings.Builder{}
builder.WriteString("[")
if !NoColor {
builder.WriteString(aurora.BrightRed("GoPOC").String())
} else {
builder.WriteString("GoPOC")
}
builder.WriteString("] ")
builder.WriteString(log)
fmt.Print(builder.String())
if Output != "" {
writeoutput(builder.String())
}
}
func YmlPocLog(log string) {
builder := &strings.Builder{}
builder.WriteString("[")
if !NoColor {
builder.WriteString(aurora.BrightRed("YmlPOC").String())
} else {
builder.WriteString("YmlPOC")
}
builder.WriteString("] ")
builder.WriteString(log)
fmt.Print(builder.String())
if Output != "" {
writeoutput(builder.String())
}
}
func BurteLog(log string) {
builder := &strings.Builder{}
builder.WriteString("[")
if !NoColor {
builder.WriteString(aurora.BrightRed("Brute").String())
} else {
builder.WriteString("Brute")
}
builder.WriteString("] ")
builder.WriteString(log)
fmt.Print(builder.String())
if Output != "" {
writeoutput(builder.String())
}
}
func writeoutput(log string) {
f, err := os.OpenFile(Output, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
if err != nil {
gologger.Fatal().Msgf("Could not create output fiale '%s': %s\n", Output, err)
}
defer f.Close() //nolint
f.WriteString(log)
}