import socket\n\ndef run_server():\n    # create a socket object\n    server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\n    server_ip = "$attackerIp"\n    port = $attackerPort\n\n    # bind the socket to a specific address and port\n    server.bind((server_ip, port))\n    # listen for incoming connections\n    server.listen(0)\n    print(f"Listening on {server_ip}:{port}")\n\n    # accept incoming connections\n    client_socket, client_address = server.accept()\n    print(f"Accepted connection from {client_address[0]}:{client_address[1]}")\n\n    # receive data from the client\n    while True:\n        request = client_socket.recv(1024)\n        request = request.decode("utf-8") # convert bytes to string\n        \n        # if we receive "close" from the client, then we break\n        # out of the loop and close the conneciton\n        if request.lower() == "close":\n            # send response to the client which acknowledges that the\n            # connection should be closed and break out of the loop\n            client_socket.send("closed".encode("utf-8"))\n            break\n\n        print(f"Received: {request}")\n\n        response = "accepted".encode("utf-8") # convert string to bytes\n        # convert and send accept response to the client\n        client_socket.send(response)\n\n    # close connection socket with the client\n    client_socket.close()\n    print("Connection to client closed")\n    # close server socket\n    server.close()\n\n\nrun_server()