The idea I have is to make a netcat server, and when you connect to it, the server runs a python script with which the user can interact. So for example the script asks for a number, and it outputs that number to the power of 3. How can you do that? How do you run a program and redirect the output to the connected user and make them able to interact with it in real time?
$ nc 192.168.1.13 Input a number: 2 8 (end)
print(str(int(input("Input a number: "))**3))