Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: RIPE expert: handle unknown response for non-ASN types #2461

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
- `intelmq.bots.experts.jinja` (PR#2417 by Mikk Margus Möll):
- Add optional `socket_perms` and `socket_group` parameters to change
file permissions on socket file, if it is in use.
- `intelmq.bots.experts.ripe` (PR#2461 by Mikk Margus Möll):
- Handle "No abuse contact found for" messages for non-ASN resources

#### Outputs
- `intelmq.bots.outputs.stomp.output` (PR#2408 and PR#2414 by Jan Kaliszewski):
Expand Down
2 changes: 1 addition & 1 deletion intelmq/bots/experts/ripe/expert.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __perform_cached_query(self, type, resource):
data="", timeout=self.http_timeout_sec)

if response.status_code != 200:
if type == 'db_asn' and response.status_code == 404:
if response.status_code == 404:
""" If no abuse contact could be found, a 404 is given. """
try:
if response.json()['message'].startswith('No abuse contact found for '):
Expand Down
9 changes: 9 additions & 0 deletions intelmq/tests/bots/experts/ripe/test_expert.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
"source.ip": "228.66.141.189",
}

ARIN_IP_EVENT = {"__type": "Event",
"source.ip": "2001:500:110:201::47"}

@test.skip_internet()
class TestRIPEExpertBot(test.BotTestCase, unittest.TestCase):
"""
Expand Down Expand Up @@ -263,5 +266,11 @@ def test_index_error(self):
self.run_bot()
self.assertMessageEqual(0, INDEX_ERROR)

def test_arin_ip(self):
self.input_message = ARIN_IP_EVENT
self.run_bot()
self.assertMessageEqual(0, ARIN_IP_EVENT)


if __name__ == '__main__': # pragma: no cover
unittest.main()
Loading