TELE26529 Fall-2019
Assignment III Max Marks[60]
Issue Date: 15-Nov-2019 Due Date: 30-Nov-2019 @ 11:59PM
Concepts: File handling, Exception handling and logging, regular exceptions, TCP socket programming, paramiko, ssh for remote command execution
Q1. Write a Python program that uses TCP to transfer contents of a file to a client application. The client application should send the name of the file to the server and the server should look for the file in local file system and transfer the contents to the client. The client should further save the contents locally.
Make sure all exceptions are appropriately handled. [20 Marks]
Q2. Write a Python program that accepts a file containing the following data:
IP
|
User
|
Password
|
Command list
|
…
|
…
|
…
|
[cmd1, cmd2, cmd3]
|
…
|
…
|
…
|
[cmd1, cmd2, cmd3]
|
…
|
…
|
…
|
[cmd1, cmd2, cmd3]
|
The program should
1. Check if the file exists
2. Read the file line by line
3. Check if IP is reachable
4. Open ssh connection to the IP using username and passwords provided in the file and
5. Finally execute the listed commands on the connection one by one.
You should also, capture the result of execution and display the same on the client machine. All
errors must be logged in a file maintained by the program. [20 Marks]