예제 #1
0
class QueueProcessor():
    def __init__(self):
        l.debug("Worker spawned")
        self.db = DBConnector()

    def _conPrint(self, ev):
        buf = "[{}] {}({}:{}): {}".format(ev.hex_addr, ev.function, ev.pid,
                                          ev.tid, ev.payload)
        l.conPrint(buf, ev.event_time)

    def _fileLog(self, ev):
        l.fileLog(ev.pid, ev.function, ev.payload, ev.event_time)

    def Work(self):
        while True:
            ev = eq.get()
            self._conPrint(ev)
            self._fileLog(ev)
            self.db.ProcessHook(ev)
            sp.addHookedFunc(ev.function, ev.pid, ev.tid)  # send the whole ev
            eq.task_done()