/cnc

A client-server model where the client can execute commands in a terminal on the server's side

Primary LanguageCGNU General Public License v3.0GPL-3.0

Compressed Network Communication

Application to demonstrate what was learned during Operational Systems classes with Herbert Rocha.

This application connects client and server using a socket, and a terminal to the server using a pipe. The client can pass commands to execute on the server's terminal, and then the output will be received by the client. It is similar to a chat app.

Made by Eduardo Henrique, Rosialdo Vidinho and Venícius Jacob.

Table of Contents

Goals

Status Goal Description
Support logging use --log to log to an specified file
Support host change use --host to change default host
Support port change use --port to change default port
Support data compression use --compress to compress data
Support multiple clients

Problems Encountered

Passing SIGINT signal from client to server to kill terminal process in pipe

  • We don't know how to pass the signal, although killing the process is fairly easy;

Solved Problems

  • First command from client always comes with some weird characters

Solution:

We don't know exactly what changed, but it suddenly works. Even though fflush(stdin) is there, it was always there to begin with, so it's weird that now it simply works.

  • Can only read either first or last line from pipe output

Solution:

Change a line to line approach using fgets() to a read the file as a whole approach using fread().

  • Using popen() instead of forking (requested by professor)

Implemented a solution using fork(), pipe() and execl(). To get output from execl, dup2() was used;

Limitations

  • Can't use any command that requests user input, e.g., htop and sudo (if not root);
  • Passing SIGINT signal from client to server to kill terminal process in pipe;
  • There is a limit to the number of clients that the server can support at once.

Presentation

References