Skip to content

Added Shodan Alert API Collector #2618

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

sebix
Copy link
Member

@sebix sebix commented Jun 19, 2025

Created in cooperation with Malawi CERT

@sebix sebix added feature Indicates new feature requests or new features component: bots labels Jun 19, 2025
@sebix
Copy link
Member Author

sebix commented Jun 19, 2025

test will succeed with #2619

raise ValueError("Library 'shodan' is needed but not installed.")

self.set_request_parameters()
if tuple(int(v) for v in pkg_resources.get_distribution("shodan").version.split('.')) <= (1, 8, 1):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Looks like pkg_resources is not imported
  2. It's deprecated anyway, and will be gone soon, please use replacements

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Let's add this check to check method

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IntelMQ uses pkg_resources a lot, so to get rid of it, we will need to change a few more code lines.

For the sake of consistency and not to introduce deviant code, I'd like to keep pkg_resources here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add this check to check method

Good idea, but the static check method can't call the non-static self.set_request_parameters() which processes and provides the proxy parameters :/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you don't need proxy to check the library version, just extract checking to a static method. Or is there a kind of import/patching race condition?

Copy link
Contributor

@kamil-certat kamil-certat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, I'd still suggest adding the check method with lib version check :)

@sebix sebix force-pushed the shodan-alert branch 5 times, most recently from c5de2cf to 059adfc Compare July 18, 2025 09:02
@sebix
Copy link
Member Author

sebix commented Jul 18, 2025

I don't yet know what causes the tests fail about the check method. Maybe I miss the forest for the trees.

EDIT: Yep, was exactly that 🙈

@sebix sebix force-pushed the shodan-alert branch 3 times, most recently from 4820306 to 25fd943 Compare July 18, 2025 10:17
In cooperation with Malawi CERT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: bots feature Indicates new feature requests or new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants