def verify(self, h): """ Attempt to verify the current file. """ CrawlConfig.log("hsi(%d) attempting to verify %s" % (h.pid(), self.path)) rsp = h.hashverify(self.path) if "TIMEOUT" in rsp or "ERROR" in rsp: rval = "skipped" self.set('fails', self.fails + 1) CrawlConfig.log( "hashverify transfer incomplete on %s -- skipping" % self.path) h.quit() elif "%s: (md5) OK" % self.path in rsp: rval = "matched" CrawlConfig.log("hashverify matched on %s" % self.path) elif "no valid checksum found" in rsp: if self.addable(self.cos): rval = self.add_to_sample(h) else: self.set('checksum', 0) rval = "skipped" CrawlConfig.log("hashverify skipped %s" % self.path) else: rval = Alert.Alert("Checksum mismatch: %s" % rsp) CrawlConfig.log("hashverify generated 'Checksum mismatch' " + "alert on %s" % self.path) return rval
def __init__(self, conn_d_id, _user='******'): self.conn_d_id = conn_d_id self.user = _user self.alert = Alert() """ Read database to get full details of device with conn_d_id = self.conn_d_id Then assign the values appropriately below """ self.getAppData() if self.boardID == 2: if self.appliance == "Motion Detector": GPIO.setup(int(self.pin), GPIO.IN) else: GPIO.setup(int(self.pin), GPIO.OUT)
def Init(): global ScriptSettings ScriptSettings = Settings(SettingsFile) ScriptSettings.Save(SettingsFile) global BanWordReward BanWordReward = BanWord.BanWord(ScriptName, Parent, ScriptSettings.EnableDebug) global CountdownReward CountdownReward = Countdown.Countdown(ScriptName, Parent, ScriptSettings.EnableDebug) global AlertReward AlertReward = Alert.Alert(ScriptName, Parent, ScriptSettings.EnableDebug) return
def __init__(self): threading.Thread.__init__(self) self.MATRIX = [ [1,2,3,'A'], [4,5,6,'B'], [7,8,9,'C'], ['*',0,'#','D'] ] self.ROW = [6,5,11,9] self.COL = [10,22,27,17] self.password = "" # this will store current entered password self.authenticated = False self.GPIOPin = "" self.alert = Alert() self.command = "Enter password:" for j in range(4): GPIO.setup(self.COL[j], GPIO.OUT) GPIO.output(self.COL[j],1) for i in range(4): GPIO.setup(self.ROW[i], GPIO.IN, pull_up_down = GPIO.PUD_UP)
def lambda_handler(event, context): dataModel = event alert = Alert.Alert(dataModel) s3 = S3.S3() resultList = [] if dataModel["config"]["initObject"]: resultList.append(alert.backgroundObjectRegister()) backgroundEvent = s3.readJson("backgroundEvent.json") lastNotificationTimestamp = s3.readJson("lastNotificationTimestamp.json") result = alert.cameraCoveredDetect(lastNotificationTimestamp, backgroundEvent) if result is not None: resultList.append(result) backgroundObjectList = s3.readJson("backgroundObjectList.json") result = alert.cameraMovedDetect(lastNotificationTimestamp, backgroundEvent, backgroundObjectList) if result is not None: resultList.append(result) result = alert.backgroundObjectLostDetect(backgroundObjectList, backgroundEvent) if result is not None: resultList.append(result) result = alert.abnormalObjectStayDetect(backgroundObjectList, backgroundEvent) if result is not None: resultList.append(result) dataModel["result"] = resultList return dataModel
print systemInfo.processInfo_mem if __name__ == '__main__': # config setter config = Configure.Configure('./config.xml') # log file logFileName = time.strftime('%Y-%m-%d', time.localtime(time.time())) logger = Loger.Loger('Monitor-' + logFileName + '.log') # system info get systemInfo = SystemInfo.SystemInfo(pids=None, processName=None) # alert center alertcenter = Alert.Alert() # process names processNames = [] # email info mailInfo = None receiver = [] # alert limit define # region # alert limit configure cpuAlertCount = int(systemInfo.cpu_wait_time) cpuAlertCounter = 0