Error API Shodan Error: Access denied (403 Forbidden)

5.8k Views Asked by At

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

1

There are 1 best solutions below

0
Alisha Hunt On

I ran into this same error, and realized I had accidentally signed into a new account. You do not get access to the API by default. If you sign up with a University email, they should automatically give you the academic upgrade. Otherwise you have to pay for API services.