diff --git a/test/images/agnhost/README.md b/test/images/agnhost/README.md index ee70887f063..7fc63a75753 100644 --- a/test/images/agnhost/README.md +++ b/test/images/agnhost/README.md @@ -417,6 +417,8 @@ It will also start a UDP server on the indicated UDP port that responds to the f - `echo `: Returns the given `` - `clientip`: Returns the request's IP address +The UDP server can be disabled by setting `--udp-port -1`. + Additionally, if (and only if) `--sctp-port` is passed, it will start an SCTP server on that port, responding to the same commands as the UDP server. diff --git a/test/images/agnhost/VERSION b/test/images/agnhost/VERSION index f3283c08e18..cc08e06b66f 100644 --- a/test/images/agnhost/VERSION +++ b/test/images/agnhost/VERSION @@ -1 +1 @@ -2.33 +2.34 diff --git a/test/images/agnhost/netexec/netexec.go b/test/images/agnhost/netexec/netexec.go index 18619b4f502..4c9faa60413 100644 --- a/test/images/agnhost/netexec/netexec.go +++ b/test/images/agnhost/netexec/netexec.go @@ -106,12 +106,14 @@ will be upgraded to HTTPS. The image has default, "localhost"-based cert/privkey If "--http-override" is set, the HTTP(S) server will always serve the override path & options, ignoring the request URL. -It will also start a UDP server on the indicated UDP port that responds to the following commands: +It will also start a UDP server on the indicated UDP port and addresses that responds to the following commands: - "hostname": Returns the server's hostname - "echo ": Returns the given - "clientip": Returns the request's IP address +The UDP server can be disabled by setting --udp-port to -1. + Additionally, if (and only if) --sctp-port is passed, it will start an SCTP server on that port, responding to the same commands as the UDP server. `, @@ -168,14 +170,19 @@ func main(cmd *cobra.Command, args []string) { addRoutes(http.DefaultServeMux, exitCh) } - udpBindTo, err := parseAddresses(udpListenAddresses) - if err != nil { - log.Fatal(err) + // UDP server + if udpPort != -1 { + udpBindTo, err := parseAddresses(udpListenAddresses) + if err != nil { + log.Fatal(err) + } + + for _, address := range udpBindTo { + go startUDPServer(address, udpPort) + } } - for _, address := range udpBindTo { - go startUDPServer(address, udpPort) - } + // SCTP server if sctpPort != -1 { go startSCTPServer(sctpPort) }