Skip to content

Commit 60122ff

Browse files
authored
Merge pull request #187 from intelowlproject/develop
4.4.1
2 parents 9b5c265 + 9923518 commit 60122ff

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

.github/CHANGELOG.md

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

3+
## [4.4.1](https://github.com/intelowlproject/pyintelowl/releases/tag/4.4.1)
4+
- Analyzing a File with a Playbook now works correctly
5+
- other little bug fixing
6+
37
## [4.4.0](https://github.com/intelowlproject/pyintelowl/releases/tag/4.4.0)
48
- this version supports the usage of a proxy while connecting to IntelOwl via Python code.
59

.github/workflows/pull_request_automation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
fail-fast: false
1212
max-parallel: 5
1313
matrix:
14-
python-version: ['3.7', '3.8', '3.9.7', '3.10']
14+
python-version: ['3.7', '3.8', '3.9', '3.10']
1515

1616
steps:
1717
- uses: actions/checkout@v2

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.4.0"
16+
VERSION = "4.4.1"
1717
GITHUB_URL = "https://github.com/intelowlproject/pyintelowl"
1818

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

pyintelowl/pyintelowl.py

+16-9
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ def send_file_analysis_playbook_request(
261261

262262
if runtime_configuration:
263263
data["runtime_configuration"] = json.dumps(runtime_configuration)
264-
files = {"file": (filename, binary)}
264+
# `files` is wanted to be different from the other
265+
# /api/analyze_file endpoint
266+
# because the server is using different serializers
267+
files = {"files": (filename, binary)}
265268
answer = self.__send_analysis_request(
266269
data=data, files=files, playbook_mode=True
267270
)
@@ -472,6 +475,7 @@ def __send_analysis_request(self, data=None, files=None, playbook_mode=False):
472475
Internal use only.
473476
"""
474477
response = None
478+
answer = {}
475479
if files is None:
476480
url = self.instance + "/api/analyze_observable"
477481
if playbook_mode:
@@ -495,7 +499,9 @@ def __send_analysis_request(self, data=None, files=None, playbook_mode=False):
495499
answer = response.json()
496500
if playbook_mode:
497501
# right now, we are only supporting single input result
498-
answer = answer.get("results", [])[0]
502+
answers = answer.get("results", [])
503+
if answers:
504+
answer = answers[0]
499505

500506
warnings = answer.get("warnings", [])
501507
if self.cli:
@@ -505,11 +511,12 @@ def __send_analysis_request(self, data=None, files=None, playbook_mode=False):
505511
[i yellow]{warnings if warnings else None}[/]
506512
"""
507513
else:
508-
info_log = f"""New Job running..
509-
ID: {answer['job_id']} | Status: {answer['status']}.
510-
Got {len(warnings)} warnings:
511-
{warnings if warnings else None}
512-
"""
514+
info_log = (
515+
f"New Job running.. ID: {answer['job_id']} "
516+
f"| Status: {answer['status']}."
517+
f" Got {len(warnings)} warnings:"
518+
f" {warnings if warnings else None}"
519+
)
513520
self.logger.info(info_log)
514521
response.raise_for_status()
515522
except Exception as e:
@@ -813,12 +820,12 @@ def _new_analysis_playbook_cli(
813820

814821
# 2nd step: poll for result
815822
if should_poll:
816-
if resp["status"] != "accepted":
823+
if resp.get("status", "") != "accepted":
817824
self.logger.fatal("Can't poll a failed job")
818825
# import poll function
819826
from .cli._jobs_utils import _poll_for_job_cli
820827

821-
job_id = resp["job_id"]
828+
job_id = resp.get("job_id", 0)
822829
_ = _poll_for_job_cli(self, job_id)
823830
self.logger.info(
824831
f"""

pyintelowl/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.4.0"
1+
__version__ = "4.4.1"

0 commit comments

Comments
 (0)