Skip to content

Instantly share code, notes, and snippets.

# The IPs inside input.txt file.
75.72.7.215
216.189.129.6
38.88.189.58
# Using the `xargs` command to perform lookup for each of the IP.
cat input.txt | xargs -I% curl http://ipinfo.io/%/country
# Output.
US
ipinfo.io/domains/COMPANY_DOMAIN_NAME?token=YOUR_ACCESS_TOKEN
ipinfo.io/ranges/COMPANY_DOMAIN_NAME?token=YOUR_ACCESS_TOKEN
ipinfo.io/ASN_NUMBER/json?token=YOUR_ACCESS_TOKEN
pip install ipinfo
@saqibameen
saqibameen / ipinfo-demo.py
Created February 8, 2019 23:19
Simple IPInfo demo program written in python
# Import the package.
import ipinfo
# Set the access token.
accessToken = 'abc12345678'
# Authenticate and get API handler object.
handler = ipinfo.getHandler(accessToken)
# IP Adress to look for.
ipAddress = '216.239.36.21'
# Grab the data from API.
@saqibameen
saqibameen / ipinfo-response.json
Last active February 8, 2019 21:24
IPInfo.io sample response
{
"ip": "66.87.125.72",
"hostname": "66-87-125-72.pools.spcsdns.net",
"city": "Southbridge",
"region": "Massachusetts",
"country": "US",
"loc": "42.0707,-72.0440",
"postal": "01550",
"asn": {
"asn": "AS10507",
@saqibameen
saqibameen / ipinfo-response.json
Created February 8, 2019 21:22
IPInfo.io sample response
{
"ip": "66.87.125.72",
"hostname": "66-87-125-72.pools.spcsdns.net",
"city": "Southbridge",
"region": "Massachusetts",
"country": "US",
"loc": "42.0707,-72.0440",
"postal": "01550",
"asn": {
"asn": "AS10507",
@saqibameen
saqibameen / fn.sh
Created January 26, 2019 15:07
make a folder and move to it
function mkcdr {
if [[ $# = 0 ]]
then
echo "🧟‍♂️ invalid argument"
else
dirName="$1"
mkdir "$dirName" && cd "$dirName"
fi
}
@saqibameen
saqibameen / requester-lookup-endpoint-ipstack-api
Created September 3, 2018 06:09
Endpoint for the requester lookup
https://api.ipstack.com/check?access_key=YOUR_ACCESS_KEY