Skip to content

Commit

Permalink
del -ip
Browse files Browse the repository at this point in the history
  • Loading branch information
hktalent committed Aug 20, 2022
1 parent f61eb05 commit 13a7543
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/miekg/dns"
"github.com/sirupsen/logrus"
"gorm.io/gorm"
"log"
"net"
"net/http"
"regexp"
Expand Down Expand Up @@ -377,12 +378,26 @@ func HttpApiServer() {
}
}

func GetOutboundIP() net.IP {
conn, err := net.Dial("udp", "8.8.8.8:80")
if err != nil {
log.Fatal(err)
}
defer conn.Close()

localAddr := conn.LocalAddr().(*net.UDPAddr)

return localAddr.IP
}

func main() {
var ExpiresAt uint64
flag.StringVar(&httpHost, "httpHost", "127.0.0.1:55555", "set ACME http Server ip:port,handle ACME DNS challenges easily,default: 127.0.0.1:55555")
flag.StringVar(&key, "key", "", "use ACME http API Key")
flag.StringVar(&domain, "domain", "51pwn.com,exploit-poc.com", "set domain eg: 51pwn.com")
flag.StringVar(&ip, "ip", "144.34.164.150", "set domain server ip, eg: 222.44.11.3")
//flag.StringVar(&ip, "ip", "144.34.164.150", "set domain server ip, eg: 222.44.11.3")
ip = GetOutboundIP().String()
log.Println("ip == ", ip)
flag.StringVar(&resUrl, "resUrl", "", "Set the Elasticsearch url that accepts dns parsing logs, eg: http://127.0.0.1/dnsRecode")
flag.StringVar(&logLevel, "level", "WARN", "set loglevel, option")
flag.Uint64Var(&ExpiresAt, "ExpiresAt", 120000, "default 120s = 120000")
Expand Down

0 comments on commit 13a7543

Please sign in to comment.