mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-09 19:27:39 +02:00
Automagic: Handle snappy for windows.
This commit is contained in:
@@ -20,7 +20,23 @@ try:
|
||||
from ctypes import cdll
|
||||
|
||||
# TODO: Find library for windows if needed
|
||||
lib_snappy = cdll.LoadLibrary("libsnappy.so.1")
|
||||
try:
|
||||
# Linux/Mac
|
||||
lib_snappy = cdll.LoadLibrary("libsnappy.so.1")
|
||||
except OSError:
|
||||
lib_snappy = None
|
||||
|
||||
try:
|
||||
if not lib_snappy:
|
||||
# Windows 64
|
||||
lib_snappy = cdll.LoadLibrary("snappy64")
|
||||
except OSError:
|
||||
lib_snappy = None
|
||||
|
||||
if lib_snappy:
|
||||
# Windows 32
|
||||
lib_snappy = cdll.LoadLibrary("snappy32")
|
||||
|
||||
__snappy_uncompress = lib_snappy.snappy_uncompress
|
||||
__snappy_uncompressed_length = lib_snappy.snappy_uncompressed_length
|
||||
|
||||
@@ -29,7 +45,7 @@ except OSError:
|
||||
HAS_SNAPPY = False
|
||||
|
||||
|
||||
class SnappyException(Exception):
|
||||
class SnappyException(exceptions.VolatilityException):
|
||||
pass
|
||||
|
||||
|
||||
@@ -65,9 +81,12 @@ class AVMLLayer(segmented.NonLinearlySegmentedLayer):
|
||||
layer.read(layer.minimum_address, struct.calcsize(header_structure)),
|
||||
)
|
||||
if magic not in [0x4C4D5641] or version != 2:
|
||||
raise exceptions.LayerException("File not completely in AVML format")
|
||||
raise exceptions.LayerException("File not in AVML format")
|
||||
if not HAS_SNAPPY:
|
||||
vollog.warning("AVML file detected, but snappy library could not be found")
|
||||
vollog.warning(
|
||||
"AVML file detected, but snappy library could not be found\n"
|
||||
"Please install the snappy from your distribution or https://google.github.io/snappy/."
|
||||
)
|
||||
raise exceptions.LayerException(
|
||||
"AVML format dependencies not satisfied (snappy)"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user