Skip to content

Commit ccdacfa

Browse files
mlodiceshaan70ssigeno
authored
Isort linter addition + fix to s3 storage, intezer and fortiguard analyzer, dockerfile versions, CI python version + added "minutes_ago" to "ask_analysis_availability" API (#760)
* added isort * added isort to requirements * isorted files * updated isort * little adjusts * fix to s3 storage * aligned integrations dockerfiles to other dockerfiles version * fixed intezer analyzers to correctly manage HashDoesNotExistError error * fix to fortiguard + updated to python 3.9 in CI * adding "minutes_ago" option to "ask_analysis_availability" + shut down quarkengine test for now * fixup api * adjust in test_api * cherry-picking 0ssigeno work Co-authored-by: Eshaan Bansal <[email protected]> Co-authored-by: Simone Berni <[email protected]>
1 parent 04718d5 commit ccdacfa

File tree

167 files changed

+517
-509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+517
-509
lines changed

.github/workflows/pull_request_automation.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Python
2020
uses: actions/setup-python@v2
2121
with:
22-
python-version: 3.8
22+
python-version: 3.9
2323
- name: Before Install
2424
run: |
2525
sudo apt-get update
@@ -40,6 +40,9 @@ jobs:
4040
- name: "Lint with flake8 (PEP8 enforcer + linter)"
4141
run: |
4242
sudo docker exec intelowl_uwsgi flake8 . --count
43+
- name: "Isort check"
44+
run: |
45+
sudo docker exec intelowl_uwsgi isort . --profile black --filter-files --check-only --diff
4346
- name: "Test: API"
4447
run: |
4548
sudo docker/scripts/coverage_test.sh tests.test_api tests.test_auth

.pre-commit-config.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 20.8b1
3+
rev: 21.9b0
44
hooks:
55
- id: black
66
- repo: https://gitlab.com/pycqa/flake8
7-
rev: 3.8.4
7+
rev: 4.0.1
88
hooks:
99
- id: flake8
10+
- repo: https://github.com/pycqa/isort
11+
rev: 5.10.1
12+
hooks:
13+
- id: isort
14+
args: ["--profile", "black", "--filter-files"]

api_app/admin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# See the file 'LICENSE' for copying permission.
33

44
from django.contrib import admin
5-
65
from durin.admin import AuthTokenAdmin
76
from durin.models import AuthToken, Client
87
from guardian.admin import GuardedModelAdmin

api_app/analyzers_manager/classes.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl
22
# See the file 'LICENSE' for copying permission.
33

4-
import time
5-
import logging
6-
import requests
74
import json
5+
import logging
6+
import time
87
from abc import ABCMeta
98

10-
from api_app.exceptions import (
11-
AnalyzerRunException,
12-
AnalyzerConfigurationException,
13-
)
14-
from api_app.core.classes import Plugin
15-
16-
from .models import AnalyzerReport
17-
from .constants import HashChoices, ObservableTypes, TypeChoices
9+
import requests
10+
from django.conf import settings
1811

12+
from api_app.core.classes import Plugin
13+
from api_app.exceptions import AnalyzerConfigurationException, AnalyzerRunException
1914
from tests.mock_utils import (
2015
if_mock_connections,
21-
patch,
2216
mocked_docker_analyzer_get,
2317
mocked_docker_analyzer_post,
18+
patch,
2419
)
25-
from django.conf import settings
20+
21+
from .constants import HashChoices, ObservableTypes, TypeChoices
22+
from .models import AnalyzerReport
2623

2724
logger = logging.getLogger(__name__)
2825

api_app/analyzers_manager/controller.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33

44
import logging
55
from typing import Dict, List
6-
from celery import uuid, chord
7-
from django.utils.module_loading import import_string
6+
7+
from celery import chord, uuid
88
from django.conf import settings
9+
from django.utils.module_loading import import_string
910
from rest_framework.exceptions import ValidationError
1011

1112
from intel_owl.celery import app as celery_app
1213
from intel_owl.consts import DEFAULT_QUEUE
1314

15+
from ..exceptions import AlreadyFailedJobException, NotRunnableAnalyzer
16+
from ..helpers import get_now
17+
from ..models import TLP, Job
1418
from .classes import BaseAnalyzerMixin, DockerBasedAnalyzer
15-
from .models import AnalyzerReport
1619
from .dataclasses import AnalyzerConfig
17-
from ..models import Job, TLP
18-
from ..helpers import get_now
19-
from ..exceptions import AlreadyFailedJobException, NotRunnableAnalyzer
20-
20+
from .models import AnalyzerReport
2121

2222
logger = logging.getLogger(__name__)
2323

api_app/analyzers_manager/dataclasses.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl
22
# See the file 'LICENSE' for copying permission.
3-
import typing
43
import dataclasses
4+
import typing
55

66
from api_app.core.dataclasses import AbstractConfig
7-
from .constants import TypeChoices, HashChoices
7+
8+
from .constants import HashChoices, TypeChoices
89
from .serializers import AnalyzerConfigSerializer
910

1011
__all__ = [

api_app/analyzers_manager/file_analyzers/apkid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl
22
# See the file 'LICENSE' for copying permission.
33

4-
from api_app.analyzers_manager.classes import FileAnalyzer, DockerBasedAnalyzer
4+
from api_app.analyzers_manager.classes import DockerBasedAnalyzer, FileAnalyzer
55

66

77
class APKiD(FileAnalyzer, DockerBasedAnalyzer):

api_app/analyzers_manager/file_analyzers/boxjs_scan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl
22
# See the file 'LICENSE' for copying permission.
33

4-
from api_app.analyzers_manager.classes import FileAnalyzer, DockerBasedAnalyzer
4+
from api_app.analyzers_manager.classes import DockerBasedAnalyzer, FileAnalyzer
55

66

77
class BoxJS(FileAnalyzer, DockerBasedAnalyzer):

api_app/analyzers_manager/file_analyzers/capa_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl
22
# See the file 'LICENSE' for copying permission.
33

4-
from api_app.analyzers_manager.classes import FileAnalyzer, DockerBasedAnalyzer
4+
from api_app.analyzers_manager.classes import DockerBasedAnalyzer, FileAnalyzer
55

66

77
class CapaInfo(FileAnalyzer, DockerBasedAnalyzer):

api_app/analyzers_manager/file_analyzers/clamav.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl
22
# See the file 'LICENSE' for copying permission.
33

4-
from api_app.analyzers_manager.classes import FileAnalyzer, DockerBasedAnalyzer
4+
from api_app.analyzers_manager.classes import DockerBasedAnalyzer, FileAnalyzer
55

66

77
class ClamAV(FileAnalyzer, DockerBasedAnalyzer):

0 commit comments

Comments
 (0)