| 
						 
							
							
							
						 
					 | 
				
			
			 | 
			 | 
			
				@@ -1,51 +1,49 @@
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				#!/usr/bin/python3
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import sys
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import json
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import os
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				def usage():
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    pformat = "%-7s%-6s%-10s%-10s%-10s%-10s%-10s%-10s%-10s%-10s%-10s"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sformat = "%-23s%-18s%-16s%-14s%-14s%-12s%-12s"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(pformat %  ('must', 'must', 'optional', 'optional', 'optional', 'optional', 'optional', 'optional', 'optional', 'optional', 'optional'))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(pformat %  ('title', 'body', 'sound', 'icon', 'group', 'copy', 'autoCopy', 'badge', 'url', 'isArchive', 'level'))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(pformat %  ('-', '-', '2.0-alarm', '-', '-', '-', '1', '-', '-', '1', 'active'))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(pformat %  ('-', '-', '1.4-bell', '-', '-', '-', '1', '-', '-', '1', 'timeSensitive'))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(pformat %  ('-', '-', '1.6-bloom', '-', '-', '-', '1', '-', '-', '1', 'passive'))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print("\nThe 'sound' parameter also accepts the following as its value:")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(sformat % ("1.8-healthnotification", "2.6-typewriters", "2.9-newsflash", "1.5-mailsent", "1.5-tiptoes", "4.5-update", "2.9-spell"))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(sformat % ("2.2-multiwayinvitation", "4.5-anticipate", "1.2-telegraph", "0.9-calypso", "1.5-newmail", "1.7-glass", "2.2-choo"))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(sformat % ("1.4-paymentsuccess", "1.5-electronic", "0.7-birdsong", "1.9-descent", "1.3-ladder", "4.5-chime", "1.5-horn"))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(sformat % ("4.7-sherwoodforest", "3.0-gotosleep", "4.2-suspense", "1.5-fanfare", "7.0-minuet", "0.6-shake", "1.9-noir"))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    exit(8)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				def getParams(params):
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if len(params) < 2 or len(params) > 11:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        print('Need at least 2 parameters, and most can have 11 parameters, exiting...')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        exit(99)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    params_dict = {'title': '', 'body': '', 'sound': '', 'icon': '', 'group': 'alert', 'copy': '', 'autocopy': '', 'badge': '', 'url': '', 'isarchive': '1', 'level': 'active'}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    elements = ['title', 'body', 'sound', 'icon', 'group', 'copy', 'autocopy', 'badge', 'url', 'isarchive', 'level', 'ciphertxt', 'device_key']
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    for i in range(len(params)):
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        params_dict[elements[i]] = params[i]
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    params_json = json.dumps(params_dict)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    with open('/opt/scripts/alert/bark/option.json', 'w') as obj_option:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        obj_option.write(params_json)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    os.system('/usr/bin/bash /opt/scripts/alert/bark/ciphertxt.sh')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				def main():
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if len(sys.argv) == 1:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        usage()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    params = sys.argv[1:]
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    getParams(params)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				if __name__ == "__main__":
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    main()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				#!/usr/bin/python3
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import sys
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import json
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import os
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				def usage():
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    pformat = "%-7s%-6s%-10s%-10s%-10s%-10s%-10s%-10s%-10s%-10s%-10s"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sformat = "%-23s%-18s%-16s%-14s%-14s%-12s%-12s"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(pformat %  ('must', 'must', 'optional', 'optional', 'optional', 'optional', 'optional', 'optional', 'optional', 'optional', 'optional'))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(pformat %  ('title', 'body', 'sound', 'icon', 'group', 'copy', 'autoCopy', 'badge', 'url', 'isArchive', 'level'))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(pformat %  ('-', '-', '2.0-alarm', '-', '-', '-', '1', '-', '-', '1', 'active'))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(pformat %  ('-', '-', '1.4-bell', '-', '-', '-', '1', '-', '-', '1', 'timeSensitive'))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(pformat %  ('-', '-', '1.6-bloom', '-', '-', '-', '1', '-', '-', '1', 'passive'))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print("\nThe 'sound' parameter also accepts the following as its value:")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(sformat % ("1.8-healthnotification", "2.6-typewriters", "2.9-newsflash", "1.5-mailsent", "1.5-tiptoes", "4.5-update", "2.9-spell"))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(sformat % ("2.2-multiwayinvitation", "4.5-anticipate", "1.2-telegraph", "0.9-calypso", "1.5-newmail", "1.7-glass", "2.2-choo"))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(sformat % ("1.4-paymentsuccess", "1.5-electronic", "0.7-birdsong", "1.9-descent", "1.3-ladder", "4.5-chime", "1.5-horn"))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    print(sformat % ("4.7-sherwoodforest", "3.0-gotosleep", "4.2-suspense", "1.5-fanfare", "7.0-minuet", "0.6-shake", "1.9-noir"))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    exit(8)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				def getParams(params):
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    params_dict = {'title': '', 'body': '', 'sound': '', 'icon': '', 'group': 'alert', 'copy': '', 'autocopy': '', 'badge': '', 'url': '', 'isarchive': '1', 'level': 'active'}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    elements = ['title', 'body', 'sound', 'icon', 'group', 'copy', 'autocopy', 'badge', 'url', 'isarchive', 'level', 'ciphertxt', 'device_key']
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    for i in range(len(params)):
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        params_dict[elements[i]] = params[i]
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    params_json = json.dumps(params_dict)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    with open('/opt/scripts/alert/bark/option.json', 'w') as obj_option:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        obj_option.write(params_json)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    os.system('/usr/bin/bash /opt/scripts/alert/bark/ciphertxt.sh')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				def main():
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if len(sys.argv) < 3:
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        print('Need at least 2 parameters, and most can have 11 parameters, exiting...')
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        usage()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    params = sys.argv[1:]
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    getParams(params)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				if __name__ == "__main__":
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    main()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						 
							
							
							
						 
					 | 
				
			
			 | 
			 | 
			
				 
 |