From 3e96a13b329e704726f3bcce99b91450e34c1848 Mon Sep 17 00:00:00 2001 From: Phil <phil@secdev.org> Date: Wed, 7 Apr 2010 17:40:27 +0200 Subject: [PATCH] Made Python Crypto lib become a soft dependency. --- scapy/all.py | 2 +- scapy/crypto/__init__.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/scapy/all.py b/scapy/all.py index fbaf017c..f6cf00ec 100644 --- a/scapy/all.py +++ b/scapy/all.py @@ -40,4 +40,4 @@ from asn1.asn1 import * from asn1.ber import * from asn1.mib import * -from crypto.cert import * +from crypto import * diff --git a/scapy/crypto/__init__.py b/scapy/crypto/__init__.py index 0fdc3e48..a29ecf8d 100644 --- a/scapy/crypto/__init__.py +++ b/scapy/crypto/__init__.py @@ -3,4 +3,13 @@ ## Copyright (C) Arnaud Ebalard <arno@natisbad.org> ## This program is published under a GPLv2 license -__all__ = ["cert"] + + +try: + import Crypto +except ImportError: + import logging + log_loading = logging.getLogger("scapy.loading") + log_loading.info("Can't import python Crypto lib. Disabled certificate manipulation tools") +else: + from scapy.crypto.cert import * -- GitLab