Skip to content

Commit

Permalink
better i/o
Browse files Browse the repository at this point in the history
  • Loading branch information
5amu committed Jul 5, 2022
1 parent b8cd3c7 commit 35747e8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
16 changes: 8 additions & 8 deletions cmd/dnshunter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
)

func banner() {
fmt.Println("")
fmt.Println(" ·▄▄▄▄ ▐ ▄ .▄▄ · ▄ .▄▄• ▄▌ ▐ ▄ ▄▄▄▄▄▄▄▄ .▄▄▄ ")
fmt.Println(" ██▪ ██ •█▌▐█▐█ ▀. ██▪▐██▪██▌•█▌▐█•██ ▀▄.▀·▀▄ █· ")
fmt.Println(" ▐█· ▐█▌▐█▐▐▌▄▀▀▀█▄██▀▐██▌▐█▌▐█▐▐▌ ▐█.▪▐▀▀▪▄▐▀▀▄ ")
fmt.Println(" ██. ██ ██▐█▌▐█▄▪▐███▌▐▀▐█▄█▌██▐█▌ ▐█▌·▐█▄▄▌▐█•█▌ ")
fmt.Println(" ▀▀▀▀▀• ▀▀ █▪ ▀▀▀▀ ▀▀▀ · ▀▀▀ ▀▀ █▪ ▀▀▀ ▀▀▀ .▀ ▀ ")
fmt.Println(" -by 5amu (https://github.com/5amu)")
fmt.Println("")
common.Banner("")
common.Banner(" ·▄▄▄▄ ▐ ▄ .▄▄ · ▄ .▄▄• ▄▌ ▐ ▄ ▄▄▄▄▄▄▄▄ .▄▄▄ ")
common.Banner(" ██▪ ██ •█▌▐█▐█ ▀. ██▪▐██▪██▌•█▌▐█•██ ▀▄.▀·▀▄ █· ")
common.Banner(" ▐█· ▐█▌▐█▐▐▌▄▀▀▀█▄██▀▐██▌▐█▌▐█▐▐▌ ▐█.▪▐▀▀▪▄▐▀▀▄ ")
common.Banner(" ██. ██ ██▐█▌▐█▄▪▐███▌▐▀▐█▄█▌██▐█▌ ▐█▌·▐█▄▄▌▐█•█▌ ")
common.Banner(" ▀▀▀▀▀• ▀▀ █▪ ▀▀▀▀ ▀▀▀ · ▀▀▀ ▀▀ █▪ ▀▀▀ ▀▀▀ .▀ ▀ ")
common.Banner(" -by 5amu (https://github.com/5amu)")
common.Banner("")
}

func usage() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/dnshunter/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func run(outfile string, nsfile string, domain string) error {
if err != nil {
return err
}
fmt.Println(nameservers)
common.Info(fmt.Sprintf("Using nameservers: %v\n", nameservers))

var results []*output.CheckOutput
for _, check := range internal.CheckList {
Expand Down
35 changes: 22 additions & 13 deletions internal/common/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,31 @@ package common
import "fmt"

const (
CriticalLevel = "critical"
HighLevel = "high"
WarnLevel = "warning"
HeaderLevel = "header"
Reset = "reset"
BannerLevel = "banner"
HighLevel = "high"
WarnLevel = "warning"
HeaderLevel = "header"
Reset = "reset"
InfoLevel = "info"
)

var colors = map[string]string{
"critical": "\033[0;35m", // purple
"high": "\033[0;31m", // red
"warning": "\033[1;33m", // yellow
"low": "\033[0;36m", // cyan
"header": "\033[0;32m", // green
"reset": "\033[0m", // reset
"banner": "\033[0;35m", // purple
"high": "\033[0;31m", // red
"warning": "\033[1;33m", // yellow
"info": "\033[0;36m", // cyan
"header": "\033[0;32m", // green
"reset": "\033[0m", // reset
}

func Warn(s string) string {
return fmt.Sprintf("%v[WARNING]: %v%v", colors[WarnLevel], s, colors[Reset])
func Banner(s string) {
fmt.Printf("%v%v%v\n", colors[BannerLevel], s, colors[Reset])
}

func Info(s string) {
fmt.Printf("%v%v%v\n", colors[InfoLevel], s, colors[Reset])
}

func Warn(s string) {
fmt.Printf("%v[WARNING]: %v%v\n", colors[WarnLevel], s, colors[Reset])
}

0 comments on commit 35747e8

Please sign in to comment.