January 2019
Beginner to intermediate
776 pages
19h 58m
English
Let us define a function that will take a user's login credentials from the Command Prompt and connect to a telnet server.
Upon successful connection, it will send the Unix 'ls' command. Then, it will display the output of the command, for example, listing the contents of a directory.
Listing 6.1 shows the code for a telnet session that executes a Unix command remotely as follows:
#!/usr/bin/env python # Python Network Programming Cookbook, Second Edition -- Chapter - 6 # This program is optimized for Python 3.5.2. # It may run on any other version with/without modifications. # To make it run on Python 2.7.x, needs some changes due to API differences. # Follow the comments inline to make the program work with Python 2. import ...
Read now
Unlock full access