From 117e053751d1cecc2aafcdd09fd79066e5db4c28 Mon Sep 17 00:00:00 2001 From: xvzc Date: Tue, 4 Jan 2022 01:46:16 +0900 Subject: [PATCH] add print welcome --- cmd/spoof-dpi/main.go | 16 ++++++++-------- util/welcome.go | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 util/welcome.go diff --git a/cmd/spoof-dpi/main.go b/cmd/spoof-dpi/main.go index e94689f..ad3f859 100644 --- a/cmd/spoof-dpi/main.go +++ b/cmd/spoof-dpi/main.go @@ -2,11 +2,12 @@ package main import ( "flag" + "log" "os" - "github.com/pterm/pterm" "github.com/xvzc/SpoofDPI/config" "github.com/xvzc/SpoofDPI/proxy" + "github.com/xvzc/SpoofDPI/util" ) func main() { @@ -21,14 +22,13 @@ func main() { os.Exit(1) } - cyan := pterm.NewLettersFromStringWithStyle("Spoof", pterm.NewStyle(pterm.FgCyan)) - purple := pterm.NewLettersFromStringWithStyle("DPI", pterm.NewStyle(pterm.FgLightMagenta)) - pterm.DefaultBigText.WithLetters(cyan, purple).Render() + util.PrintWelcome() - pterm.DefaultBulletList.WithItems([]pterm.BulletListItem{ - {Level: 0, Text: "SRC : " + *src}, - {Level: 0, Text: "DNS : " + *dns}, - }).Render() + err = config.SetOsProxy() + if err != nil { + log.Fatal(err) + os.Exit(1) + } proxy.Start() } diff --git a/util/welcome.go b/util/welcome.go new file mode 100644 index 0000000..0456758 --- /dev/null +++ b/util/welcome.go @@ -0,0 +1,20 @@ +package util + +import ( + "github.com/pterm/pterm" + "github.com/xvzc/SpoofDPI/config" +) + + +func PrintWelcome() { + cyan := pterm.NewLettersFromStringWithStyle("Spoof", pterm.NewStyle(pterm.FgCyan)) + purple := pterm.NewLettersFromStringWithStyle("DPI", pterm.NewStyle(pterm.FgLightMagenta)) + pterm.DefaultBigText.WithLetters(cyan, purple).Render() + + pterm.DefaultBulletList.WithItems([]pterm.BulletListItem{ + {Level: 0, Text: "SOURCE IP : " + config.GetConfig().SrcIp}, + {Level: 0, Text: "SOURCE PORT : " + config.GetConfig().SrcPort}, + {Level: 0, Text: "DNS : " + config.GetConfig().DNS}, + }).Render() + +}