Skip to content

Instantly share code, notes, and snippets.

@0xded093
Created February 25, 2016 11:00
Show Gist options
  • Save 0xded093/87018cc3c097a7695871 to your computer and use it in GitHub Desktop.
Save 0xded093/87018cc3c097a7695871 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import censys
from censys import *
api = censys.ipv4.CensysIPv4(api_id="945c7b3d-7940-42a1-8cdf-b2c90aee51fc", api_secret="mdoqmxnhuPfEYQxfReKgFZzdOjOtlmjR")
res = api.search(sys.argv[1])
matches = res['metadata']['count']
pageNum = matches / 100
if matches % 100 != 0:
pageNum = pageNum + 1
for i in res.get('results'):
print "{} {}".format(i.get("ip"), " ".join(i.get('protocols'))
## bypass first page limit
#count = 1
#while count <= pageNum:
# res = api.search(sys.argv[1], page=count)
# count = count+1
# for i in res.get('results'):
# print "{} {}".format(i.get("ip"), " ".join(i.get('protocols'))
###########################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment