Support Cryptodome namespace when Crypto is unavailable

This commit is contained in:
Esa Jokinen
2026-03-10 17:08:01 +02:00
parent 8c67953c50
commit 5e955e5220
3 changed files with 17 additions and 4 deletions
@@ -5,8 +5,13 @@ import logging
from struct import unpack from struct import unpack
from typing import Tuple from typing import Tuple
from Crypto.Cipher import ARC4, AES try:
from Crypto.Hash import HMAC from Crypto.Cipher import ARC4, AES
from Crypto.Hash import HMAC
except ImportError:
# Debian/Ubuntu ship pycryptodome under Cryptodome namespace
from Cryptodome.Cipher import ARC4, AES
from Cryptodome.Hash import HMAC
from volatility3.framework import interfaces, renderers, exceptions from volatility3.framework import interfaces, renderers, exceptions
from volatility3.framework.configuration import requirements from volatility3.framework.configuration import requirements
@@ -7,7 +7,11 @@ import logging
from struct import pack, unpack from struct import pack, unpack
from typing import List, Optional, Tuple from typing import List, Optional, Tuple
from Crypto.Cipher import AES, ARC4, DES try:
from Crypto.Cipher import ARC4, DES, AES
except ImportError:
# Debian/Ubuntu ship pycryptodome under Cryptodome namespace
from Cryptodome.Cipher import ARC4, DES, AES
from volatility3.framework import interfaces, renderers, exceptions, constants from volatility3.framework import interfaces, renderers, exceptions, constants
from volatility3.framework.configuration import requirements from volatility3.framework.configuration import requirements
@@ -6,7 +6,11 @@ from struct import unpack
from typing import Optional from typing import Optional
import hashlib import hashlib
from Crypto.Cipher import ARC4, DES, AES try:
from Crypto.Cipher import ARC4, DES, AES
except ImportError:
# Debian/Ubuntu ship pycryptodome under Cryptodome namespace
from Cryptodome.Cipher import ARC4, DES, AES
from volatility3.framework import interfaces, renderers, exceptions from volatility3.framework import interfaces, renderers, exceptions
from volatility3.framework.configuration import requirements from volatility3.framework.configuration import requirements