简体   繁体   中英

Ubuntu JSON API script to search IPs

I'm after firstly formatting a curl JSON API link in Ubuntu, as you can see in my picture, on the website JSON is formatted correctly, via Ubuntu Its just a bunch of word-wrapped code.

I tried using | jq | jq at the end but that didn't work like so

curl https://www.abuseipdb.com/check/51.38.41.14/json? 
key=my_key_here&days=7&verbose | jq

(not including my API key) (51.38.41.14) Is a spammer IP

Once this is figured out I would then want to script it so I run an alias called IPDB that asks me the IP and displays the curl address API request

Any guidance would be apprecaited

在此处输入图片说明

And again I figured it out for myself, no Idea why I joined today seen as I answered all my own questions :) It might be helpful to someone in the future.

Make a text file and call it abuse.sh and copy the below text into it, then run the script and it will ask for a IP

echo Please enter IP to search
read -p 'IPaddress: ' IP
echo curl -s https://www.abuseipdb.com/check/$IP/json?key=your_key_here=7&verbose' | jq

I have taken my API key out, but you can get a free one from their website.

This script is for IP checking to see if the IP Is an abuser(spammer, hacker etc). I work for an ISP and wanted to automate how to check for IPs besides using good ole mxtoolbox.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM