mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2025-01-19 09:12:19 +00:00
add banner mode off option
This commit is contained in:
parent
5720894017
commit
5eaea37f48
@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
addr, port, dns, debug := util.ParseArgs()
|
||||
addr, port, dns, debug, banner := util.ParseArgs()
|
||||
|
||||
p := proxy.New(addr, port)
|
||||
doh.Init(dns)
|
||||
@ -27,7 +27,11 @@ func main() {
|
||||
FullTimestamp: true,
|
||||
})
|
||||
|
||||
util.PrintWelcome(addr, port, dns, debug)
|
||||
if banner {
|
||||
util.PrintColoredBanner(addr, port, dns, debug)
|
||||
} else {
|
||||
util.PrintSimpleInfo(addr, port, dns, debug)
|
||||
}
|
||||
|
||||
if err := util.SetOsProxy(port); err != nil {
|
||||
log.Fatal(err)
|
||||
|
16
util/util.go
16
util/util.go
@ -7,18 +7,19 @@ import (
|
||||
"github.com/pterm/pterm"
|
||||
)
|
||||
|
||||
func ParseArgs() (string, int, string, bool) {
|
||||
func ParseArgs() (string, int, string, bool, bool) {
|
||||
addr := flag.String("addr", "127.0.0.1", "Listen addr")
|
||||
port := flag.Int("port", 8080, "port")
|
||||
dns := flag.String("dns", "8.8.8.8", "DNS server")
|
||||
debug := flag.Bool("debug", false, "true | false")
|
||||
banner := flag.Bool("banner", true, "true | false")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
return *addr, *port, *dns, *debug
|
||||
return *addr, *port, *dns, *debug, *banner
|
||||
}
|
||||
|
||||
func PrintWelcome(addr string, port int, dns string, debug bool) {
|
||||
func PrintColoredBanner(addr string, port int, dns string, debug bool) {
|
||||
cyan := pterm.NewLettersFromStringWithStyle("Spoof", pterm.NewStyle(pterm.FgCyan))
|
||||
purple := pterm.NewLettersFromStringWithStyle("DPI", pterm.NewStyle(pterm.FgLightMagenta))
|
||||
pterm.DefaultBigText.WithLetters(cyan, purple).Render()
|
||||
@ -30,3 +31,12 @@ func PrintWelcome(addr string, port int, dns string, debug bool) {
|
||||
{Level: 0, Text: "DEBUG : " + fmt.Sprint(debug)},
|
||||
}).Render()
|
||||
}
|
||||
|
||||
func PrintSimpleInfo(addr string, port int, dns string, debug bool) {
|
||||
fmt.Println("")
|
||||
fmt.Println("- ADDR : ", addr)
|
||||
fmt.Println("- PORT : ", port)
|
||||
fmt.Println("- DNS : ", dns)
|
||||
fmt.Println("- DEBUG : ", debug)
|
||||
fmt.Println("")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user