check for extra libraries explicitly, fail gracefully

MS-2855/keylogger-mettle-extension
Brent Cook 2018-02-21 21:54:58 -06:00
parent 3f88e59516
commit 7e665ab287
1 changed files with 11 additions and 3 deletions

View File

@ -9,9 +9,13 @@ import os
import ssl
# extra modules
import gmpy2
from cryptography import x509
from cryptography.hazmat.backends import default_backend
dependencies_missing = False
try:
import gmpy2
from cryptography import x509
from cryptography.hazmat.backends import default_backend
except ImportError:
dependencies_missing = True
from metasploit import module
@ -151,6 +155,10 @@ def oracle(target, pms, cke_2nd_prefix, cipher_handshake=ch_def, messageflow=Fal
def run(args):
if dependencies_missing:
module.log("Module dependencies (gmpy2 and cryptography python libraries) missing, cannot continue", level='error')
return
target = (args['rhost'], int(args['rport']))
timeout = float(args['timeout'])
cipher_handshake = cipher_handshakes[args['cipher_group']]