Skip to content

Commit

Permalink
Merge pull request #94 from intezer/feat(endpoint)/add_scan_start_and…
Browse files Browse the repository at this point in the history
…_end_time

Add endpoint scan start and end time for endpoint analysis
  • Loading branch information
ofirit committed May 10, 2023
2 parents f52e18c + e608117 commit 2b3dd07
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.16.9
----
- Add endpoint scan start and end time for endpoint analysis

1.16.8
____
- Get latest URL analysis bugfix
Expand Down
2 changes: 1 addition & 1 deletion intezer_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.16.8'
__version__ = '1.16.9'
11 changes: 11 additions & 0 deletions intezer_sdk/endpoint_analysis.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import concurrent.futures
import datetime
import glob
import json
import logging
import os
import pathlib
from typing import List
from typing import Optional

from intezer_sdk import consts
from intezer_sdk._api import IntezerApi
Expand Down Expand Up @@ -55,6 +57,8 @@ def __init__(self,

self._sub_analyses: List[SubAnalysis] = []
self._scan_id = None
self.scan_start_time: Optional[datetime.datetime] = None
self.scan_end_time: Optional[datetime.datetime] = None

@classmethod
def from_analysis_id(cls, analysis_id: str, api: IntezerApiClient = None):
Expand All @@ -69,6 +73,13 @@ def from_analysis_id(cls, analysis_id: str, api: IntezerApiClient = None):
response = IntezerApi(api or get_global_api()).get_endpoint_analysis_response(analysis_id, True)
return cls._create_analysis_from_response(response, api, analysis_id)

def _set_report(self, report: dict):
super()._set_report(report)
if 'scan_start_time' in report:
self.scan_start_time = datetime.datetime.strptime(report['scan_start_time'], consts.DEFAULT_DATE_FORMAT)
if 'scan_end_time' in report:
self.scan_end_time = datetime.datetime.strptime(report['scan_end_time'], consts.DEFAULT_DATE_FORMAT)

def _query_status_from_api(self):
return self._api.get_endpoint_analysis_response(self.analysis_id, False)

Expand Down

0 comments on commit 2b3dd07

Please sign in to comment.