Censys Search Python Library
In this introduction to the Censys Python Library, we write an example script to query the Censys IPv4 dataset for hosts related to a name.
IPv4: Port and Protocol scan of all public IPv4 hosts, including 36 protocols on 48 ports.
Websites: Name-based port and protocol scan of the Alexa Top 1 Million websites.
Certificates: Collection of certificates, including certificates seen during our scans as well as certificates synced from several Certificate Transparency logs.
import censys.ipv4 # for searching hosts import os # for retrieving API credentials import socket # for doing reverse DNS lookups on IPs ID = os.getenv( "CENSYS_API_ID" ) KEY = os.getenv( "CENSYS_API_KEY" ) hosts = censys.ipv4.CensysIPv4(ID, KEY) name = "example.com" for x in hosts.search(name): rdns = socket.gethostbyaddr(x[ "ip" ])[ 0 ] print ( f " { rdns :25s} | { x[ 'ip' ] :>15s} | " f " { x[ 'location.city' ] :>20s} | { x[ 'protocols' ] } " )
Comments
0 comments
Article is closed for comments.