From ed98d453f676072dacac9f3ae343e54bcb17bd2e Mon Sep 17 00:00:00 2001 From: k1nd0ne Date: Thu, 30 Nov 2023 11:50:04 +0100 Subject: [PATCH] Changing requirements + formating --- requirements.txt | 4 +- volatility3/framework/layers/cloudstorage.py | 56 ++++++++++---------- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/requirements.txt b/requirements.txt index 7e1c28595..c05546466 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,5 +18,5 @@ pycryptodome leechcorepyc>=2.4.0 # This is required for memory analysis on a Amazon/MinIO S3 and Google Cloud object storage -gcsfs>=2023.6.0 -s3fs>=2023.6.0 \ No newline at end of file +gcsfs>=2023.1.0 +s3fs>=2023.1.0 \ No newline at end of file diff --git a/volatility3/framework/layers/cloudstorage.py b/volatility3/framework/layers/cloudstorage.py index ce6cdb327..41afa324d 100644 --- a/volatility3/framework/layers/cloudstorage.py +++ b/volatility3/framework/layers/cloudstorage.py @@ -23,35 +23,33 @@ from volatility3.framework.layers import resources vollog = logging.getLogger(__file__) -class S3FileSystemHandler(resources.VolatilityHandler): - if HAS_S3FS: - @classmethod - def non_cached_schemes(cls) -> List[str]: - return ["s3"] +if HAS_S3FS: - @staticmethod - def default_open(req: urllib.request.Request) -> Optional[Any]: - """Handles the request if it's the s3 scheme.""" - if req.type == "s3": - object_uri = "://".join(req.full_url.split("://")[1:]) - return s3fs.S3FileSystem().open(object_uri) - return None - else: - raise exceptions.LayerException("s3 requirement is missing.") + class S3FileSystemHandler(resources.VolatilityHandler): + + @classmethod + def non_cached_schemes(cls) -> List[str]: + return ["s3"] + @staticmethod + def default_open(req: urllib.request.Request) -> Optional[Any]: + """Handles the request if it's the s3 scheme.""" + if req.type == "s3": + object_uri = "://".join(req.full_url.split("://")[1:]) + return s3fs.S3FileSystem().open(object_uri) + return None -class GSFileSystemHandler(resources.VolatilityHandler): - if HAS_GCSFS: - @classmethod - def non_cached_schemes(cls) -> List[str]: - return ["gs"] - - @staticmethod - def default_open(req: urllib.request.Request) -> Optional[Any]: - """Handles the request if it's the gs scheme.""" - if req.type == "gs": - object_uri = "://".join(req.full_url.split("://")[1:]) - return gcsfs.GCSFileSystem().open(object_uri) - return None - else: - raise exceptions.LayerException("gcsfs requirement is missing.") \ No newline at end of file +if HAS_GCSFS: + + class GSFileSystemHandler(resources.VolatilityHandler): + @classmethod + def non_cached_schemes(cls) -> List[str]: + return ["gs"] + + @staticmethod + def default_open(req: urllib.request.Request) -> Optional[Any]: + """Handles the request if it's the gs scheme.""" + if req.type == "gs": + object_uri = "://".join(req.full_url.split("://")[1:]) + return gcsfs.GCSFileSystem().open(object_uri) + return None \ No newline at end of file