Add soft_check capability to external modules

A `soft_check` is something designed to evaluate the vulnerability of a
remote system without exploiting it (ex. banner checks, non-intrusive
fingerprinting).
This commit is contained in:
Adam Cammack
2018-05-11 12:28:52 -05:00
parent 780b956dd1
commit e0fb1365e6
4 changed files with 52 additions and 8 deletions
+21 -4
View File
@@ -75,15 +75,32 @@ def report_wrong_password(username, password, **opts):
report('wrong_password', info)
def run(metadata, module_callback):
def run(metadata, module_callback, soft_check=None):
req = json.loads(os.read(0, 10000).decode("utf-8"))
callback = None
if req['method'] == 'describe':
rpc_send({'jsonrpc': '2.0', 'id': req['id'], 'result': metadata})
caps = []
if soft_check:
caps.append('soft_check')
meta = metadata.copy()
meta.update({'capabilities': caps})
rpc_send({'jsonrpc': '2.0', 'id': req['id'], 'result': meta})
elif req['method'] == 'soft_check':
if soft_check:
callback = soft_check
else:
rpc_send({'jsonrpc': '2.0', 'id': req['id'], 'error': {'code': -32601, 'message': 'Soft checks are not supported'}})
elif req['method'] == 'run':
callback = module_callback
if callback:
args = req['params']
module_callback(args)
ret = callback(args)
rpc_send({'jsonrpc': '2.0', 'id': req['id'], 'result': {
'message': 'Module completed'
'message': 'Module completed',
'return': ret
}})