userın kendi ip si eklendi..

This commit is contained in:
Edip YILDIZ 2017-08-14 11:17:18 +03:00
parent 43961a436f
commit e41d771ed4
3 changed files with 5 additions and 2 deletions

View file

@ -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]

View file

@ -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()

View file

@ -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()),