mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-10 03:37:39 +02:00
Merge pull request #1440 from dgmcdona/dgmcdona/network_extensions_attributeerrors
Windows Extensions: Fix potential AttributeErrors
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
import logging
|
||||
import socket
|
||||
from typing import Dict, Tuple, List, Union
|
||||
from typing import Dict, Tuple, List, Union, Optional
|
||||
|
||||
from volatility3.framework import exceptions
|
||||
from volatility3.framework import objects, interfaces
|
||||
@@ -86,19 +86,29 @@ class _TCP_LISTENER(objects.StructType):
|
||||
except exceptions.InvalidAddressException:
|
||||
return None
|
||||
|
||||
def get_owner_pid(self):
|
||||
if self.get_owner().is_valid():
|
||||
if self.get_owner().has_valid_member("UniqueProcessId"):
|
||||
return self.get_owner().UniqueProcessId
|
||||
def get_owner_pid(self) -> Optional[int]:
|
||||
owner = self.get_owner()
|
||||
|
||||
if owner is None:
|
||||
return None
|
||||
|
||||
if owner.is_valid():
|
||||
if owner.has_valid_member("UniqueProcessId"):
|
||||
return owner.UniqueProcessId
|
||||
|
||||
return None
|
||||
|
||||
def get_owner_procname(self):
|
||||
if self.get_owner().is_valid():
|
||||
if self.get_owner().has_valid_member("ImageFileName"):
|
||||
return self.get_owner().ImageFileName.cast(
|
||||
def get_owner_procname(self) -> Optional[str]:
|
||||
owner = self.get_owner()
|
||||
|
||||
if owner is None:
|
||||
return None
|
||||
|
||||
if owner.is_valid():
|
||||
if owner.has_valid_member("ImageFileName"):
|
||||
return owner.ImageFileName.cast(
|
||||
"string",
|
||||
max_length=self.get_owner().ImageFileName.vol.count,
|
||||
max_length=owner.ImageFileName.vol.count,
|
||||
errors="replace",
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user