{"id":21945943,"url":"https://github.com/ip2location/ip2location-io-cli","last_synced_at":"2025-04-22T21:28:13.671Z","repository":{"id":202573428,"uuid":"707516773","full_name":"ip2location/ip2location-io-cli","owner":"ip2location","description":"IP2Location.io command line to query IP geolocation data from IP2Location.io API","archived":false,"fork":false,"pushed_at":"2025-02-18T06:04:03.000Z","size":64,"stargazers_count":15,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-18T21:16:48.592Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ip2location.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-20T04:29:58.000Z","updated_at":"2025-04-14T14:04:45.000Z","dependencies_parsed_at":"2023-11-27T07:25:00.121Z","dependency_job_id":"684841d2-5fb1-4acf-ad03-b9b542717a9a","html_url":"https://github.com/ip2location/ip2location-io-cli","commit_stats":null,"previous_names":["ip2location/ip2location-io-cli"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ip2location%2Fip2location-io-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ip2location%2Fip2location-io-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ip2location%2Fip2location-io-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ip2location%2Fip2location-io-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ip2location","download_url":"https://codeload.github.com/ip2location/ip2location-io-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250327376,"owners_count":21412418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-29T04:20:55.373Z","updated_at":"2025-04-22T21:28:13.665Z","avatar_url":"https://github.com/ip2location.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/ip2location/ip2location-io-cli)](https://goreportcard.com/report/github.com/ip2location/ip2location-io-cli)\r\n\r\nIP2Location.io Go CLI\r\n=====================\r\nThis Go command line tool enables user to query for an enriched data set, such as country, region, district, city, latitude \u0026 longitude, ZIP code, time zone, ASN, ISP, domain, net speed, IDD code, area code, weather station data, MNC, MCC, mobile brand, elevation, usage type, address type, advertisement category, fraud score and proxy data with an IP address. It supports both IPv4 and IPv6 address lookup.\r\n\r\nThis program requires an API key to unlock more queries and data fields. You may sign up for a free API key at https://www.ip2location.io/pricing.\r\n\r\nIf you don't use an API key, you'll be limited to 1000 IP geolocation queries per day.\r\n\r\nInstallation\r\n============\r\n\r\n#### `go install` Installation\r\n\r\n```bash\r\ngo install github.com/ip2location/ip2location-io-cli/ip2locationio@latest\r\n```\r\n\r\n\r\n#### Git Installation\r\n\r\n```bash\r\ngit clone https://github.com/ip2location/ip2location-io-cli ip2location-io-cli\r\ncd ip2location-io-cli\r\ngo install ./ip2locationio/\r\n$GOPATH/bin/ip2locationio\r\n```\r\n\r\n\r\n#### Debian/Ubuntu (amd64)\r\n\r\n```bash\r\ncurl -LO https://github.com/ip2location/ip2location-io-cli/releases/download/v1.2.0/ip2location-io-1.2.0.deb\r\nsudo dpkg -i ip2location-io-1.2.0.deb\r\n```\r\n\r\n\r\n#### Ubuntu PPA\r\n\r\n```bash\r\nsudo add-apt-repository ppa:ip2location/ip2locationio\r\nsudo apt update\r\nsudo apt install ip2location-io\r\n```\r\n\r\n#### Arch Linux\r\n\r\n```\r\ngit clone https://aur.archlinux.org/ip2location-io-cli.git \u0026\u0026 cd ip2location-io-cli\r\nmakepkg -si\r\n```\r\n\r\n#### MacOS\r\n\r\n```\r\ncurl -Ls https://raw.githubusercontent.com/ip2location/ip2location-io-cli/main/scripts/macos.sh | sh\r\n```\r\n\r\n### Windows Powershell\r\n\r\nLaunch Powershell as administrator then run the below:\r\n\r\n```bash\r\niwr -useb https://raw.githubusercontent.com/ip2location/ip2location-io-cli/main/scripts/windows.ps1 | iex\r\n```\r\n\r\n\r\n### Scoop\r\n\r\n```bash\r\nscoop bucket add extras\r\nscoop install ip2location-io-cli\r\n```\r\n\r\n\r\n### Download pre-built binaries\r\n\r\nSupported OS/architectures below:\r\n\r\n```\r\ndarwin_amd64\r\ndarwin_arm64\r\ndragonfly_amd64\r\nfreebsd_386\r\nfreebsd_amd64\r\nfreebsd_arm\r\nfreebsd_arm64\r\nlinux_386\r\nlinux_amd64\r\nlinux_arm\r\nlinux_arm64\r\nnetbsd_386\r\nnetbsd_amd64\r\nnetbsd_arm\r\nnetbsd_arm64\r\nopenbsd_386\r\nopenbsd_amd64\r\nopenbsd_arm\r\nopenbsd_arm64\r\nsolaris_amd64\r\nwindows_386\r\nwindows_amd64\r\nwindows_arm\r\n```\r\n\r\nAfter choosing a platform `PLAT` from above, run:\r\n\r\n```bash\r\n# for Windows, use \".zip\" instead of \".tar.gz\"\r\ncurl -LO https://github.com/ip2location/ip2location-io-cli/releases/download/v1.2.0/ip2locationio_1.2.0_${PLAT}.tar.gz\r\n# OR\r\nwget https://github.com/ip2location/ip2location-io-cli/releases/download/v1.2.0/ip2locationio_1.2.0_${PLAT}.tar.gz\r\n\r\ntar -xvf ip2locationio_1.2.0_${PLAT}.tar.gz\r\nmv ip2locationio_1.2.0_${PLAT} /usr/local/bin/ip2locationio\r\n```\r\n\r\n\r\nUsage Examples\r\n==============\r\n\r\n### Display help\r\n```bash\r\nip2locationio -h\r\n```\r\n\r\n### Configure API key\r\n```bash\r\nip2locationio config \u003cAPI KEY\u003e\r\n```\r\n\r\n### Query own public IP geolocation\r\n```bash\r\nip2locationio\r\n```\r\n\r\n### Query IP geolocation for specific IP (JSON)\r\n```bash\r\nip2locationio 8.8.8.8\r\n```\r\n\r\n### Query IP geolocation for specific IP (pretty print)\r\n```bash\r\nip2locationio -o pretty 8.8.8.8\r\n```\r\n\r\n### Query IP geolocation for specific IP with translation language (only supported in Plus and Security plans)\r\n```bash\r\nip2locationio -l fr 8.8.8.8\r\n```\r\n\r\n### Query IP geolocation for specific IP and show only specific result fields\r\n```bash\r\nip2locationio -f country_code,region_name,city_name,continent.name,country.alpha3_code 8.8.8.8\r\n```\r\n\r\n### Generate random IPv4 address\r\n```bash\r\nip2locationio randip\r\n```\r\n\r\n### Convert CIDR to range\r\n```bash\r\nip2locationio cidr2range \u003cCIDR\u003e\r\n```\r\n\r\n### Convert range to CIDR\r\n```bash\r\nip2locationio range2cidr \u003cSTART IP\u003e \u003cEND IP\u003e\r\n```\r\n\r\n### List out the IPs in a CIDR\r\n```bash\r\nip2locationio cidr2list \u003cCIDR\u003e\r\n```\r\n\r\n### List out the IPs in a range\r\n```bash\r\nip2locationio range2list \u003cSTART IP\u003e \u003cEND IP\u003e\r\n```\r\n\r\n### Split a larger CIDR into smaller ones\r\n```bash\r\nip2locationio splitcidr \u003cCIDR\u003e \u003cSPLIT\u003e\r\n```\r\n\r\n\r\nExample API Response\r\n====================\r\n```json\r\n{\r\n  \"ip\": \"8.8.8.8\",\r\n  \"country_code\": \"US\",\r\n  \"country_name\": \"United States of America\",\r\n  \"region_name\": \"California\",\r\n  \"city_name\": \"Mountain View\",\r\n  \"latitude\": 37.405992,\r\n  \"longitude\": -122.078515,\r\n  \"zip_code\": \"94043\",\r\n  \"time_zone\": \"-07:00\",\r\n  \"asn\": \"15169\",\r\n  \"as\": \"Google LLC\",\r\n  \"isp\": \"Google LLC\",\r\n  \"domain\": \"google.com\",\r\n  \"net_speed\": \"T1\",\r\n  \"idd_code\": \"1\",\r\n  \"area_code\": \"650\",\r\n  \"weather_station_code\": \"USCA0746\",\r\n  \"weather_station_name\": \"Mountain View\",\r\n  \"mcc\": \"-\",\r\n  \"mnc\": \"-\",\r\n  \"mobile_brand\": \"-\",\r\n  \"elevation\": 32,\r\n  \"usage_type\": \"DCH\",\r\n  \"address_type\": \"Anycast\",\r\n  \"continent\": {\r\n    \"name\": \"North America\",\r\n    \"code\": \"NA\",\r\n    \"hemisphere\": [\r\n      \"north\",\r\n      \"west\"\r\n    ],\r\n    \"translation\": {\r\n      \"lang\": \"es\",\r\n      \"value\": \"Norteamérica\"\r\n    }\r\n  },\r\n  \"district\": \"Santa Clara County\",\r\n  \"country\": {\r\n    \"name\": \"United States of America\",\r\n    \"alpha3_code\": \"USA\",\r\n    \"numeric_code\": 840,\r\n    \"demonym\": \"Americans\",\r\n    \"flag\": \"https://cdn.ip2location.io/assets/img/flags/us.png\",\r\n    \"capital\": \"Washington, D.C.\",\r\n    \"total_area\": 9826675,\r\n    \"population\": 331002651,\r\n    \"currency\": {\r\n      \"code\": \"USD\",\r\n      \"name\": \"United States Dollar\",\r\n      \"symbol\": \"$\"\r\n    },\r\n    \"language\": {\r\n      \"code\": \"EN\",\r\n      \"name\": \"English\"\r\n    },\r\n    \"tld\": \"us\",\r\n    \"translation\": {\r\n      \"lang\": \"es\",\r\n      \"value\": \"Estados Unidos de América (los)\"\r\n    }\r\n  },\r\n  \"region\": {\r\n    \"name\": \"California\",\r\n    \"code\": \"US-CA\",\r\n    \"translation\": {\r\n      \"lang\": \"es\",\r\n      \"value\": \"California\"\r\n    }\r\n  },\r\n  \"city\": {\r\n    \"name\": \"Mountain View\",\r\n    \"translation\": {\r\n      \"lang\": null,\r\n      \"value\": null\r\n    }\r\n  },\r\n  \"time_zone_info\": {\r\n    \"olson\": \"America/Los_Angeles\",\r\n    \"current_time\": \"2023-09-03T18:21:13-07:00\",\r\n    \"gmt_offset\": -25200,\r\n    \"is_dst\": true,\r\n    \"sunrise\": \"06:41\",\r\n    \"sunset\": \"19:33\"\r\n  },\r\n  \"geotargeting\": {\r\n    \"metro\": \"807\"\r\n  },\r\n  \"ads_category\": \"IAB19-11\",\r\n  \"ads_category_name\": \"Data Centers\",\r\n  \"is_proxy\": false,\r\n  \"fraud_score\": 0,\r\n  \"proxy\": {\r\n    \"last_seen\": 3,\r\n    \"proxy_type\": \"DCH\",\r\n    \"threat\": \"-\",\r\n    \"provider\": \"-\",\r\n    \"is_vpn\": false,\r\n    \"is_tor\": false,\r\n    \"is_data_center\": true,\r\n    \"is_public_proxy\": false,\r\n    \"is_web_proxy\": false,\r\n    \"is_web_crawler\": false,\r\n    \"is_residential_proxy\": false,\r\n    \"is_spammer\": false,\r\n    \"is_scanner\": false,\r\n    \"is_botnet\": false\r\n  }\r\n}\r\n```\r\n\r\n\r\nLICENCE\r\n=====================\r\nSee the LICENSE file.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fip2location%2Fip2location-io-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fip2location%2Fip2location-io-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fip2location%2Fip2location-io-cli/lists"}