简体   繁体   English

Ubuntu JSON API脚本来搜索IP

[英]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. 我首先在Ubuntu中格式化了curl JSON API链接,如您在我的图片中所见,在网站上JSON是通过Ubuntu正确格式化的,它只是一堆单词包装的代码。

I tried using | jq 我尝试使用| jq | jq at the end but that didn't work like so | jq的结尾,但是那样就| jq

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 (不包括我的API密钥)(51.38.41.14)是垃圾邮件发送者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 一旦找出来,我便要编写脚本,因此我运行一个名为IPDB的别名,该别名询问我IP地址并显示curl地址API请求

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 制作一个文本文件并将其命名为abuse.sh并将以下文本复制到其中,然后运行脚本,它将要求输入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. 我已经拿走了我的API密钥,但是您可以从他们的网站上免费获得一个。

This script is for IP checking to see if the IP Is an abuser(spammer, hacker etc). 该脚本用于IP检查,以查看IP是否是滥用者(垃圾邮件发送者,黑客等)。 I work for an ISP and wanted to automate how to check for IPs besides using good ole mxtoolbox. 我为ISP工作,除了要使用优质的ole mxtoolbox之外,还想自动化如何检查IP。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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