def displayfunction_json(cur, db, no_screenshots=False): if os.isatty(sys.stdout.fileno()): indent = 4 else: indent = None for h in cur: for fld in ['_id', 'scanid']: try: del h[fld] except KeyError: pass for port in h.get('ports', []): if no_screenshots: for fname in ['screenshot', 'screendata']: if fname in port: del port[fname] elif 'screendata' in port: port['screendata'] = utils.encode_b64( db.from_binary(port['screendata']) ) for script in port.get('scripts', []): if 'masscan' in script and 'raw' in script['masscan']: script['masscan']['raw'] = utils.encode_b64( db.from_binary( script['masscan']['raw'] ) ) print(json.dumps(h, indent=indent, default=db.serialize))
def displayfunction_json(cur, db, no_screenshots=False): if os.isatty(sys.stdout.fileno()): indent = 4 else: indent = None for h in cur: for fld in ['_id', 'scanid']: try: del h[fld] except KeyError: pass for port in h.get('ports', []): if no_screenshots: for fname in ['screenshot', 'screendata']: if fname in port: del port[fname] elif 'screendata' in port: port['screendata'] = utils.encode_b64( db.from_binary(port['screendata'])) for script in port.get('scripts', []): if 'masscan' in script and 'raw' in script['masscan']: script['masscan']['raw'] = utils.encode_b64( db.from_binary(script['masscan']['raw'])) print(json.dumps(h, indent=indent, default=db.serialize))