Skip to content

Commit 96a382e

Browse files
author
atcuno
committed
Further type information
1 parent 857cd8d commit 96a382e

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

volatility3/framework/plugins/windows/hollowprocesses.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
33
#
44
import logging
5-
from typing import NamedTuple, Dict
5+
from typing import NamedTuple, Dict, Generator
66

77
from volatility3.framework import interfaces, exceptions, constants
88
from volatility3.framework import renderers
@@ -137,7 +137,7 @@ def _get_image_base(self, proc: interfaces.objects.ObjectInterface) -> int:
137137
except exceptions.InvalidAddressException:
138138
return None
139139

140-
def _check_load_address(self, proc, _, __):
140+
def _check_load_address(self, proc, _, __) -> Generator[str, None, None]:
141141
"""
142142
Detects when the image base in the PEB, which is writable by process malware,
143143
does not match the section base address - whose value lives in kernel memory.
@@ -150,7 +150,9 @@ def _check_load_address(self, proc, _, __):
150150
image_base, proc.SectionBaseAddress
151151
)
152152

153-
def _check_exe_protection(self, proc, vads, __):
153+
def _check_exe_protection(
154+
self, proc, vads: Dict[int, VadData], __
155+
) -> Generator[str, None, None]:
154156
"""
155157
Legitimately mapped application executables and DLLs
156158
will have a VAD present and its initial protection will be
@@ -172,7 +174,9 @@ def _check_exe_protection(self, proc, vads, __):
172174
vads[base].protection, base, vads[base].path
173175
)
174176

175-
def _check_dlls_protection(self, _, vads, dlls):
177+
def _check_dlls_protection(
178+
self, _, vads: Dict[int, VadData], dlls: Dict[int, DLLData]
179+
) -> Generator[str, None, None]:
176180
for dll_base in dlls:
177181
# could be malicious but triggers too many FPs from smear
178182
if dll_base not in vads:
@@ -192,9 +196,6 @@ def _generator(self, procs):
192196
]
193197

194198
for proc in procs:
195-
proc_name = utility.array_to_string(proc.ImageFileName)
196-
pid = proc.UniqueProcessId
197-
198199
# smear and/or terminated process
199200
dlls = self._get_dlls_map(proc)
200201
if len(dlls) < 3:
@@ -204,6 +205,9 @@ def _generator(self, procs):
204205
if len(vads) < 5:
205206
continue
206207

208+
proc_name = utility.array_to_string(proc.ImageFileName)
209+
pid = proc.UniqueProcessId
210+
207211
for check in checks:
208212
for note in check(proc, vads, dlls):
209213
yield 0, (

0 commit comments

Comments
 (0)