Esempio n. 1
0
    def run(self):
        Analyzer.run(self)

        try:
            self.shodan_client = ShodanAPIPublic(self.shodan_key)
            if self.data_type == 'ip':
                ip = self.get_param('data', None, 'Data is missing')
                results = {
                    'reverse_dns': {
                        'hostnames': self.shodan_client.reverse_dns(ip)[ip]
                    },
                    'host': self.shodan_client.host(ip)
                }
                self.report(results)
            if self.data_type == 'domain':
                domain = self.get_param('data', None, 'Data is missing')
                result = {
                    'dns_resolve': self.shodan_client.dns_resolve(domain),
                    'infos_domain': self.shodan_client.info_domains(domain)
                }
                self.report(result)
        except APIError as e:
            self.error(str(e))
        except Exception as e:
            self.unexpectedError(e)
Esempio n. 2
0
 def run(self):
     try:
         self.shodan_client = ShodanAPIPublic(self.shodan_key)
         data = self.get_param('data', None, 'Data is missing')
         results = self.execute_shodan_service(data)
         self.report(self.encode(results))
     except APIError as e:
         self.error(str(e))
     except Exception as e:
         self.unexpectedError(e)