A Python tool to display geolocation information in the traceroute.

Overview

IP2Trace Python

IP2Trace Python is a Python tool allowing user to get IP address information such as country, region, city, latitude, longitude, zip code, time zone, ISP, domain name, connection type, area code, weather, mobile network, elevation, usage type from traceroute probes IP address.

Note: This tool requires Python 2.7, or Python 3.5 or later.

Installation

You can install this tool by using pip in Windows or Linux. To install this tool in Windows and Linux, just type pip install IP2Trace in your console and IP2Trace will be installed in your machine.

Note: This tool require IP2Location library to work with. If pip did not install the dependency for you, you can manually install it by using pip install IP2Location.

Usage

Usage: ip2tracepy -p [IP ADDRESS/HOSTNAME] -d [IP2LOCATION BIN DATA PATH] [OPTIONS]
   or: ip2tracepy [IP ADDRESS/HOSTNAME] -d [IP2LOCATION BIN DATA PATH] [OPTIONS]

  -p, --ip
  Specify an IP address or hostname.
  The -p/--ip can be omitted if the IP address or hostname is defined in the first parameter.

  -d, --database
  Specify the path of IP2Location BIN database file. You can download the latest free IP2Location BIN database from https://lite.ip2location.com.
  If the database filename is specified but without the path, ip2tracepy will search the database file in /usr/share/ip2location/ for Linux or C:\Users\(your_Windows_username)\Documents\ for Windows.

  -t, --ttl
  Set the max number of hops. (Default: 30)

  -o, --output
  Set the desired IP2Location BIN database columns to output with.
  Available columns are: country_code, country_name, region_name, city_name, isp, latitude, longitude, domain, zip_code, time_zone, net_speed, idd_code, area_code, weather_station_code, weather_station_name, mcc, mnc, mobile_brand, elevation, usage_type, address_type, category.
  
  -a, --all
  Print all the column(s) available based on the BIN file used.

  -h, -?, --help
  Display this guide.

  -v, --version
  Print the version of the IP2Location version.

Example

Traceroute an IP address.

ip2tracepy 8.8.8.8 -d /usr/share/ip2location/DB3.BIN -a

Example output:

IP2Location Geolocation Traceroute (ip2trace) Version 3.1.1
Copyright (c) 2021 IP2Location.com [MIT License]
https://www.ip2location.com/free/traceroute-application

Traceroute to dns.google ( 8.8.8.8 )

 1  37.123.114.1  0.3853ms ["GB","United Kingdom of Great Britain and Northern Ireland","England","London"]
 2  10.10.32.132  0.4084ms ["-","-","-","-"]
 3  10.10.32.17  0.2673ms ["-","-","-","-"]
 4  212.78.92.2  0.5546ms ["GB","United Kingdom of Great Britain and Northern Ireland","England","London"]
 5  98.158.181.98  1.8706ms ["US","United States of America","New York","New York City"]
 6  195.66.236.125  0.5715ms ["GB","United Kingdom of Great Britain and Northern Ireland","England","London"]
 7  108.170.246.129  0.5193ms ["US","United States of America","California","Mountain View"]
 8  108.170.232.97  0.4749ms ["US","United States of America","California","Mountain View"]
 9  8.8.8.8  0.5693ms ["US","United States of America","California","Mountain View"]

Traceroute by hostname

ip2tracepy google.com -d /usr/share/ip2location/DB3.BIN -a

Example output:

IP2Location Geolocation Traceroute (ip2trace) Version 3.1.1
Copyright (c) 2021 IP2Location.com [MIT License]
https://www.ip2location.com/free/traceroute-application

Traceroute to dns.google ( 8.8.8.8 )

 1  37.123.114.1  0.3529ms ["GB","United Kingdom of Great Britain and Northern Ireland","England","London"]
 2  10.10.32.131  0.3686ms ["-","-","-","-"]
 3  10.10.32.17  0.2663ms ["-","-","-","-"]
 4  212.78.92.2  19.7358ms ["GB","United Kingdom of Great Britain and Northern Ireland","England","London"]
 5  98.158.181.98  9.2373ms ["US","United States of America","New York","New York City"]
 6  195.66.236.125  0.5388ms ["GB","United Kingdom of Great Britain and Northern Ireland","England","London"]
 7  108.170.246.161  1.6131ms ["US","United States of America","California","Mountain View"]
 8  172.253.65.211  1.2376ms ["US","United States of America","California","Mountain View"]
 9  216.58.213.14  0.5167ms ["US","United States of America","California","Mountain View"]

