0

When i try to scan an ip, always throes the same error, (Error: Access denied (403 Forbidden))

def getShodan(ip):
    print("-------Shodan-------")
    
    try:
        api = shodan.Shodan("")
        info = api.host(ip)
        return ("""
                IP: {}
                HOSTNAMES: {}
                COUNTRYNAME: {}
                PORTS: {}
                ORGANIZATION: {}
                OPERATINGSYSTEM: {}
                """.format(ip, info.get('hostnames'), info.get('country_name'), info.get('ports'), info.get('org'), info.get('os')))
    except shodan.exception.APIError as e:
        print(('Error:')+' %s\n---------------------------------\n\n' % e)
        exit(0)

I already change the API key multiple times but nothing changes

  • that seems like an invalid api key ... can you do their curl example for `/host/{ip}` and that works? – Joran Beasley Jun 05 '23 at 18:55
  • How i can do that, im new with API and web stuff – idolopafersa Jun 06 '23 at 12:05
  • Also get this Error message when i try to check mi key 401 Unauthorized This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required. – idolopafersa Jun 06 '23 at 12:25
  • if you go to their docs ... they have a bunch of examples of how to call the endpoints with curl ... maybe get that working first (it should be equivelent ... but sometimes having a copy paste example is a helpful place to start) – Joran Beasley Jun 06 '23 at 19:41

0 Answers0