Пример #1
0
 def handle_memtrace(self, event):
     eip = PyFlxInstrument.registers()["eip"]
     if event.writes:
         self.log("Write: 0x%x , Addr: 0x%x, BBL: 0x%x" %
                  (event.value, event.addr, eip))
     else:
         self.log("Read:  0x%x , Addr: 0x%x, BBL: 0x%x" %
                  (event.value, event.addr, eip))
Пример #2
0
	def __init__(self, fromaddr, toaddr, nextaddr, process):
		self.fromaddr = fromaddr
		self.toaddr   = toaddr
		self.nextaddr = nextaddr
		self.process = process

		self.entrystate = PyFlxInstrument.registers()
		self.exitstate = None
		self.return_callbacks = []

		self.dllname = None
		self.name = None
Пример #3
0
	def handle_syscall(self, syscall):
		# NtCreateThread
		syscall_name = syscalls.getSyscallByNumber(syscall.number)
		if syscall_name is not None:
			if syscall_name == "NtTerminateProcess":
				self.os.terminating_processes.append((self,PyFlxInstrument.registers()["cr3"]))
				self.log(syscall_name)
				self.thread.terminate()
				self.logger.shutdown(self)
			if syscall_name == "NtCreateThread":
				self.logger.info("Creating Thread")
				self.log(syscall_name)
			if syscall_name == "NtTerminateThread":
				self.logger.info("Thread %d terminated"%self.cur_tid)
				self.log(syscall_name)
				self.thread.terminate()
			if syscall_name == "NtCreateProcess" or syscall_name == "NtCreateProcessEx":
				self.logger.info("New Process has been created by %s"%self.name)
				self.log(syscall_name)
Пример #4
0
 def handle_syscall(self, syscall):
     # NtCreateThread
     syscall_name = syscalls.getSyscallByNumber(syscall.number)
     if syscall_name is not None:
         if syscall_name == "NtTerminateProcess":
             self.os.terminating_processes.append(
                 (self, PyFlxInstrument.registers()["cr3"]))
             self.log(syscall_name)
             self.thread.terminate()
             self.logger.shutdown(self)
         if syscall_name == "NtCreateThread":
             self.logger.info("Creating Thread")
             self.log(syscall_name)
         if syscall_name == "NtTerminateThread":
             self.logger.info("Thread %d terminated" % self.cur_tid)
             self.log(syscall_name)
             self.thread.terminate()
         if syscall_name == "NtCreateProcess" or syscall_name == "NtCreateProcessEx":
             self.logger.info("New Process has been created by %s" %
                              self.name)
             self.log(syscall_name)
Пример #5
0
 def caballero_enable(self, min_icount, threshold):
     PyFlxInstrument.caballero_enable(min_icount, threshold)
Пример #6
0
	def vmem_read(self, n):
		return PyFlxInstrument.vmem_read(n, 4096)
Пример #7
0
 def filter_filtered(self, addr):
     return PyFlxInstrument.filtered(addr)
Пример #8
0
 def filter_add(self, start, stop):
     PyFlxInstrument.filter_add(start, stop)
Пример #9
0
	def caballero_disable(self):
		PyFlxInstrument.caballero_disable()
Пример #10
0
	def set_context(self, pid, tid):
		PyFlxInstrument.set_context(pid, tid)
Пример #11
0
 def functionentropy_enable(self, threshold):
     PyFlxInstrument.functionentropy_enable(threshold)
Пример #12
0
	def filter_del(self, start, end):
		PyFlxInstrument.filter_del(start, stop)
Пример #13
0
 def functiontrace_disable(self):
     PyFlxInstrument.functiontrace_disable()
Пример #14
0
 def set_context(self, pid, tid):
     PyFlxInstrument.set_context(pid, tid)
Пример #15
0
 def arithwindow_disable(self):
     PyFlxInstrument.arithwindow_disable()
Пример #16
0
 def arithwindow_enable(self, window_size, threshold):
     PyFlxInstrument.arithwindow_enable(window_size, threshold)
Пример #17
0
 def caballero_disable(self):
     PyFlxInstrument.caballero_disable()
Пример #18
0
	def memtrace_disable(self):
		PyFlxInstrument.memtrace_disable()
Пример #19
0
 def functionentropy_disable(self):
     PyFlxInstrument.functionentropy_disable()
Пример #20
0
	def filter_disable(self):
		PyFlxInstrument.filter_disable()
Пример #21
0
 def codesearch_enable(self):
     PyFlxInstrument.codesearch_enable()
Пример #22
0
	def bbltrace_disable(self):
		PyFlxInstrument.bbltrace_disable()
