Created
June 3, 2022 18:25
-
-
Save superducktoes/8ee237d6b92070a62cb0c5a1358656ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fileinput | |
import re | |
from greynoise import GreyNoise | |
# command usage: cat <file_ips>.txt| python3 file_ips_lookup.py | |
api_client = GreyNoise(api_key="") | |
ip_list = [] | |
# parse file for ips | |
for line in fileinput.input(): | |
ip = re.findall( r'[0-9]+(?:\.[0-9]+){3}', line ) | |
if ip: | |
for i in ip: | |
ip_list.append(i) | |
# lookup ips | |
greynoise_results = api_client.quick(ip_list) | |
for i in greynoise_results: | |
print("IP: {} - Noise Status: {}".format(i["ip"], i["noise"])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment