How to use the censys.base function in censys

To help you get started, we’ve selected a few censys examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Te-k / harpoon / harpoon / commands / censyscmd.py View on Github external
r['location.country'],
                                    " ".join(r['protocols'])
                                )
                            )
                        else:
                            print("[+] %s\t\t[Location: %s] [Ports: %s]" % (
                                    r['ip'],
                                    r['location.country'],
                                    " ".join(r['protocols'])
                                )
                            )
                else:
                    try:
                        ip = api.view(args.IP)
                        print(json.dumps(ip, sort_keys=True, indent=4, separators=(',', ': ')))
                    except censys.base.CensysNotFoundException:
                        print('IP not found')
            elif args.subcommand == 'cert':
                try:
                    c = certificates.CensysCertificates(conf['Censys']['id'], conf['Censys']['secret'])
                    res = c.view(args.ID)
                except censys.base.CensysNotFoundException:
                    print("Certificate not found")
                else:
                    print(json.dumps(res, sort_keys=True, indent=4, separators=(',', ': ')))
            elif args.subcommand == 'subdomains':
                subdomains = self.get_subdomains(conf, args.DOMAIN, args.verbose)
                for d in subdomains:
                    print(d)
            else:
                self.parser.print_help()
        else: