How to use the shodan.api.WebAPIError function in shodan

To help you get started, we’ve selected a few shodan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Adastra-thw / pyHacks / attackTOR.py View on Github external
def run(self) :
		lock = threading.Lock()
		while True :
			lock.acquire()
			host = None
			try:
				ip, port = self.queue.get(timeout=1)
				if hasattr(self, 'shodanApi'):
					log.info("[+] Using Shodan against %s " %(ip))
					try:
						shodanResults = self.shodanApi.host(ip)
						recordShodanResults(self, ip, shodanResults)
					except WebAPIError:
						log.error("[-] There's no information about %s in the Shodan Database." %(ip))
						pass
				
				if self.cli.brute == True:
					if self.cli.usersFile != None and self.cli.passFile != None:
						for method in self.bruteForcePorts.keys():
							if self.bruteForcePorts[method] == port:
								#Open port detected for a service supported in the "Brute-Forcer"
								#Calling the method using reflection.
								attr(service)
								
					else:
						log.warn("[-] BruteForce mode specified but there's no files for users and passwords. Use -u and -f options")
			except Queue.Empty :
				log.info("Worker %d exiting... "%self.tid)
			finally: