Skip to content

Commit 7e665ab

Browse files
committed
check for extra libraries explicitly, fail gracefully
1 parent 3f88e59 commit 7e665ab

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

modules/auxiliary/scanner/ssl/bleichenbacher_oracle.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99
import ssl
1010

1111
# extra modules
12-
import gmpy2
13-
from cryptography import x509
14-
from cryptography.hazmat.backends import default_backend
12+
dependencies_missing = False
13+
try:
14+
import gmpy2
15+
from cryptography import x509
16+
from cryptography.hazmat.backends import default_backend
17+
except ImportError:
18+
dependencies_missing = True
1519

1620
from metasploit import module
1721

@@ -151,6 +155,10 @@ def oracle(target, pms, cke_2nd_prefix, cipher_handshake=ch_def, messageflow=Fal
151155

152156

153157
def run(args):
158+
if dependencies_missing:
159+
module.log("Module dependencies (gmpy2 and cryptography python libraries) missing, cannot continue", level='error')
160+
return
161+
154162
target = (args['rhost'], int(args['rport']))
155163
timeout = float(args['timeout'])
156164
cipher_handshake = cipher_handshakes[args['cipher_group']]

0 commit comments

Comments
 (0)