Skip to content

Commit eecb6e9

Browse files
committed
logs
1 parent be783e0 commit eecb6e9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

api_app/analyzers_manager/file_analyzers/polyswarm.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl
22
# See the file 'LICENSE' for copying permission.
3+
import json
34
import logging
45

56
from polyswarm_api.api import PolyswarmAPI
@@ -12,7 +13,7 @@
1213

1314

1415
class Polyswarm(FileAnalyzer):
15-
url = " https://api.polyswarm.network/v3"
16+
url = "https://api.polyswarm.network/v3"
1617
_api_key: str = None
1718
timeout: int = 60 * 15 # default as in the package settings
1819
polyswarm_community: str = "default"
@@ -39,8 +40,8 @@ def construct_result(result):
3940
res["md5"] = result.md5
4041
res["sha1"] = result.sha1
4142
res["extended_type"] = result.extended_type
42-
res["first_seen"] = result.first_seen
43-
res["last_seen"] = result.last_seen
43+
res["first_seen"] = result.first_seen.isoformat()
44+
res["last_seen"] = result.last_seen.isoformat()
4445
res["permalink"] = result.permalink
4546
return res
4647

@@ -53,6 +54,10 @@ def run(self):
5354
f"Failed to get results from Polyswarm for {self.md5}"
5455
)
5556
result = self.construct_result(result)
57+
58+
json_result = json.dumps(result)
59+
logger.info(f"Polyswarm result: {json_result}")
60+
5661
return result
5762

5863
def update(self):
@@ -89,8 +94,8 @@ def _monkeypatch(cls):
8994
"md5": "76deca20806c16df50ffeda163fd50e9",
9095
"sha1": "99ff1cd17aea94feb355e7bdb01e9f788a4971bb",
9196
"extended_type": "GIF image data, version 89a, 821 x 500",
92-
"first_seen": "datetime.datetime(2024, 7, 27, 20, 20, 12, 121980)",
93-
"last_seen": "datetime.datetime(2024, 7, 27, 20, 20, 12, 121980)",
97+
"first_seen": "2024-07-27T20:20:12.121980",
98+
"last_seen": "2024-07-27T20:20:12.121980",
9499
"permalink": "https://polyswarm.network/scan/results/file/50f4d8be8d47d26ecb04f1a24f17a39f3ea194d8cdc3b833aef2df88e1ce828b/76218824984622961",
95100
},
96101
),

0 commit comments

Comments
 (0)