Skip to content

Commit

Permalink
add: 支持指定-ip参数为域名
Browse files Browse the repository at this point in the history
  • Loading branch information
XinRoom committed Mar 4, 2023
1 parent c8833c7 commit ee4a70a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/go-portScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,17 @@ func run(c *cli.Context) error {
for _, _ip := range ips {
it, startIp, err := iprange.NewIter(_ip)
if err != nil {
myLog.Fatalf("[error] %s is not ip!\n", _ip)
var iprecords []net.IP
iprecords, _ = net.LookupIP(_ip)
if len(iprecords) > 0 {
_ip = iprecords[0].String()
} else {
myLog.Fatalf("[error] %s is not ip/hostname!\n", _ip)
}
it, startIp, err = iprange.NewIter(_ip)
if err != nil {
myLog.Fatalf("[error] %s is not ip!\n", _ip)
}
}
if firstIp == nil {
firstIp = startIp
Expand Down

0 comments on commit ee4a70a

Please sign in to comment.