Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Below is Python code for scanning in shodan.io. I was wondering if there is a way I could scan a certain network (for strictly network
Below is Python code for scanning in shodan.io. I was wondering if there is a way I could scan a certain network (for strictly network security purposes) for vulerability scans such as exploitable ports? import shodan SHODAN_API_KEY = "insert API key here" api = shodan.Shodan(SHODAN_API_KEY) def ipInformation(): # Lookup the host host = api.host('insert host here') # Print general info print(""" IP: %s Organization: %s Operating System: %s """ % (host['ip_str'], host.get('org', 'n/a'), host.get('os', 'n/a'))) # Print all banners for item in host['data']: print(""" Port: %s Banner: %s """ % (item['port'], item['data'])) def portScan(): SHODAN_API_KEY = "insert API key here" api = shodan.Shodan(SHODAN_API_KEY) # Wrap the request in a try/ except block to catch errors try: # Search Shodan host = api.search("insert host ip here") for service in host['matches']: hostinfo = api.host(service['ip_str']) print (service['ip_str']) for port in hostinfo['port']: print(port) except (shodan.APIError, e): print('Error: %s' % e)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started