This script does the following for each port:

  • Creates a socket that listens on the specified port.

  • Waits for an incoming connection.

  • Sends a predefined message to mimic a service banner when a connection is made.

  • Closes the connection.