IP-Geolocation
This is a sample script That you can get the geolocation with the ip address.
IP-Geolocation
Introduction
Im going to do a basic script, that you can get the location of ip addresse’s
1
2
3
4
5
6
7
#!/bin/bash
echo "Dame la ip que quieres geolocalizar"
read ip
if [ -z "$ip" ]; then
exit 1
fi
curl ipinfo.io/$ip?token=17ee73b03b28ca
Explanation
echoThis command displays text or values in the terminalreadThis reads the data that the user type and store in the variableif [ -z "$ip" ]; then, condition checks if the variable is emptycurlcalls the ipinfo.io API with the IP provided by the user
Usage, you have to save the script and give permition chmod +x and run
./script.sh
Here is the basic code
https://github.com/xFraylin/iplocation
You can copy the code, You can edit if you want.
This post is licensed under CC BY 4.0 by the author.
