def testCode(arguments): code = "" currentAlarmCode = getCurrentAlarmCode() if currentAlarmCode is not None and currentAlarmCode is not "": if "code" in arguments: code = arguments["code"].value if (hashlib.md5(code).hexdigest() != getCurrentAlarmCode()): return (1, code) else: return (3, code) else: return (2, code) else: return (0, code)
def testCode (arguments): code = "" currentAlarmCode = getCurrentAlarmCode() if currentAlarmCode is not None and currentAlarmCode is not "": if "code" in arguments: code = arguments["code"].value if (hashlib.md5(code).hexdigest() != getCurrentAlarmCode()): return (1,code) else: return (3,code) else: return (2,code) else: return (0,code)
#!/usr/bin/env python # @author rouble matta import sys import hashlib sys.path.append('/etc/raspwave/pylib') from SecurityUtils import getCurrentAlarmCode,setAlarmCode from LoggerUtils import setupSecurityLogger import cgi, cgitb cgitb.enable() logger = setupSecurityLogger() print "Content-type: text/html\n\n" currentAlarmCode = getCurrentAlarmCode() if currentAlarmCode is not None and currentAlarmCode is not "": existingCode = "" arguments = cgi.FieldStorage() if "existingcode" in arguments: existingCode = arguments["existingcode"].value if hashlib.md5(existingCode).hexdigest() != currentAlarmCode: print "existingcode does not match with what is set. Cannot update code." sys.exit(1) else: print "No existingcode queryparam specified. Cannot update code." sys.exit(1) code = "" arguments = cgi.FieldStorage() if "code" in arguments:
#!/usr/bin/env python # @author rouble matta import sys import hashlib sys.path.append('/etc/raspwave/pylib') from SecurityUtils import getCurrentAlarmCode, setAlarmCode from LoggerUtils import setupSecurityLogger import cgi, cgitb cgitb.enable() logger = setupSecurityLogger() print "Content-type: text/html\n\n" currentAlarmCode = getCurrentAlarmCode() if currentAlarmCode is not None and currentAlarmCode is not "": existingCode = "" arguments = cgi.FieldStorage() if "existingcode" in arguments: existingCode = arguments["existingcode"].value if hashlib.md5(existingCode).hexdigest() != currentAlarmCode: print "existingcode does not match with what is set. Cannot update code." sys.exit(1) else: print "No existingcode queryparam specified. Cannot update code." sys.exit(1) code = "" arguments = cgi.FieldStorage() if "code" in arguments: