How does tools like this work? Is it triangulated by pinging from different location?
q3k@anathema ~ $ whois 185.236.240.1 | egrep '(address|org-name)'
org-name: Stowarzyszenie "Warszawski Hackerspace"
[...]
address: Warszawa
q3k@anathema ~ $ curl -s https://ip-api.io/json/185.236.240.1 | jq .organisation,.country_name
"Stowarzyszenie Warszawski Hackerspace"
"Poland"
However, this generally doesn't work for multinational ISPs that have blocks in different countries. For instance, take this Google IP address that I got when I spun up a VM in their Belgium DC: q3k@anathema ~ $ curl -s https://ip-api.io/json/104.155.39.247 | jq .organisation,.country_name
"Google LLC"
"United States"I think countries themselves have ranges of IPs allocated to them, but again, not my area of expertise.
You can always use `whois` on an IP address from a command line to get all the public records about it that you need. This will have information about the RIR, LIR, and potentially end-user of the block.