Skip to content

Commit

Permalink
pre-commit update (#873)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazet committed Mar 26, 2024
1 parent 37623f5 commit f1f18b7
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 23 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 24.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.9.0
hooks:
- id: mypy
args: [--strict]
Expand Down Expand Up @@ -46,7 +46,7 @@ repos:
- types-tqdm==4.66.0.2
- uvicorn==0.23.2
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
args: [artemis]
6 changes: 3 additions & 3 deletions artemis/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ class PublicSuffixes:
] = get_config("ADDITIONAL_PUBLIC_SUFFIXES", default="", cast=decouple.Csv(str))

class Limits:
TASK_TIMEOUT_SECONDS: Annotated[
int, "What is the maximum task run time (after which it will get killed)."
] = get_config("TASK_TIMEOUT_SECONDS", default=6 * 3600, cast=int)
TASK_TIMEOUT_SECONDS: Annotated[int, "What is the maximum task run time (after which it will get killed)."] = (
get_config("TASK_TIMEOUT_SECONDS", default=6 * 3600, cast=int)
)

REQUEST_TIMEOUT_SECONDS: Annotated[
int,
Expand Down
16 changes: 10 additions & 6 deletions artemis/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,11 @@ def get_paginated_analyses(
search_query: Optional[str] = None,
) -> PaginatedResults:
ordering_postgresql = [
getattr(Analysis, ordering_rule.column_name)
if ordering_rule.ascending
else getattr(Analysis, ordering_rule.column_name).desc()
(
getattr(Analysis, ordering_rule.column_name)
if ordering_rule.ascending
else getattr(Analysis, ordering_rule.column_name).desc()
)
for ordering_rule in ordering
]

Expand Down Expand Up @@ -264,9 +266,11 @@ def get_paginated_task_results(
task_filter: Optional[TaskFilter] = None,
) -> PaginatedResults:
ordering_postgresql = [
getattr(TaskResult, ordering_rule.column_name)
if ordering_rule.ascending
else getattr(TaskResult, ordering_rule.column_name).desc()
(
getattr(TaskResult, ordering_rule.column_name)
if ordering_rule.ascending
else getattr(TaskResult, ordering_rule.column_name).desc()
)
for ordering_rule in ordering
]

Expand Down
8 changes: 5 additions & 3 deletions artemis/modules/nuclei.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ def _scan(self, templates: List[str], targets: List[str]) -> List[Dict[str, Any]
"-headless-bulk-size",
str(len(targets)),
"-milliseconds-per-request",
str(int((1 / Config.Limits.REQUESTS_PER_SECOND) * 1000.0 / len(targets)))
if Config.Limits.REQUESTS_PER_SECOND != 0
else str(int(0)),
(
str(int((1 / Config.Limits.REQUESTS_PER_SECOND) * 1000.0 / len(targets)))
if Config.Limits.REQUESTS_PER_SECOND != 0
else str(int(0))
),
] + additional_configuration

# The `-it` flag will include the templates provided in NUCLEI_ADDITIONAL_TEMPLATES even if
Expand Down
8 changes: 5 additions & 3 deletions artemis/reporting/base/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ def default_normal_form_rule(report: Report) -> NormalForm:
return Reporter.dict_to_tuple(
{
"type": report.report_type,
"target": get_url_normal_form(report.target)
if report.target_is_url()
else get_domain_normal_form(report.target),
"target": (
get_url_normal_form(report.target)
if report.target_is_url()
else get_domain_normal_form(report.target)
),
}
)
8 changes: 5 additions & 3 deletions test/modules/test_classifer.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ def test_parsing(self) -> None:
expected_tasks = [
Task(
{"type": item.task_type, "origin": Classifier.identity},
payload={"domain": item.data, "last_domain": item.data}
if item.task_type == TaskType.DOMAIN
else {"ip": item.data},
payload=(
{"domain": item.data, "last_domain": item.data}
if item.task_type == TaskType.DOMAIN
else {"ip": item.data}
),
payload_persistent={f"original_{item.task_type.value}": item.data},
)
for item in entry.expected
Expand Down

0 comments on commit f1f18b7

Please sign in to comment.