scanner le fix hardcoded ips
This commit is contained in:
parent
df68d8fa9d
commit
3f82212d27
BIN
server/src/__debug_bin
Executable file
BIN
server/src/__debug_bin
Executable file
Binary file not shown.
@ -86,9 +86,21 @@ func main() {
|
|||||||
}
|
}
|
||||||
defer outconn.Close()
|
defer outconn.Close()
|
||||||
recvBuf := make([]byte, 1024)
|
recvBuf := make([]byte, 1024)
|
||||||
outconn.Write([]byte("showtime"))
|
_, err2 := outconn.Write([]byte("showtime"))
|
||||||
outconn.Read(recvBuf)
|
if err2 != nil {
|
||||||
conn.Write(recvBuf)
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
_, err3 := outconn.Read(recvBuf)
|
||||||
|
if err3 != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
_, err4 := conn.Write(recvBuf)
|
||||||
|
if err4 != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if resp == "quit" {
|
if resp == "quit" {
|
||||||
|
@ -17,20 +17,20 @@ func scan() []string {
|
|||||||
ipv4 = ipv4.To4()
|
ipv4 = ipv4.To4()
|
||||||
ipv4 = ipv4.Mask(ipv4.DefaultMask())
|
ipv4 = ipv4.Mask(ipv4.DefaultMask())
|
||||||
ipv4[3]++
|
ipv4[3]++
|
||||||
// for i := 1; i < 2; i++ {
|
for i := 1; i < 2; i++ {
|
||||||
// _, dialErr := net.DialTimeout("tcp", ipv4.String()+":8081", time.Duration(1)*time.Second)
|
_, dialErr := net.DialTimeout("tcp", ipv4.String()+":8081", time.Duration(1)*time.Second)
|
||||||
_, dialErr := net.DialTimeout("tcp", "192.168.0.100:8081", time.Duration(1)*time.Second)
|
// _, dialErr := net.DialTimeout("tcp", "192.168.0.100:8081", time.Duration(1)*time.Second)
|
||||||
if dialErr != nil {
|
if dialErr != nil {
|
||||||
// fmt.Println("Cannot connect to " + ipv4.String())
|
fmt.Println("Cannot connect to " + ipv4.String())
|
||||||
fmt.Println("Cannot connect to " + "192.168.0.100:8081")
|
// fmt.Println("Cannot connect to " + "192.168.0.100:8081")
|
||||||
} else {
|
} else {
|
||||||
// fmt.Println("Response from " + ipv4.String())
|
fmt.Println("Response from " + ipv4.String())
|
||||||
fmt.Println("Response from " + "192.168.0.100:8081")
|
// fmt.Println("Response from " + "192.168.0.100:8081")
|
||||||
// information = append(information, ipv4.String())
|
information = append(information, ipv4.String())
|
||||||
information = append(information, "192.168.0.100:8081")
|
// information = append(information, "192.168.0.100:8081")
|
||||||
|
}
|
||||||
|
ipv4[3]++
|
||||||
}
|
}
|
||||||
ipv4[3]++
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user