Download IP2Location Databases

One you have obtained your download token, you can download the the database using wget as below:

wget "https://www.ip2location.com/download?token={DOWNLOAD_TOKEN}&file={DATABASE_CODE}"

Support

Email: [email protected] URL: https://www.ip2location.com

You might also like...
Python bindings and utilities for GeoJSON

geojson This Python library contains: Functions for encoding and decoding GeoJSON formatted data Classes for all GeoJSON Objects An implementation of

Geocoding library for Python.

geopy geopy is a Python client for several popular geocoding web services. geopy makes it easy for Python developers to locate the coordinates of addr

Python Data. Leaflet.js Maps.

folium Python Data, Leaflet.js Maps folium builds on the data wrangling strengths of the Python ecosystem and the mapping strengths of the Leaflet.js

Python tools for geographic data
Python tools for geographic data

GeoPandas Python tools for geographic data Introduction GeoPandas is a project to add support for geographic data to pandas objects. It currently impl

Python interface to PROJ (cartographic projections and coordinate transformations library)
Python interface to PROJ (cartographic projections and coordinate transformations library)

pyproj Python interface to PROJ (cartographic projections and coordinate transformations library). Documentation Stable: http://pyproj4.github.io/pypr

Python bindings and utilities for GeoJSON

geojson This Python library contains: Functions for encoding and decoding GeoJSON formatted data Classes for all GeoJSON Objects An implementation of

Documentation and samples for ArcGIS API for Python

ArcGIS API for Python ArcGIS API for Python is a Python library for working with maps and geospatial data, powered by web GIS. It provides simple and

PySAL: Python Spatial Analysis Library Meta-Package
PySAL: Python Spatial Analysis Library Meta-Package

Python Spatial Analysis Library PySAL, the Python spatial analysis library, is an open source cross-platform library for geospatial data science with

Simple, concise geographical visualization in Python
Simple, concise geographical visualization in Python

Geographic visualizations for HoloViews. Build Status Coverage Latest dev release Latest release Docs What is it? GeoViews is a Python library that ma

Comments
  • socket.herror: [Errno 1] Unknown host

    socket.herror: [Errno 1] Unknown host

    [[email protected] ]# ip2trace -p 116.122.36.54 -d IP-COUNTRY-REGION-CITY-ISP.BIN -t 30                               
    Traceback (most recent call last):
      File "/usr/local/bin/ip2trace", line 11, in <module>
        load_entry_point('IP2Trace==2.1.7', 'console_scripts', 'ip2trace')()
      File "/usr/local/lib/python3.6/site-packages/ip2trace.py", line 482, in main
        traceroute(destination_server, database, max_hops, output, all)
      File "/usr/local/lib/python3.6/site-packages/ip2trace.py", line 148, in traceroute
        t = Traceroute(destination_server, database, ttl, output, all)
      File "/usr/local/lib/python3.6/site-packages/ip2trace.py", line 174, in __init__
        self.destination_domain_name = ip_to_domain_name(destination_server)
      File "/usr/local/lib/python3.6/site-packages/ip2trace.py", line 97, in ip_to_domain_name
        return socket.gethostbyaddr(hostname)
    socket.herror: [Errno 1] Unknown host
    [[email protected] ]# 
    
    opened by CNMan 1
  • Invalid sintax

    Invalid sintax

    I receive:

    $ python ip2trace.py 
      File "ip2trace.py", line 140
        print(" {}  ".format(self.ttl), end="")
                                           ^
    SyntaxError: invalid syntax
    

    Thank you, Riccardo

    opened by canonex 1
Releases(3.1.3)
Owner
IP2Location
IP geolocation solution. Determine geographical location information such as county, city, zipcode, mobile network information by IP address.
IP2Location
A Django application that provides country choices for use with forms, flag icons static files, and a country field for models.

Django Countries A Django application that provides country choices for use with forms, flag icons static files, and a country field for models. Insta

Chris Beaven 1.2k Jan 03, 2023
r.cfdtools 7 Dec 28, 2022
ESMAC diags - Earth System Model Aerosol-Cloud Diagnostics Package

