mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-11 12:17:38 +02:00
MultiRegExScanner: Results are always bytes and never strings
This commit is contained in:
@@ -53,7 +53,7 @@ class MultiStringScanner(layers.ScannerInterface):
|
||||
self._patterns.add_pattern(pattern)
|
||||
self._patterns.preprocess()
|
||||
|
||||
def __call__(self, data: bytes, data_offset: int) -> Generator[Tuple[int, Union[str, bytes]], None, None]:
|
||||
def __call__(self, data: bytes, data_offset: int) -> Generator[Tuple[int, bytes], None, None]:
|
||||
"""Runs through the data looking for the needles."""
|
||||
for offset, pattern in self._patterns.search(data):
|
||||
if offset < self.chunk_size:
|
||||
|
||||
@@ -21,8 +21,7 @@ class MultiRegexp(object):
|
||||
raise ValueError("No strings to compile into a regular expression")
|
||||
self._regex = re.compile(b'|'.join(map(re.escape, self._pattern_strings)))
|
||||
|
||||
def search(self, haystack: bytes) \
|
||||
-> Generator[Tuple[int, Union[str, bytes]], None, None]:
|
||||
def search(self, haystack: bytes) -> Generator[Tuple[int, bytes], None, None]:
|
||||
if not isinstance(haystack, bytes):
|
||||
raise TypeError("Search haystack must be a byte string")
|
||||
if not self._regex.pattern:
|
||||
|
||||
Reference in New Issue
Block a user