Skip to content

Commit 738d6ab

Browse files
committed
Land rapid7#9604, Fix logged errors when running without Python 3.6 / gmpy2
2 parents 99e278f + 7e665ab commit 738d6ab

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

lib/msf/core/modules/external/python/metasploit/module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def report_vuln(ip, name, **opts):
2929

3030

3131
def run(metadata, module_callback):
32-
req = json.loads(os.read(0, 10000))
32+
req = json.loads(os.read(0, 10000).decode("utf-8"))
3333
if req['method'] == 'describe':
3434
rpc_send({'jsonrpc': '2.0', 'id': req['id'], 'response': metadata})
3535
elif req['method'] == 'run':

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)