Skip to content

IroN404/SAE-3.02-Surveillance-Postes-Clients-ou-serveurs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Sans-titre-3
SAE-3.02-Surveillance-Postes-Clients-ou-serveurs

A Python based GUI app made with PyQt to monitor a server's resources and send commands to it.

Key FeaturesRequirementsInstallationServer Side UsageClient Side UsageLicense

Key Features

  • Monitor a server's resources
  • Send commands to the server
  • Save the server's ip and port in a csv file
  • Connect to a server by entering its ip and port
  • Connect to a server by choosing it from a list

Requirements

  • Python 3.6
  • pip
  • psutil
  • socket
  • threading
  • PyQt5

Installation

  • Install python 3.x

    You can download it from python.org

  • Install pip

    Usually, pip is automatically installed if you are:

    • working in a virtual environment
    • using Python downloaded from python.org
    • using Python that has not been modified by a redistributor to remove ensurepip

    If pip is not installed, you can install it by running the following command:

    python get-pip.py
  • Install the requirements

pip install -r requirements.txt

Server Side

Usage

python server.py -p <port>

CMD

Options

Option Description
-p Port to use

Then the server will be launched and will wait for clients to connect.

Client Side

Usage

python client.py

In application usage

once the client is launched, you can choose a csv file to use to display server information with the "Choose a file" button. If you don't have a CSV file or want to create a new one, you can directly add a new server by entering its ip and port in the corresponding fields and clicking on the "Add" button. It will automatically create a new CSV file called "servers.csv" in the actual directory and add the server to it.

After that, you can choose a server to connect to in the list, and connect to it by double-clicking it in the list.

You can add a server to the list by enterings the correpondings information in the fields above the list, then you can click on the "Add" button to add the new server to the list.

Capture-d-cran-2023-01-03-08-48-06

Once connected, you can send a command to the server by entering it in the "Command" field and pressing enter key.

Capture-d-cran-2023-01-03-08-50-18

Here is a list of the predifined commands that can be sent to the server:

Command Description
help Display the list of commands
os Retrieve the server OS and version
cpu Retrieve the server CPU usage in percent
ram Retrieve the different server RAM usage in percent
hostname Retrieve the server hostname
ip Retrieve the server IP address
python --version Retrieve the server python version
ping Ping the server
clear Clear the terminal
disconnect Disconnect from the server
connection information Retrieve the server's ip and name
kill Kill the server
reset Reset the server
exit Disconnect from the server

There are commands specific to the os of the server:

In case of an incorrect command, the server will return an error message to the client containing the specific error. The commons errors are:

Error Description
Command not found The command is not recognized by the server
This command is only available on The command is only available on a specific os
Server is not connected The server is not connected to the client
Server is not responding The server is not responding to the client
For windows (Some examples)):
Command Description
DOS:dir Retrieve the list of files and folders in the current directory
DOS:mkdir Create a folder in the current directory
DOS:cd Change the current directory
DOS:del Delete a file in the current directory
DOS:rd Delete a folder in the current directory
powershell: get-process Retrieve the list of processes running on the server
powershell: stop-process Stop a process running on the server
For linux (Some examples)):
Command Description
linux: ls Retrieve the list of files and folders in the current directory
linux: rm Delete a file in the current directory
linux: rmdir Delete a folder in the current directory