diff --git a/opt/ahenk/base/command/command_manager.py b/opt/ahenk/base/command/command_manager.py index d8af143..7196369 100644 --- a/opt/ahenk/base/command/command_manager.py +++ b/opt/ahenk/base/command/command_manager.py @@ -47,6 +47,7 @@ class Commander(object): if len(params) == 6: data['ip'] = params[5] + elif len(params) == 3 and params[1] == 'logout': print('{0} logging out'.format(str(params[2]))) data['event'] = params[1] diff --git a/opt/ahenk/base/command/command_runner.py b/opt/ahenk/base/command/command_runner.py index 220d241..3e19cdd 100644 --- a/opt/ahenk/base/command/command_runner.py +++ b/opt/ahenk/base/command/command_runner.py @@ -61,12 +61,13 @@ class CommandRunner(object): display = json_data['display'] desktop = json_data['desktop'] + ip = None if 'ip' in json_data: ip = json_data['ip'] self.logger.info('login event is handled for user: {0}'.format(username)) - login_message = self.message_manager.login_msg(username) + login_message = self.message_manager.login_msg(username,ip) self.messenger.send_direct_message(login_message) agreement = Agreement() diff --git a/opt/ahenk/base/messaging/messaging.py b/opt/ahenk/base/messaging/messaging.py index 86c7ced..06fece6 100644 --- a/opt/ahenk/base/messaging/messaging.py +++ b/opt/ahenk/base/messaging/messaging.py @@ -64,12 +64,13 @@ class Messaging(object): self.logger.debug('Policy status message was created') return str(json_data) - def login_msg(self, username): + def login_msg(self, username,ip=None): data = dict() data['type'] = 'LOGIN' data['username'] = username data['ipAddresses'] = str(System.Hardware.Network.ip_addresses()).replace('[', '').replace(']', '') data['timestamp'] = Util.timestamp() + data['userIp'] = ip data['hardware.monitors'] = str(System.Hardware.monitors()), data['hardware.screens'] = str(System.Hardware.screens()),