Skip to content

Commit 81e97a7

Browse files
authored
Merge pull request #164 from intelowlproject/develop
4.1.5
2 parents b707517 + 5e6d9f8 commit 81e97a7

11 files changed

+62
-12
lines changed

.flac

Whitespace-only changes.

.github/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## [4.1.5](https://github.com/intelowlproject/pyintelowl/releases/tag/4.1.5)
4+
5+
- dependencies upgrade
6+
- #163
7+
38
## [4.1.4](https://github.com/intelowlproject/pyintelowl/releases/tag/4.1.4)
49

510
- Added support for URLs that use TCP as protocol

.github/release_template.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Checklist for creating a new release
2+
3+
- [ ] Update `CHANGELOG.md` for the new version
4+
- [ ] Change version number in `docs.config.py`, `pyintelowl/version.py`
5+
- [ ] Verify CI Tests
6+
- [ ] Merge the PR to the `master` branch. **Note:** Only use "Merge and commit" as the merge strategy and not "Squash and merge". Using "Squash and merge" makes history between branches misaligned.
7+
8+

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 21.9b0
3+
rev: 22.3.0
44
hooks:
55
- id: black
66
- repo: https://gitlab.com/pycqa/flake8

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import os
1414
import sys
1515

16-
VERSION = "4.1.4"
16+
VERSION = "4.1.5"
1717
GITHUB_URL = "https://github.com/intelowlproject/pyintelowl"
1818

1919
sys.path.append(os.path.abspath("../"))

docs/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Sphinx==4.1.1
1+
Sphinx==5.0.1
22
sphinx-rtd-theme
33
sphinxcontrib.asciinema
44
sphinxcontrib-napoleon

pyintelowl/pyintelowl.py

+22-3
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def send_observable_analysis_request(
211211
connectors_requested: List[str] = None,
212212
runtime_configuration: Dict = None,
213213
tags_labels: List[str] = None,
214+
observable_classification: str = None,
214215
) -> Dict:
215216
"""Send analysis request for an observable.\n
216217
Endpoint: ``/api/analyze_observable``
@@ -231,9 +232,14 @@ def send_observable_analysis_request(
231232
Overwrite configuration for analyzers. Defaults to ``{}``.
232233
tags_labels (List[str], optional):
233234
List of tag labels to assign (creates non-existing tags)
235+
observable_classification (str):
236+
Observable classification, Default to None.
237+
By default launch analysis with an automatic classification.
238+
(options: ``url, domain, hash, ip, generic``)
234239
235240
Raises:
236241
IntelOwlClientException: on client/HTTP error
242+
IntelOwlClientException: on wrong observable_classification
237243
238244
Returns:
239245
Dict: JSON body
@@ -249,11 +255,24 @@ def send_observable_analysis_request(
249255
tags_labels = []
250256
if not runtime_configuration:
251257
runtime_configuration = {}
258+
if not observable_classification:
259+
observable_classification = self._get_observable_classification(
260+
observable_name
261+
)
262+
elif observable_classification not in [
263+
"generic",
264+
"hash",
265+
"ip",
266+
"domain",
267+
"url",
268+
]:
269+
raise IntelOwlClientException(
270+
"Observable classification only handle"
271+
" 'generic', 'hash', 'ip', 'domain' and 'url' "
272+
)
252273
data = {
253274
"observable_name": observable_name,
254-
"observable_classification": self._get_observable_classification(
255-
observable_name
256-
),
275+
"observable_classification": observable_classification,
257276
"analyzers_requested": analyzers_requested,
258277
"connectors_requested": connectors_requested,
259278
"tlp": tlp,

pyintelowl/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.1.4"
1+
__version__ = "4.1.5"

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
requests~=2.26
1+
requests~=2.27
22
geocoder~=1.38
33
click>=7.0
44
rich~=10.13

test-requirements.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
black==21.9b0
1+
black==22.3.0
22
flake8==4.0.1
33
isort==5.10.1
4-
pre-commit==2.12.1
5-
tox==3.24.4
6-
tox-gh-actions==2.5.0
4+
pre-commit==2.17.0
5+
tox==3.24.5
6+
tox-gh-actions==2.9.1
77
codecov==2.1.12

tests/test_general.py

+18
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,24 @@ def test_send_observable_analysis_request_failure(self, mocked_requests):
114114
runtime_configuration=runtime_config,
115115
)
116116

117+
@mock_connections(
118+
patch("requests.Session.post", side_effect=mocked_raise_exception)
119+
)
120+
def test_send_observable_analysis_request_failure_classify(self, mocked_requests):
121+
observable_name = self.domain
122+
analyzers_requested = ["test_1", "test_2"]
123+
connectors_requested = ["test_1", "test_2"]
124+
runtime_config = {"test_key": "test_param"}
125+
observable_classification = "unavailable"
126+
with self.assertRaises(IntelOwlClientException):
127+
self.client.send_observable_analysis_request(
128+
observable_name,
129+
analyzers_requested=analyzers_requested,
130+
connectors_requested=connectors_requested,
131+
runtime_configuration=runtime_config,
132+
observable_classification=observable_classification,
133+
)
134+
117135
@mock_connections(
118136
patch("requests.Session.post", side_effect=mocked_send_analysis_success)
119137
)

0 commit comments

Comments
 (0)