Skip to content

Conversation

@slackuj
Copy link

@slackuj slackuj commented Nov 20, 2025

IPinfoDB is no longer accepting new sign ups for the IPInfoDB API.Instead, IPinfoDB requests for signing up for IP2Location.io IP Geolocation API.Furthermore, the new service endpoint (api.ip2location.io) uses different JSON field names for location data (e.g., city_name instead of cityName).This change makes the script more resilient to external service changes, ensuring geolocation continues to work with both old and new API keys provided by the service migration.

The script is updated to implement a dual-endpoint fallback mechanism within the ipinfodb function:

Primary Attempt (New API):
The script first attempts to query the IP2Location.io API (api.ip2location.io). This ensures compatibility for all newly registered API keys. It uses the new field names (city_name, region_name, country_name) to correctly parse the JSON response.

Fallback Attempt (Old API):
If the primary request fails, the script falls back to querying the IPInfoDB API (api.ipinfodb.com). This preserves functionality for existing Nmap users who possess an old, still-active IPInfoDB API key, using the legacy field names (cityName, regionName, countryName).

Unified Error Handling:
Error handling for invalid API keys is maintained and applied to both requests.

Updated Documentation
The script description has also been updated to include information about the new IP2Location.io service and its registration link.

 IPinfoDB is no longer accepting new sign ups for the IPInfoDB API.Instead, IPinfoDB requests for signing up for IP2Location.io IP Geolocation API.Furthermore, the new service endpoint (api.ip2location.io) uses different JSON field names for location data (e.g., city_name instead of cityName).This change makes the script more resilient to external service changes, ensuring geolocation continues to work with both old and new API keys provided by the service migration.


The script is updated to implement a dual-endpoint fallback mechanism within the ipinfodb function:

Primary Attempt (New API): 
The script first attempts to query the IP2Location.io API (api.ip2location.io). This ensures compatibility for all newly registered API keys. It uses the new field names (city_name, region_name, country_name) to correctly parse the JSON response.


Fallback Attempt (Old API): 
If the primary request fails, the script falls back to querying the IPInfoDB API (api.ipinfodb.com). This preserves functionality for existing Nmap users who possess an old, still-active IPInfoDB API key, using the legacy field names (cityName, regionName, countryName).


Unified Error Handling: 
Error handling for invalid API keys is maintained and applied to both requests.

Updated Documentation
The script description has also been updated to include information about the new IP2Location.io service and its registration link.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant