def render_text(self, outfd, data): linux_common.set_plugin_members(self) self.edir = self._config.DUMP_DIR if not self.edir: debug.error("No output directory given.") if not os.path.isdir(self.edir): debug.error(self.edir + " is not a directory") for task in linux_netstat.linux_netstat(self._config).calculate(): sfop = task.obj_vm.profile.get_symbol("socket_file_ops") dfop = task.obj_vm.profile.get_symbol("sockfs_dentry_operations") for (filp, fdnum) in task.lsof(): if filp.f_op == sfop or filp.dentry.d_op == dfop: iaddr = filp.dentry.d_inode skt = task.SOCKET_I(iaddr) sk = skt.sk for msg in self.process_queue("receive", task.pid, fdnum, sk.sk_receive_queue): outfd.write(msg + "\n") for msg in self.process_queue("write", task.pid, fdnum, sk.sk_write_queue): outfd.write(msg + "\n")
def render_text(self, outfd, data): linux_common.set_plugin_members(self) self.edir = self._config.DUMP_DIR if not self.edir: debug.error("No output directory given.") if not os.path.isdir(self.edir): debug.error(self.edir + " is not a directory") for task in linux_netstat.linux_netstat(self._config).calculate(): sfop = task.obj_vm.profile.get_symbol("socket_file_ops") dfop = task.obj_vm.profile.get_symbol("sockfs_dentry_operations") for (filp, fdnum) in task.lsof(): if filp.f_op == sfop or filp.dentry.d_op == dfop: iaddr = filp.dentry.d_inode skt = task.SOCKET_I(iaddr) sk = skt.sk for msg in self.process_queue( "receive", task.pid, fdnum, sk.sk_receive_queue): outfd.write(msg + "\n") for msg in self.process_queue( "write", task.pid, fdnum, sk.sk_write_queue): outfd.write(msg + "\n")
def get_IO_conns(plugin_obj): #setup for passing obj to outside plugin plugin_conf = conf.ConfObject() plugin_conf.PROFILE = plugin_obj._config.PROFILE common.set_plugin_members(plugin_obj) net_plugin = linux_netstat.linux_netstat(plugin_conf) data = net_plugin.calculate() filtered_conns = Open_plc_modbusTCP.filter_for_targets(plugin_obj, data) return filtered_conns
def calculate(self): linux_common.set_plugin_members(self) self.edir = self._config.DUMP_DIR if not self.edir: debug.error("No output directory given.") if not os.path.isdir(self.edir): debug.error(self.edir + " is not a directory") for (task, fd_num, inet_sock) in linux_netstat.linux_netstat(self._config).calculate(): sk = inet_sock.sk for msg in self.process_queue("receive", task.pid, fd_num, sk.sk_receive_queue): yield msg for msg in self.process_queue("write", task.pid, fd_num, sk.sk_write_queue): yield msg
def calculate(self): linux_common.set_plugin_members(self) self.edir = self._config.DUMP_DIR if not self.edir: debug.error("No output directory given.") if not os.path.isdir(self.edir): debug.error(self.edir + " is not a directory") for (task, fd_num, inet_sock) in linux_netstat.linux_netstat( self._config).calculate(): sk = inet_sock.sk for msg in self.process_queue("receive", task.pid, fd_num, sk.sk_receive_queue): yield msg for msg in self.process_queue("write", task.pid, fd_num, sk.sk_write_queue): yield msg