mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-11 20:27:38 +02:00
Windows: Typing - Remove type casts, add signature
Removes the needless `int` casts, and adds the return type to the `get_session_id` method signature.
This commit is contained in:
@@ -2,14 +2,14 @@
|
||||
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
|
||||
#
|
||||
import logging
|
||||
from typing import List, Iterable, Generator
|
||||
from typing import Generator, Iterable, List
|
||||
|
||||
from volatility3.framework import exceptions, interfaces, constants, renderers
|
||||
from volatility3.framework import constants, exceptions, interfaces, renderers
|
||||
from volatility3.framework.configuration import requirements
|
||||
from volatility3.framework.renderers import format_hints
|
||||
from volatility3.framework.symbols import intermed
|
||||
from volatility3.framework.symbols.windows.extensions import pe
|
||||
from volatility3.plugins.windows import pslist, pedump
|
||||
from volatility3.plugins.windows import pedump, pslist
|
||||
|
||||
vollog = logging.getLogger(__name__)
|
||||
|
||||
@@ -183,12 +183,10 @@ class Modules(interfaces.plugins.PluginInterface):
|
||||
# stores its session ID at offset 8 as an unsigned long, we
|
||||
# create an unsigned long at that offset and use that
|
||||
# instead.
|
||||
session_id = int(
|
||||
context.object(
|
||||
layer_name=layer_name,
|
||||
object_type=symbol_table + constants.BANG + "unsigned long",
|
||||
offset=proc.Session + 8,
|
||||
)
|
||||
session_id = context.object(
|
||||
layer_name=layer_name,
|
||||
object_type=symbol_table + constants.BANG + "unsigned long",
|
||||
offset=proc.Session + 8,
|
||||
)
|
||||
|
||||
if session_id in seen_ids:
|
||||
|
||||
@@ -797,7 +797,7 @@ class EPROCESS(generic.GenericIntelProcess, pool.ExecutiveObject):
|
||||
|
||||
return renderers.UnreadableValue()
|
||||
|
||||
def get_session_id(self):
|
||||
def get_session_id(self) -> Union[int, interfaces.renderers.BaseAbsentValue]:
|
||||
try:
|
||||
if self.has_member("Session"):
|
||||
if self.Session == 0:
|
||||
@@ -836,7 +836,7 @@ class EPROCESS(generic.GenericIntelProcess, pool.ExecutiveObject):
|
||||
offset=self.Session + 8,
|
||||
absolute=True,
|
||||
)
|
||||
return int(session_id)
|
||||
return session_id
|
||||
|
||||
except exceptions.InvalidAddressException:
|
||||
vollog.log(
|
||||
|
||||
Reference in New Issue
Block a user