PDA

View Full Version : [Solved] How to extract all IPs from the output of the Linux command?



Fli
05-28-2018, 07:42 AM
Hello,

the command i was given to get output with IPs and other data:


curl -G https://www.abuseipdb.com/api/v****/blacklist \
-d countMinimum=15 \
-d maxAgeInDays=60 \
-d confidenceMinimum=90 \
-d key=MyKeyHere \
-H "Accept: application/json" > abuseipdb

It would create abuseipdb file with something like:
...nceScore":100},{"ipAddress":"180.76.160.50","totalReports":17,"abuseConfidenceScore":100},{"ipAddress":"185.249.199.28","totalReports":17,"abuseConfidenceScore":100},{"ipAddre...

So it contains How to extract only IPs, prefferably without saving whole output to a file first, but saving only IP list into file?

SOLUTION: replace:
> abuseipdb

by:
| grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" > abuseipdb