Skip to content

Commit b707517

Browse files
authored
Merge pull request #141 from intelowlproject/develop
4.1.4
2 parents dec9e88 + cadc8cf commit b707517

25 files changed

+101
-102
lines changed

.github/CHANGELOG.md

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

3+
## [4.1.4](https://github.com/intelowlproject/pyintelowl/releases/tag/4.1.4)
4+
5+
- Added support for URLs that use TCP as protocol
6+
- Updated linters + formatted code with `isort`
7+
38
## [4.1.3](https://github.com/intelowlproject/pyintelowl/releases/tag/4.1.3)
49

510
- Library: `IntelOwl.ask_analysis_availability` now accepts an argument `minutes_ago`. Use to specify number of minutes to go back when searching for a previous analysis.

.github/workflows/pull_request_automation.yml

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ jobs:
3131
flake8 . --count
3232
black . --check
3333
34+
- name: isort
35+
run: |
36+
isort . --profile black --filter-files --check-only --diff --skip venv
37+
3438
- name: Run tox tests
3539
run: |
3640
unzip -P infected tests/test_files.zip -d ./tests/

.pre-commit-config.yaml

+8-3
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.9.1
7+
rev: 4.0.1
88
hooks:
9-
- id: flake8
9+
- 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", "--skip", "pyquokka", "--skip", "venv"]

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

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

pyintelowl/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# flake8: noqa
2-
from .pyintelowl import IntelOwl
32
from .exceptions import IntelOwlClientException
3+
from .pyintelowl import IntelOwl

pyintelowl/cli/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from .analyse import analyse
2-
from .jobs import jobs
3-
from .tags import tags
4-
from .config import config
52
from .commands import (
63
analyzer_healthcheck,
74
connector_healthcheck,
85
get_analyzer_config,
96
get_connector_config,
107
)
8+
from .config import config
9+
from .jobs import jobs
10+
from .tags import tags
1111

