2021-12-29 17:08:30 +00:00
|
|
|
package util
|
|
|
|
|
|
|
|
import (
|
2022-01-08 15:48:19 +00:00
|
|
|
"flag"
|
2022-01-10 14:58:27 +00:00
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/pterm/pterm"
|
2021-12-29 17:08:30 +00:00
|
|
|
)
|
|
|
|
|
2022-07-24 02:20:23 +00:00
|
|
|
func ParseArgs() (string, int, string, bool, bool) {
|
2022-05-08 05:39:35 +00:00
|
|
|
addr := flag.String("addr", "127.0.0.1", "Listen addr")
|
2022-05-13 09:49:05 +00:00
|
|
|
port := flag.Int("port", 8080, "port")
|
2022-01-08 15:48:19 +00:00
|
|
|
dns := flag.String("dns", "8.8.8.8", "DNS server")
|
|
|
|
debug := flag.Bool("debug", false, "true | false")
|
2022-07-24 02:20:23 +00:00
|
|
|
banner := flag.Bool("banner", true, "true | false")
|
2022-01-08 15:48:19 +00:00
|
|
|
|
|
|
|
flag.Parse()
|
2022-01-03 07:24:39 +00:00
|
|
|
|
2022-07-24 02:20:23 +00:00
|
|
|
return *addr, *port, *dns, *debug, *banner
|
2022-01-03 07:24:39 +00:00
|
|
|
}
|
2022-01-03 15:13:42 +00:00
|
|
|
|
2022-07-24 02:20:23 +00:00
|
|
|
func PrintColoredBanner(addr string, port int, dns string, debug bool) {
|
2022-01-10 14:58:27 +00:00
|
|
|
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{
|
2022-05-08 05:39:35 +00:00
|
|
|
{Level: 0, Text: "ADDR : " + addr},
|
2022-05-13 09:49:05 +00:00
|
|
|
{Level: 0, Text: "PORT : " + fmt.Sprint(port)},
|
2022-01-10 14:58:27 +00:00
|
|
|
{Level: 0, Text: "DNS : " + dns},
|
|
|
|
{Level: 0, Text: "DEBUG : " + fmt.Sprint(debug)},
|
|
|
|
}).Render()
|
|
|
|
}
|
2022-07-24 02:20:23 +00:00
|
|
|
|
|
|
|
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("")
|
|
|
|
}
|