Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a threaded echo client / shell program using sockets in C/C++ **READ ENTIRE QUESTION BEFORE ANSWERING** Your problem is to add a nice feature

Write a threaded echo client / shell program using sockets in C/C++
**READ ENTIRE QUESTION BEFORE ANSWERING**
Your problem is to add a "nice" feature to this program to allow a user to start a command-line shell on the host machine. Modify the source code from the lecture so that when the client sends the command "shell" to server, all further commands from the client will be treated as shell commands on the server. Return back to normal operation when the user enters the "exit" command in the client (i.e., return to just echoing output).
You code must support multiple connections to the server. This means that the server has to keep track of multiple sockets: one to listen for new connections and then a socket pair per connection to which you direct output from the server (either echo or standard output from running shell commands).
On the server, the naive approach would be to use the system() system call to execute the command sent from the client. This works but leaves too much information available for a security analyst to detect what program is doing the malicious deeds. Instead, use the code from the previous assignment and have the server code do a fork() and exec() to execute the command on the server. (EXTRA CREDIT: do what you can to mask the parent process id of the child process.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

Describe the new structures for the HRM function. page 676

Answered: 1 week ago