1212
groups = [
1313
analyse,

pyintelowl/cli/_jobs_utils.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
import time
2-
from typing_extensions import Literal
2+
33
from rich import box
4+
from rich.console import Console, RenderGroup
45
from rich.panel import Panel
5-
from rich.table import Table
66
from rich.progress import track
7-
from rich.console import RenderGroup, Console
7+
from rich.table import Table
8+
from typing_extensions import Literal
9+
10+
from pyintelowl.exceptions import IntelOwlClientException
11+
812
from ..cli._utils import (
13+
get_json_syntax,
914
get_status_text,
1015
get_success_text,
1116
get_tags_str,
12-
get_json_syntax,
1317
)
14-
from pyintelowl.exceptions import IntelOwlClientException
15-
from ..cli.domain_checkers import Checkers, console as checkers_console
18+
from ..cli.domain_checkers import Checkers
19+
from ..cli.domain_checkers import console as checkers_console
1620

1721

1822
def _display_single_job(

pyintelowl/cli/_utils.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import click
2-
import logging
31
import csv
42
import json
3+
import logging
4+
5+
import click
56
from rich.emoji import Emoji
6-
from rich.text import Text
7-
from rich.syntax import Syntax
87
from rich.logging import RichHandler
8+
from rich.syntax import Syntax
9+
from rich.text import Text
910

1011
from pyintelowl import IntelOwl
1112

pyintelowl/cli/analyse.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import click
22

33
from pyintelowl.exceptions import IntelOwlClientException
4-
from ..cli._utils import add_options, ClickContext, get_json_data
4+
5+
from ..cli._utils import ClickContext, add_options, get_json_data
56

67
__analyse_options = [
78
click.option(

pyintelowl/cli/commands.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
import click
21
import json
32
import re
4-
from rich.console import Console
5-
from rich.table import Table
3+
4+
import click
65
from rich import box
76
from rich import print as rprint
7+
from rich.console import Console
8+
from rich.table import Table
9+
10+
from pyintelowl.pyintelowl import IntelOwlClientException
811

912
from ..cli._utils import (
1013
ClickContext,
11-
get_success_text,
12-
get_json_syntax,
1314
add_options,
15+
get_json_syntax,
16+
get_success_text,
1417
json_flag_option,
1518
)
16-
from pyintelowl.pyintelowl import IntelOwlClientException
1719

1820

1921
@click.command(

pyintelowl/cli/domain_checkers.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import geocoder
21
import os
32
from datetime import datetime
3+
4+
import geocoder
45
from rich.console import Console
56

67
console = Console()

pyintelowl/cli/jobs.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
import click
21
import json
2+
3+
import click
34
from rich import print as rprint
45
from rich.console import Console
6+
57
from pyintelowl.exceptions import IntelOwlClientException
6-
from ..cli._utils import (
7-
ClickContext,
8-
add_options,
9-
json_flag_option,
10-
get_action_status_text,
11-
)
8+
129
from ..cli._jobs_utils import (
1310
_display_all_jobs,
1411
_display_single_job,
15-
_result_filter_and_tabular_print,
1612
_poll_for_job_cli,
13+
_result_filter_and_tabular_print,
14+
)
15+
from ..cli._utils import (
16+
ClickContext,
17+
add_options,
18+
get_action_status_text,
19+
json_flag_option,
1720
)
1821

1922

pyintelowl/cli/tags.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
import click
21
import json
2+
3+
import click
4+
from rich import box
5+
from rich import print as rprint
36
from rich.console import Console
47
from rich.table import Table
58
from rich.text import Text
6-
from rich import box
7-
from rich import print as rprint
89

910
from pyintelowl.exceptions import IntelOwlClientException
1011

1112
from ..cli._utils import (
1213
ClickContext,
1314
add_options,
14-
json_flag_option,
1515
get_action_status_text,
16+
json_flag_option,
1617
)
1718

1819

pyintelowl/exceptions.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import typing
3+
34
from requests.exceptions import RequestException
45

56

pyintelowl/main.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22
import click
33
import click_creds
44

5+
from .cli import cmds, groups
6+
from .cli._utils import ClickContext, get_logger, get_version_number
57
from .pyintelowl import IntelOwl
6-
from .cli import groups, cmds
7-
from .cli._utils import (
8-
get_logger,
9-
ClickContext,
10-
get_version_number,
11-
)
128

139

1410
@click.group(context_settings=dict(help_option_names=["-h", "--help"]))

pyintelowl/pyintelowl.py

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
1+
import hashlib
12
import ipaddress
3+
import json
24
import logging
35
import pathlib
4-
import json
56
import re
7+
from typing import Any, AnyStr, Callable, Dict, List, Optional, Union
8+
69
import requests
7-
import hashlib
8-
from typing import (
9-
List,
10-
Dict,
11-
Any,
12-
Optional,
13-
Union,
14-
AnyStr,
15-
Callable,
16-
)
1710
from typing_extensions import Literal
1811

1912
from pyintelowl.version import __version__
20-
from .exceptions import IntelOwlClientException
2113

14+
from .exceptions import IntelOwlClientException
2215

2316
TLPType = Literal["WHITE", "GREEN", "AMBER", "RED"]
2417

@@ -608,7 +601,7 @@ def _get_observable_classification(self, value: str) -> str:
608601
ipaddress.ip_address(value)
609602
except ValueError:
610603
if re.match(
611-
r"^(?:ht|f)tps?://[a-z\d-]{1,63}(?:\.[a-z\d-]{1,63})+"
604+
r"^(?:htt|ft|tc)ps?://[a-z\d-]{1,63}(?:\.[a-z\d-]{1,63})+"
612605
r"(?:/[a-z\d-]{1,63})*(?:\.\w+)?",
613606
value,
614607
):

pyintelowl/version.py

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

pyproject.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ exclude = '''
55
| venv
66
| migrations
77
)/
8-
'''
8+
'''
9+
[tool.isort]
10+
profile = "black"
11+
multi_line_output = 3

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
import os
88
import pathlib
9-
from setuptools import setup, find_packages
9+
10+
from setuptools import find_packages, setup
1011

1112
# The directory containing this file
1213
HERE = pathlib.Path(__file__).parent

test-requirements.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
black==20.8b1
1+
black==21.9b0
22
flake8==4.0.1
3+
isort==5.10.1
34
pre-commit==2.12.1
45
tox==3.24.4
56
tox-gh-actions==2.5.0
6-
codecov
7+
codecov==2.1.12

tests/mocked_requests.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
from tests.utils import (
2-
MockResponse,
3-
get_file_data,
4-
ROOT_DIR,
5-
TEST_FILE,
6-
)
1+
from tests.utils import ROOT_DIR, TEST_FILE, MockResponse, get_file_data
72

83

94
def mocked_raise_exception(*args, **kwargs):

tests/test_general.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
from pyintelowl.exceptions import IntelOwlClientException
2-
3-
from tests.utils import (
4-
BaseTest,
5-
mock_connections,
6-
patch,
7-
get_file_data,
8-
)
92
from tests.mocked_requests import (
103
mocked_analyzer_config,
11-
mocked_ask_analysis_success,
12-
mocked_ask_analysis_no_status,
134
mocked_ask_analysis_no_job_id,
5+
mocked_ask_analysis_no_status,
6+
mocked_ask_analysis_success,
147
mocked_connector_config,
15-
mocked_send_analysis_success,
168
mocked_raise_exception,
9+
mocked_send_analysis_success,
1710
)
11+
from tests.utils import BaseTest, get_file_data, mock_connections, patch
1812

1913

2014
class TestGeneral(BaseTest):

tests/test_jobs.py

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
from pyintelowl.exceptions import IntelOwlClientException
2-
3-
from tests.utils import (
4-
BaseTest,
5-
mock_connections,
6-
patch,
7-
get_file_data,
8-
)
92
from tests.mocked_requests import (
103
mocked_analyzer_healthcheck,
114
mocked_connector_healthcheck,
5+
mocked_delete_job_by_id,
6+
mocked_download_job_sample,
127
mocked_get_all_jobs,
138
mocked_get_job_by_id,
14-
mocked_delete_job_by_id,
159
mocked_kill_analyzer,
1610
mocked_kill_connector,
1711
mocked_kill_job,
18-
mocked_download_job_sample,
1912
mocked_raise_exception,
2013
mocked_retry_analyzer,
2114
mocked_retry_connector,
2215
)
16+
from tests.utils import BaseTest, get_file_data, mock_connections, patch
2317

2418

2519
class TestJobs(BaseTest):

0 commit comments

Comments
 (0)