Land #9604, Fix logged errors when running without Python 3.6 / gmpy2

4.x
Jacob Robles 2018-02-22 08:11:30 -06:00 committed by Metasploit
parent a189673782
commit 178afdaed1
No known key found for this signature in database
GPG Key ID: CDFB5FA52007B954
2 changed files with 12 additions and 4 deletions

View File

@ -29,7 +29,7 @@ def report_vuln(ip, name, **opts):
def run(metadata, module_callback):
req = json.loads(os.read(0, 10000))
req = json.loads(os.read(0, 10000).decode("utf-8"))
if req['method'] == 'describe':
rpc_send({'jsonrpc': '2.0', 'id': req['id'], 'response': metadata})
elif req['method'] == 'run':

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']]