Skip to content

Commit 221a71a

Browse files
committed
ruff format
1 parent 1ce1c99 commit 221a71a

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

baddns/lib/matcher.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ def __init__(self, signatures):
7676
body_yara_src.append(rule_src)
7777

7878
self._compiled_body = _yara_helper.compile(source="\n".join(body_yara_src)) if body_yara_src else None
79-
self._compiled_header = (
80-
_yara_helper.compile(source="\n".join(header_yara_src)) if header_yara_src else None
81-
)
79+
self._compiled_header = _yara_helper.compile(source="\n".join(header_yara_src)) if header_yara_src else None
8280

8381
def match(self, response):
8482
"""Return dict of (sig_idx, matcher_idx) -> bool for all word matchers."""

baddns/lib/yara_helper.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ class YaraHelper:
55
def compile_strings(self, strings, nocase=False):
66
yara_strings = []
77
for i, s in enumerate(strings):
8-
s = s.replace("\\", "\\\\").replace('"', '\\"').replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t")
8+
s = (
9+
s.replace("\\", "\\\\")
10+
.replace('"', '\\"')
11+
.replace("\n", "\\n")
12+
.replace("\r", "\\r")
13+
.replace("\t", "\\t")
14+
)
915
yara_string = f'$s{i} = "{s}"'
1016
if nocase:
1117
yara_string += " nocase"

0 commit comments

Comments
 (0)