Linux: Fix ruff errors

This commit is contained in:
Mike Auty
2025-02-19 23:54:15 +00:00
parent 2fa0ce8e5c
commit eb21f89cf3
3 changed files with 10 additions and 8 deletions
@@ -204,9 +204,11 @@ class AbstractNetfilter(ABC):
module_name [str]: Linux kernel module name
hooked [bool]: "True" if the network stack has been hijacked
"""
for netns, net in self.get_net_namespaces():
for netns, network in self.get_net_namespaces():
for proto_idx, proto_name, hook_idx, hook_name in self._proto_hook_loop():
hooks_container = self.get_hooks_container(net, proto_name, hook_name)
hooks_container = self.get_hooks_container(
network, proto_name, hook_name
)
for hook_container in hooks_container:
for hook_ops in self.get_hook_ops(
@@ -311,9 +313,9 @@ class AbstractNetfilter(ABC):
"""
nethead = self.vmlinux.object_from_symbol("net_namespace_list")
symbol_net_name = self.get_symbol_fullname("net")
for net in nethead.to_list(symbol_net_name, "list"):
net_ns_id = net.ns.inum
yield net_ns_id, net
for network in nethead.to_list(symbol_net_name, "list"):
net_ns_id = network.ns.inum
yield net_ns_id, network
def get_hooks_container(self, net, proto_name, hook_name):
"""Returns the data structure used in a specific kernel implementation to store
@@ -73,14 +73,14 @@ class SockHandlers(interfaces.configuration.VersionableInterface):
netdevices_map = {}
nethead = self._vmlinux.object_from_symbol(symbol_name="net_namespace_list")
net_symname = self._vmlinux.symbol_table_name + constants.BANG + "net"
for net in nethead.to_list(net_symname, "list"):
for network in nethead.to_list(net_symname, "list"):
net_device_symname = (
self._vmlinux.symbol_table_name + constants.BANG + "net_device"
)
for net_dev in net.dev_base_head.to_list(net_device_symname, "dev_list"):
if (
isinstance(netns_id, NotAvailableValue)
or net.get_inode() != netns_id
or network.get_inode() != netns_id
):
continue
dev_name = utility.array_to_string(net_dev.name)
@@ -1,5 +1,5 @@
import logging
from typing import Dict, List
from typing import Dict, List, Optional
from volatility3.framework import objects, exceptions, renderers, interfaces, constants
from volatility3.framework.objects import utility