Skip to content

gsleap/ip2country

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

ip2country

Little python script to take in a file of IP addresses and return CSV output to stdout of:

  • ip_address
  • country(code)
  • region/state
  • city

This makes use of the excellent (and free) ip2geotools python library.

Installation

  • Create a new python3 virtual environment
  • pip install -r requirements.txt

Usage

python ip2country.py IP_ADDRESS_LIST_FILENAME

The IP_ADDRESS_LIST_FILENAME should just contain ipv4 addresses- one on each line

Example output

$ echo "8.8.4.4" > test.txt

$ python ip2country.py test.txt
added 8.8.4.4
1 ip addresses added for lookup.
"8.8.4.4","US","California","Mountain View"
$ 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages