Пример #1
0
 def module_run(self, netblocks):
     api_id = self.get_key("censysio_id")
     api_secret = self.get_key("censysio_secret")
     c = CensysHosts(api_id, api_secret)
     for netblock in netblocks:
         self.heading(netblock, level=0)
         try:
             # we only need one per netblock since they'll all have the same by ASN
             report = c.aggregate(
                 f"ip:{netblock}",
                 fields="autonomous_system.name",
                 num_buckets=int(self.options.get("NUM_BUCKETS", "100")),
             )
         except CensysException:
             self.print_exception()
             continue
         for bucket in report.get("buckets", []):
             company = bucket.get("key")
             self.insert_companies(company=company)
Пример #2
0
 def module_run(self, emails):
     api_id = self.get_key("censysio_id")
     api_secret = self.get_key("censysio_secret")
     c = CensysHosts(api_id, api_secret)
     for email in emails:
         email = email.strip('"')
         self.heading(email, level=0)
         try:
             report = c.aggregate(
                 f'services.tls.certificates.leaf_data.subject.email_address:"{email}"',
                 field="services.tls.certificates.leaf_data.names",
                 num_buckets=self.options.get("num_buckets", 100),
             )
         except CensysException:
             self.print_exception()
             continue
         for bucket in report.get("buckets", []):
             domain = bucket.get("key")
             self.insert_domains(domain=domain, notes=f"Email: {email}")
Пример #3
0
 def module_run(self, companies):
     api_id = self.get_key("censysio_id")
     api_secret = self.get_key("censysio_secret")
     c = CensysHosts(api_id, api_secret)
     for company in companies:
         company = company.strip('"')
         self.heading(company, level=0)
         try:
             report = c.aggregate(
                 "same_service(services.tls.certificates.leaf_data.subject.email_address:*"
                 " and "
                 f'services.tls.certificates.leaf_data.subject.organization:"{company}")',
                 field="services.tls.certificates.leaf_data.subject.email_address",
                 num_buckets=int(self.options.get("NUM_BUCKETS", "100")),
             )
         except CensysException:
             self.print_exception()
             continue
         for bucket in report.get("buckets", []):
             email = bucket.get("key")
             self.insert_contacts(email=email)
Пример #4
0
 def module_run(self, domains):
     api_id = self.get_key("censysio_id")
     api_secret = self.get_key("censysio_secret")
     c = CensysHosts(api_id, api_secret)
     for domain in domains:
         domain = domain.strip('"')
         self.heading(domain, level=0)
         try:
             report = c.aggregate(
                 "same_service(services.tls.certificates.leaf_data.names:"
                 f" {domain} and"
                 " services.tls.certificates.leaf_data.subject.organization: *)",
                 field=
                 "services.tls.certificates.leaf_data.subject.organization",
                 num_buckets=int(self.options.get("NUM_BUCKETS", "100")),
             )
         except CensysException:
             self.print_exception()
             continue
         for bucket in report.get("buckets", []):
             company = bucket.get("key")
             self.insert_companies(company=company,
                                   description=f"Domain: {domain}")