{"id":8886,"date":"2023-08-13T20:06:24","date_gmt":"2023-08-13T20:06:24","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=8886"},"modified":"2023-08-13T20:06:51","modified_gmt":"2023-08-13T20:06:51","slug":"ip-geolocation-script","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2023\/08\/13\/ip-geolocation-script\/","title":{"rendered":"IP Geolocation Script"},"content":{"rendered":"\n<p>This repository contains a small script that you can use when you need to geolocate a bunch of IP addresses. It uses the IP2C API, which is free and doesn&#8217;t require any registration or API key.<\/p>\n\n\n\n<p>It takes a file containing a list of IPs as an input, and outputs a CSV friendly format.<\/p>\n\n\n\n<p>Input file format: a file containing one IPv4 address per line, in dotted notation (e.g. 8.8.8.8)<\/p>\n\n\n\n<p>Output file format: IP, ISO2 country code, Country name<\/p>\n\n\n\n<p>Usage:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\npython geolocate.py ip_file &gt; geolocalized_ips\n<\/pre><\/div>\n\n\n<p><br>Sample result:<\/p>\n\n\n\n<p>216.58.205.3,US,United States<br>128.178.50.12,CH,Switzerland<br>185.75.143.24,FR,France<br>104.16.109.41,US,United States<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Script here:  <a href=\"https:\/\/github.com\/christophetd\/geolocate-ips\" data-type=\"link\" data-id=\"https:\/\/github.com\/christophetd\/geolocate-ips\">https:\/\/github.com\/christophetd\/geolocate-ips<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This repository contains a small script that you can use when you need to geolocate a bunch of IP addresses. It uses the IP2C API, which is free and doesn&#8217;t require any registration or API key. It takes a file containing a list of IPs as an input, and outputs a CSV friendly format. Input &#8230; <a title=\"IP Geolocation Script\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2023\/08\/13\/ip-geolocation-script\/\" aria-label=\"Read more about IP Geolocation Script\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-8886","post","type-post","status-publish","format-standard","hentry","category-administration"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/8886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=8886"}],"version-history":[{"count":2,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/8886\/revisions"}],"predecessor-version":[{"id":8888,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/8886\/revisions\/8888"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=8886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=8886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=8886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}