GreyNoise-Intelligence / pygreynoise

Python3 library and command line for GreyNoise

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add feature to allow API Quick IP lookup to return invalid IPs in JSON response

bradchiappetta opened this issue · comments

Currently, only a log message is returned when an invalid IP is discovered on an IP quick lookup using the API:

2020-12-30 14:46.39 [warning  ] Invalid IP address: '110.153.82.818' [greynoise.util] ip_address=110.153.82.818
[{'ip': '110.153.82.88', 'noise': False, 'code': '0x00', 'code_message': 'IP has never been observed scanning the Internet'}]

For some integrations, the invalid IP needs to be included in the response message so it can be parsed by the tool, since the tool may not have access to the log messages. So we should add an option to return an "invalid IP" message in the response JSON, such as:

2020-12-30 14:46.39 [warning  ] Invalid IP address: '110.153.82.818' [greynoise.util] ip_address=110.153.82.818
[{'ip': '110.153.82.88', 'noise': False, 'code': '0x00', 'code_message': 'IP has never been observed scanning the Internet'}, {'ip': '8.8.8.8', 'noise': False, 'code': '0x00', 'code_message': 'IP has never been observed scanning the Internet'}, {'ip': '110.153.82.818', 'noise': False, 'code': '404', 'code_message': 'IP is Invalid'}]