Earth System Model Aerosol-Cloud Diagnostics Package This Earth System Model (ES

Pacific Northwest National Laboratory 1 Jan 04, 2022
Software for Advanced Spatial Econometrics

GeoDaSpace Software for Advanced Spatial Econometrics GeoDaSpace current version 1.0 (32-bit) Development environment: Mac OSX 10.5.x (32-bit) wxPytho

GeoDa Center 38 Jan 03, 2023
Imports VZD (Latvian State Land Service) open data into postgis enabled database

Python script main.py downloads and imports Latvian addresses into PostgreSQL database. Data contains parishes, counties, cities, towns, and streets.

Kaspars Foigts 7 Oct 26, 2022
This app displays interesting statistical weather records and trends which can be used in climate related research including study of global warming.

This app displays interesting statistical weather records and trends which can be used in climate related research including study of global warming.

0 Dec 27, 2021
Python module to access the OpenCage geocoding API

OpenCage Geocoding Module for Python A Python module to access the OpenCage Geocoder. Build Status / Code Quality / etc Usage Supports Python 3.6 or n

OpenCage GmbH 57 Nov 01, 2022
A python package that extends Google Earth Engine.

A python package that extends Google Earth Engine GitHub: https://github.com/davemlz/eemont Documentation: https://eemont.readthedocs.io/ PyPI: https:

David Montero Loaiza 307 Jan 01, 2023
3D extension built off of shapely to make working with geospatial/trajectory data easier in python.

PyGeoShape 3D extension to shapely and pyproj to make working with geospatial/trajectory data easier in python. Getting Started Installation pip The e

Marc Brittain 5 Dec 27, 2022
framework for large-scale SAR satellite data processing

pyroSAR A Python Framework for Large-Scale SAR Satellite Data Processing The pyroSAR package aims at providing a complete solution for the scalable or

John Truckenbrodt 389 Dec 21, 2022
Create Siege configuration files from Cloud Optimized GeoTIFF.

cogeo-siege Documentation: Source Code: https://github.com/developmentseed/cogeo-siege Description Create siege configuration files from Cloud Optimiz

Development Seed 3 Dec 01, 2022
Python 台灣行政區地圖 (2021)

Python 台灣行政區地圖 (2021) 以 python 讀取政府開放平台的 ShapeFile 地圖資訊。歡迎引用或是協作 另有縣市資訊、村里資訊與各種行政地圖資訊 例如: 直轄市、縣市界線(TWD97經緯度) 鄉鎮市區界線(TWD97經緯度) | 政府資料開放平臺: https://data

WeselyOng 12 Sep 27, 2022
Satellite imagery for dummies.

felicette Satellite imagery for dummies. What can you do with this tool? TL;DR: Generate JPEG earth imagery from coordinates/location name with public

Shivashis Padhi 1.8k Jan 03, 2023
A short term landscape evolution using a path sampling method to solve water and sediment flow continuity equations and model mass flows over complex topographies.

r.sim.terrain A short-term landscape evolution model that simulates topographic change for both steady state and dynamic flow regimes across a range o

Brendan Harmon 7 Oct 21, 2022
Manage your XYZ Hub or HERE Data Hub spaces from Python.

XYZ Spaces for Python Manage your XYZ Hub or HERE Data Hub spaces and Interactive Map Layer from Python. FEATURED IN: Online Python Machine Learning C

HERE Technologies 30 Oct 18, 2022
Python renderer for OpenStreetMap with custom icons intended to display as many map features as possible

Map Machine project consists of Python OpenStreetMap renderer: SVG map generation, SVG and PNG tile generation, Röntgen icon set: unique CC-BY 4.0 map

Sergey Vartanov 0 Dec 18, 2022
Imperial Valley Geomorphology Map

Roughly maps the extent of basins, basin edges, and mountains in the Imperial Valley by grouping terrain classes from the Iwahashi et al. 2021 California terrian classification model.

0 Dec 13, 2022
Geodata extensions for Django REST Framework

Django-Spillway Django and Django REST Framework integration of raster and feature based geodata. Spillway builds on the immensely marvelous Django RE

Brian Galey 62 Jan 04, 2023
Solving the Traveling Salesman Problem using Self-Organizing Maps

Solving the Traveling Salesman Problem using Self-Organizing Maps This repository contains an implementation of a Self Organizing Map that can be used

Diego Vicente 3.1k Dec 31, 2022
Python module and script to interact with the Tractive GPS tracker.

pyTractive GPS Python module and script to interact with the Tractive GPS tracker. Requirements Python 3 geopy folium pandas pillow usage: main.py [-h

Dr. Usman Kayani 3 Nov 16, 2022