Skip to content
New issue

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

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

Already on GitHub? # to your account

fixed apivoid + pr template #2714

Merged
merged 1 commit into from
Feb 5, 2025
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
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Please delete options that are not relevant.
- [ ] If the plugin interacts with an external service, I have created an attribute called precisely `url` that contains this information. This is required for Health Checks.
- [ ] If the plugin requires mocked testing, `_monkeypatch()` was used in its class to apply the necessary decorators.
- [ ] I have added that raw JSON sample to the `MockUpResponse` of the `_monkeypatch()` method. This serves us to provide a valid sample for testing.
- [ ] I have inserted the copyright banner at the start of the file: ```# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl # See the file 'LICENSE' for copying permission.```
- [ ] If external libraries/packages with restrictive licenses were used, they were added in the [Legal Notice](https://github.com/certego/IntelOwl/blob/master/.github/legal_notice.md) section.
- [ ] Linters (`Black`, `Flake`, `Isort`) gave 0 errors. If you have correctly installed [pre-commit](https://intelowlproject.github.io/docs/IntelOwl/contribute/#how-to-start-setup-project-and-development-instance), it does these checks and adjustments on your behalf.
- [ ] I have added tests for the feature/bug I solved (see `tests` folder). All the tests (new and old ones) gave 0 errors.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl
# See the file 'LICENSE' for copying permission.
import logging
import math

Expand Down
31 changes: 11 additions & 20 deletions api_app/analyzers_manager/observable_analyzers/apivoid.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# flake8: noqa
# done for the mocked respose,
# done for the mocked response,
# everything else is linted and tested
# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl
# See the file 'LICENSE' for copying permission.
import requests

from api_app.analyzers_manager import classes
from api_app.analyzers_manager.exceptions import AnalyzerConfigurationException
from tests.mock_utils import MockUpResponse, if_mock_connections, patch


Expand All @@ -16,27 +19,15 @@ def update(self):

def run(self):
if self.observable_classification == self.ObservableTypes.DOMAIN.value:
url = (
self.url
+ f"""/domainbl/v1/pay-as-you-go/
?key={self._api_key}
&host={self.observable_name}"""
)
path = "domainbl"
elif self.observable_classification == self.ObservableTypes.IP.value:
url = (
self.url
+ f"""/iprep/v1/pay-as-you-go/
?key={self._api_key}
&ip={self.observable_name}"""
)
path = "iprep"
elif self.observable_classification == self.ObservableTypes.URL.value:
url = (
self.url
+ f"""/urlrep/v1/pay-as-you-go/
?key={self._api_key}
&url={self.observable_name}"""
)
r = requests.get(url)
path = "urlrep"
else:
raise AnalyzerConfigurationException("not supported")
complete_url = f"{self.url}/{path}/v1/pay-as-you-go/?key={self._api_key}&host={self.observable_name}"
r = requests.get(complete_url)
r.raise_for_status()
return r.json()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl
# See the file 'LICENSE' for copying permission.
import base64
import logging
from tempfile import NamedTemporaryFile
Expand Down
Loading