Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def module_run(self, hosts):
api_id = self.get_key('censysio_id')
api_secret = self.get_key('censysio_secret')
c = CensysIPv4(api_id, api_secret)
IPV4_FIELDS = [ 'ip', 'protocols', 'location.country',
'location.latitude', 'location.longitude']
for host in hosts:
self.heading(host, level=0)
try:
payload = c.search('a:{0}'.format(host), IPV4_FIELDS)
except CensysException:
continue
for result in payload:
self.insert_hosts(host=host,
ip_address=result['ip'],
country=result.get('location.country', ''),
latitude=result.get('location.latitude', ''),
longitude=result.get('location.longitude', ''))
for protocol in result['protocols']:
port, service = protocol.split('/')
def module_run(self, companies):
api_id = self.get_key('censysio_id')
api_secret = self.get_key('censysio_secret')
c = CensysIPv4(api_id, api_secret)
IPV4_FIELDS = [ '443.https.tls.certificate.parsed.issuer.email_address',
'25.smtp.starttls.tls.certificate.parsed.issuer.email_address',
'465.smtp.tls.tls.certificate.parsed.issuer.email_address',
'587.smtp.starttls.tls.certificate.parsed.issuer.email_address',
'1521.oracle.banner.tls.certificate.parsed.issuer.email_address',
'3306.mysql.banner.tls.certificate.parsed.issuer.email_addressn',
'3389.rdp.banner.tls.certificate.parsed.issuer.email_address',
'5432.postgres.banner.tls.certificate.parsed.issuer.email_address',
'8883.mqtt.banner.tls.certificate.parsed.issuer.email_address',
]
SEARCH_FIELDS = [ '443.https.tls.certificate.parsed.subject.organization',
'25.smtp.starttls.tls.certificate.parsed.subject.organization',
'465.smtp.tls.tls.certificate.parsed.subject.organization',
'587.smtp.starttls.tls.certificate.parsed.subject.organization',
'1521.oracle.banner.tls.certificate.parsed.subject.organization',
'3306.mysql.banner.tls.certificate.parsed.subject.organizationn',
def setUpClass(cls):
cls._api = CensysIPv4()