stop action added to fifo

This commit is contained in:
Volkan Şahin 2016-07-13 17:32:18 +03:00
parent 74c54fd0f1
commit 3d685cd75e

View file

@ -24,26 +24,28 @@ class Commander(object):
if System.Ahenk.is_running() is True: if System.Ahenk.is_running() is True:
if params[1] == 'clean': if len(params) > 1 and params[1] == 'clean':
print('Ahenk stopping') print('Ahenk stopping')
System.Process.kill_by_pid(int(System.Ahenk.get_pid_number())) System.Process.kill_by_pid(int(System.Ahenk.get_pid_number()))
self.clean() self.clean()
return False return False
elif params[1] == 'login' and len(params) == 5: elif len(params) == 5 and params[1] == 'login':
print('{1} {0}ing'.format(str(params[1]), str(params[2]))) print('{1} {0}ing'.format(str(params[1]), str(params[2])))
data['event'] = params[1] data['event'] = params[1]
data['username'] = params[2] data['username'] = params[2]
data['desktop'] = params[3] data['desktop'] = params[3]
data['display'] = params[4] data['display'] = params[4]
elif len(params) == 3 and params[1] == 'logout':
elif params[1] == 'logout' and len(params) == 3:
print('{1} {0}ing'.format(str(params[1]), str(params[2]))) print('{1} {0}ing'.format(str(params[1]), str(params[2])))
data['event'] = params[1] data['event'] = params[1]
data['username'] = params[2] data['username'] = params[2]
elif params[1] == 'send' and len(params) > 5: elif params[0] == 'stop':
data['event'] = 'stop'
elif len(params) > 5 and params[1] == 'send':
data['event'] = params[1] data['event'] = params[1]
response = {} response = {}
response['timestamp'] = str(datetime.datetime.now().strftime("%d-%m-%Y %I:%M")) response['timestamp'] = str(datetime.datetime.now().strftime("%d-%m-%Y %I:%M"))
@ -75,7 +77,7 @@ class Commander(object):
print('Wrong or missing parameter.(-e|-s|-w parameters are optional) Usage: send -t <task_id> -m|-f <message_content>|<file_path> -e|-s|-w') print('Wrong or missing parameter.(-e|-s|-w parameters are optional) Usage: send -t <task_id> -m|-f <message_content>|<file_path> -e|-s|-w')
return None return None
elif params[2] == '-p' and len(params) > 7: elif len(params) > 7 and params[2] == '-p':
response['responseCode'] = MessageCode.POLICY_PROCESSED.value response['responseCode'] = MessageCode.POLICY_PROCESSED.value
response['type'] = MessageType.POLICY_STATUS.value response['type'] = MessageType.POLICY_STATUS.value
response['policyVersion'] = params[3] response['policyVersion'] = params[3]