Пример #23
0
 def constsearch_pattern(self, pattern):
     PyFlxInstrument.constsearch_pattern(pattern)
Пример #24
0
	def arithwindow_disable(self):
		PyFlxInstrument.arithwindow_disable()
Пример #25
0
 def constsearch_disable(self):
     PyFlxInstrument.constsearch_disable()
Пример #26
0
	def functionentropy_disable(self):
		PyFlxInstrument.functionentropy_disable()
Пример #27
0
	def syscall_hook(self, number):
		PyFlxInstrument.syscall_hook(number)
Пример #28
0
	def breakpoint_insert(self, addr):
		PyFlxInstrument.breakpoint_insert(addr)
Пример #29
0
	def dump_enable(self, path):
		PyFlxInstrument.dump_enable(path)
Пример #30
0
 def constsearch_search(self):
     PyFlxInstrument.constsearch_search()
Пример #31
0
 def bbltrace_disable(self):
     PyFlxInstrument.bbltrace_disable()
Пример #32
0
	def deactivate(self):
		PyFlxInstrument.set_instrumentation_active(0)
Пример #33
0
 def breakpoint_insert(self, addr):
     PyFlxInstrument.breakpoint_insert(addr)
Пример #34
0
	def dump_disable(self):
		PyFlxInstrument.dump_disable()
Пример #35
0
 def breakpoint_delete(self, addr):
     PyFlxInstrument.breakpoint_delete(addr)
Пример #36
0
	def read_process(self, process, address, len):
		try:
			return PyFlxInstrument.vmem_read_process(process.cr3, address, len)
		except RuntimeError:
			return None
Пример #37
0
 def addBreakpoint(self, addr, handler):
     if not self.has_key(addr):
         self[addr] = set([])
         PyFlxInstrument.breakpoint_insert(addr)
     self[addr].add(handler)
Пример #38
0
	def retranslate(self):
		PyFlxInstrument.retranslate()
Пример #39
0
 def register(self, register):
     regs = PyFlxInstrument.registers()
     return regs[register]
Пример #40
0
	def filter_add(self, start, stop):
		PyFlxInstrument.filter_add(start, stop)
Пример #41
0
 def creg(self, register):
     return PyFlxInstrument.creg(register)
Пример #42
0
	def filter_filtered(self, addr):
		return PyFlxInstrument.filtered(addr)
Пример #43
0
 def eip(self):
     return PyFlxInstrument.eip()
Пример #44
0
	def caballero_enable(self, min_icount, threshold):
		PyFlxInstrument.caballero_enable(min_icount, threshold)
Пример #45
0
 def genreg(self, index):
     return PyFlxInstrument.genreg(index)
Пример #46
0
	def arithwindow_enable(self, window_size, threshold):
		PyFlxInstrument.arithwindow_enable(window_size, threshold)
Пример #47
0
 def delBreakpoint(self, addr, handler):
     for addr, hash in self.items():
         if not self[addr].isdisjoint([handler]):
             self[addr] = self[addr] - set([handler])
         if len(self[addr]) == 0:
             PyFlxInstrument.breakpoint_delete(addr)
Пример #48
0
	def functiontrace_disable(self):
		PyFlxInstrument.functiontrace_disable()
Пример #49
0
	def constsearch_pattern(self, pattern):
		PyFlxInstrument.constsearch_pattern(pattern)
Пример #50
0
	def functionentropy_enable(self, threshold):
		PyFlxInstrument.functionentropy_enable(threshold)
Пример #51
0
	def activate(self, pid, tid, procname):
		PyFlxInstrument.set_instrumentation_active(1)
		PyFlxInstrument.set_context(pid,tid, str(procname))
Пример #52
0
	def codesearch_enable(self):
		PyFlxInstrument.codesearch_enable()
Пример #53
0
 def filter_del(self, start, end):
     PyFlxInstrument.filter_del(start, stop)
Пример #54
0
	def constsearch_disable(self):
		PyFlxInstrument.constsearch_disable()
Пример #55
0
	def doReturn(self):
		self.exitstate = PyFlxInstrument.registers()
		for callback in self.return_callbacks:
			callback(self)
Пример #56
0
	def constsearch_search(self):
		PyFlxInstrument.constsearch_search()
Пример #57
0
	def retval(self):
		self.exitstate = PyFlxInstrument.registers()
		return self.exitstate["eax"]
Пример #58
0
	def breakpoint_delete(self, addr):
		PyFlxInstrument.breakpoint_delete(addr)
Пример #59
0
 def filter_disable(self):
     PyFlxInstrument.filter_disable()