This project consists of a Python script and a web application to perform IP address lookups using various IP geolocation services. The IP lookup can be executed via command line or through a web interface.
This screenshot shows how the IP Lookup looks when running.
iplookup.py
: A Python script that queries multiple IP geolocation services and returns the results.index.html
: A simple HTML page with a form to input an IP address and display the lookup results.app.py
: A Flask web application that serves the HTML page and handles IP lookup requests by invoking theiplookup.py
script.
You can install the required Python libraries using pip:
pip3 install -r requirements.txt
-
Basic Lookup:
To lookup an IP address, run:
python3 iplookup.py <ip-address>
This will output the results from all the geolocation services in JSON format.
-
Save to File:
To save the results to a file named
ip_lookup_result.json
, use:python3 iplookup.py -s <ip-address>
-
Start the Flask application:
python3 app.py
-
Open your web browser and navigate to
http://localhost:5000
. -
Enter an IP address in the input field and click the "Lookup" button. The results will be displayed below the button.
This script performs the IP lookup using various geolocation APIs. It defines a list of APIs and fetches information from each of them. The results are then printed or saved to a file based on the command-line arguments.
This is a static HTML file providing a user interface to input an IP address and view the lookup results. The page is styled for simplicity and ease of use.
This Flask application serves the HTML file and handles API requests. It calls the iplookup.py
script to perform the IP lookup and returns the results as JSON.
- Error: IP address is required: Ensure that you provide an IP address as a query parameter when using the web interface.
- Error running script: Make sure
iplookup.py
is in the same directory asapp.py
and that it is executable. - JSON decoding errors: Verify that
iplookup.py
is generating valid JSON output.
Feel free to open issues or submit pull requests to improve the functionality or add more features. Contributions are welcome!
This project is licensed under the MIT License. See the LICENSE file for details.
For any further questions or assistance, please feel free to contact the project maintainers. Happy IP lookup!