<commit_before># PyGeoIpMap


A Python script to show where IP addresses are coming from by plotting them on a World map. Now compatible with Python3.

![screenshot.jpg](https://raw.githubusercontent.com/lgg-awesome/PyGeoIpMap/master/screenshot.jpg)

## Requirements

* [numpy](http://www.numpy.org/)
* [matplotlib](http://matplotlib.org/)
* [Basemap](http://matplotlib.org/basemap/)
* [pygeoip](https://pypi.python.org/pypi/pygeoip)

PyGeoIpMap can be installed along with its dependencies easily on Fedora Linux with the following command:

```bash
sudo dnf install python3-numpy python3-matplotlib python3-basemap python3-pygeoip
```

## Usage

```
usage: pygeoipmap.py [-h] [-i INPUT] [-o OUTPUT] [-f {ip,csv}] [-s {f,m}]
                     [-db DB] [--extents EXTENTS]

Visualize community on a map.

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Input file. One IP per line or, if FORMAT set to
                        'csv', CSV formatted file ending with latitude and
                        longitude positions
  -o OUTPUT, --output OUTPUT
                        Path to save the file (e.g. /tmp/output.png)
  -a APIKEY, --apikey APIKEY
                        API-KEY from ipstack.com
  -f {ip,csv}, --format {ip,csv}
                        Format of the input file.
  -s {f,m}, --service {f,m}
                        Geolocation service (f=FreeGeoIP, m=MaxMind local
                        database)
  -db DB, --db DB       Full path to MaxMind database file (default =
                        ./GeoLiteCity.dat)
  --extents W/E/S/N     Spatial extents for the figure
                        (west/east/south/north). Defaults to global.
```

## Examples

### Using a list of IP addresses (and the Ipstack.com web service)

For use this service you need the API-KEY from https://ipstack.com/

A World map can be generated from a list of IP addresses by running the following command:

```bash
python3 pygeoipmap.py --apikey "YOUR-API-KEY" -i /tmp/ip.txt 
```

The list of IP address must be saved to a text file with each IP<commit_msg>Update with ipstack service<commit_after># PyGeoIpMap


A Python script to show where IP addresses are coming from by plotting them on a World map. Now compatible with Python3.

![screenshot.jpg](https://raw.githubusercontent.com/lgg-awesome/PyGeoIpMap/master/screenshot.jpg)

## Requirements

* [numpy](http://www.numpy.org/)
* [matplotlib](http://matplotlib.org/)
* [Basemap](http://matplotlib.org/basemap/)
* [pygeoip](https://pypi.python.org/pypi/pygeoip)

PyGeoIpMap can be installed along with its dependencies easily on Fedora Linux with the following command:

```bash
sudo dnf install python3-numpy python3-matplotlib python3-basemap python3-pygeoip
```

## Usage

```
usage: pygeoipmap.py [-h] [-i INPUT] [-o OUTPUT] [-f {ip,csv}] [-s {f,m}]
                     [-db DB] [--extents EXTENTS]

Visualize community on a map.

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Input file. One IP per line or, if FORMAT set to
                        'csv', CSV formatted file ending with latitude and
                        longitude positions
  -o OUTPUT, --output OUTPUT
                        Path to save the file (e.g. /tmp/output.png)
  -a APIKEY, --apikey APIKEY
                        API-KEY from ipstack.com
  -f {ip,csv}, --format {ip,csv}
                        Format of the input file.
  -s {f,m}, --service {f,m}
                        Geolocation service (f=ipstack, m=MaxMind local
                        database)
  -db DB, --db DB       Full path to MaxMind database file (default =
                        ./GeoLiteCity.dat)
  --extents W/E/S/N     Spatial extents for the figure
                        (west/east/south/north). Defaults to global.
```

## Examples

### Using a list of IP addresses (and the Ipstack.com web service)

For use this service you need the API-KEY from https://ipstack.com/

A World map can be generated from a list of IP addresses by running the following command:

```bash
python3 pygeoipmap.py --apikey "YOUR-API-KEY" -i /tmp/ip.txt 
```

The list of IP address must be saved to a text file with each IP
{'fraction_non_alphanumeric': 0.10757717492984098, 'fraction_numerical': 0.002806361085126286, 'mean_word_length': 2.210960960960961, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4494733', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1292, 'n_words': 464}