Skip to content

Commit 7b23834

Browse files
dependabot[bot]mr-tzcapa-bot
authored
build(deps-dev): bump black from 25.12.0 to 26.3.0 (#2902)
* build(deps-dev): bump black from 25.12.0 to 26.3.0 Bumps [black](https://github.com/psf/black) from 25.12.0 to 26.3.0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](psf/black@25.12.0...26.3.0) --- updated-dependencies: - dependency-name: black dependency-version: 26.3.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * style: auto-format with black and isort --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Moritz <mr-tz@users.noreply.github.com> Co-authored-by: Capa Bot <capa-dev@mandiant.com>
1 parent f1800b5 commit 7b23834

39 files changed

Lines changed: 407 additions & 1029 deletions

.github/workflows/black-format.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ jobs:
3838
- name: Run isort
3939
run: pre-commit run isort --all-files
4040

41-
- name: Run black
41+
- name: Run black/continue
42+
# black returns non-zero error code after formatting, which is what we expect
43+
continue-on-error: true
4244
run: pre-commit run black --all-files
4345

4446
- name: Check for changes
@@ -53,8 +55,8 @@ jobs:
5355
- name: Commit and push formatting changes
5456
if: steps.changes.outputs.has_changes == 'true'
5557
run: |
56-
git config user.name "github-actions[bot]"
57-
git config user.email "github-actions[bot]@users.noreply.github.com"
58+
git config user.name "${GITHUB_ACTOR}"
59+
git config user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
5860
git add -A
5961
git commit -m "style: auto-format with black and isort"
6062
git push

capa/features/extractors/binexport2/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from BinExport2 at 6916731d5f6693c4a4f0a052501fd3bd92cfd08b
2121
https://github.com/google/binexport/blob/6916731/binexport2.proto
2222
"""
23+
2324
import io
2425
import hashlib
2526
import logging

capa/features/extractors/binexport2/arch/arm/insn.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,14 @@ def extract_insn_number_features(
8484
yield OperandOffset(i, value), ih.address
8585

8686

87-
OFFSET_PATTERNS = BinExport2InstructionPatternMatcher.from_str(
88-
"""
87+
OFFSET_PATTERNS = BinExport2InstructionPatternMatcher.from_str("""
8988
ldr|ldrb|ldrh|ldrsb|ldrsh|ldrex|ldrd|str|strb|strh|strex|strd reg, [reg(not-stack), #int] ; capture #int
9089
ldr|ldrb|ldrh|ldrsb|ldrsh|ldrex|ldrd|str|strb|strh|strex|strd reg, [reg(not-stack), #int]! ; capture #int
9190
ldr|ldrb|ldrh|ldrsb|ldrsh|ldrex|ldrd|str|strb|strh|strex|strd reg, [reg(not-stack)], #int ; capture #int
9291
ldp|ldpd|stp|stpd reg, reg, [reg(not-stack), #int] ; capture #int
9392
ldp|ldpd|stp|stpd reg, reg, [reg(not-stack), #int]! ; capture #int
9493
ldp|ldpd|stp|stpd reg, reg, [reg(not-stack)], #int ; capture #int
95-
"""
96-
)
94+
""")
9795

9896

9997
def extract_insn_offset_features(
@@ -117,12 +115,10 @@ def extract_insn_offset_features(
117115
yield OperandOffset(match.operand_index, value), ih.address
118116

119117

120-
NZXOR_PATTERNS = BinExport2InstructionPatternMatcher.from_str(
121-
"""
118+
NZXOR_PATTERNS = BinExport2InstructionPatternMatcher.from_str("""
122119
eor reg, reg, reg
123120
eor reg, reg, #int
124-
"""
125-
)
121+
""")
126122

127123

128124
def extract_insn_nzxor_characteristic_features(
@@ -144,11 +140,9 @@ def extract_insn_nzxor_characteristic_features(
144140
yield Characteristic("nzxor"), ih.address
145141

146142

147-
INDIRECT_CALL_PATTERNS = BinExport2InstructionPatternMatcher.from_str(
148-
"""
143+
INDIRECT_CALL_PATTERNS = BinExport2InstructionPatternMatcher.from_str("""
149144
blx|bx|blr reg
150-
"""
151-
)
145+
""")
152146

153147

154148
def extract_function_indirect_call_characteristic_features(

capa/features/extractors/binexport2/arch/intel/insn.py

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,14 @@
3434
logger = logging.getLogger(__name__)
3535

3636

37-
IGNORE_NUMBER_PATTERNS = BinExport2InstructionPatternMatcher.from_str(
38-
"""
37+
IGNORE_NUMBER_PATTERNS = BinExport2InstructionPatternMatcher.from_str("""
3938
ret #int
4039
retn #int
4140
add reg(stack), #int
4241
sub reg(stack), #int
43-
"""
44-
)
42+
""")
4543

46-
NUMBER_PATTERNS = BinExport2InstructionPatternMatcher.from_str(
47-
"""
44+
NUMBER_PATTERNS = BinExport2InstructionPatternMatcher.from_str("""
4845
push #int0 ; capture #int0
4946
5047
# its a little tedious to enumerate all the address forms
@@ -64,8 +61,7 @@
6461
# imagine reg is zero'd out, then this is like `mov reg, #int`
6562
# which is not uncommon.
6663
lea reg, [reg + #int] ; capture #int
67-
"""
68-
)
64+
""")
6965

7066

7167
def extract_insn_number_features(
@@ -100,8 +96,7 @@ def extract_insn_number_features(
10096
yield OperandOffset(match.operand_index, value), ih.address
10197

10298

103-
OFFSET_PATTERNS = BinExport2InstructionPatternMatcher.from_str(
104-
"""
99+
OFFSET_PATTERNS = BinExport2InstructionPatternMatcher.from_str("""
105100
mov|movzx|movsb|cmp [reg + reg * #int + #int0], #int ; capture #int0
106101
mov|movzx|movsb|cmp [reg * #int + #int0], #int ; capture #int0
107102
mov|movzx|movsb|cmp [reg + reg + #int0], #int ; capture #int0
@@ -114,18 +109,15 @@ def extract_insn_number_features(
114109
mov|movzx|movsb|cmp|lea reg, [reg * #int + #int0] ; capture #int0
115110
mov|movzx|movsb|cmp|lea reg, [reg + reg + #int0] ; capture #int0
116111
mov|movzx|movsb|cmp|lea reg, [reg(not-stack) + #int0] ; capture #int0
117-
"""
118-
)
112+
""")
119113

120114
# these are patterns that access offset 0 from some pointer
121115
# (pointer is not the stack pointer).
122-
OFFSET_ZERO_PATTERNS = BinExport2InstructionPatternMatcher.from_str(
123-
"""
116+
OFFSET_ZERO_PATTERNS = BinExport2InstructionPatternMatcher.from_str("""
124117
mov|movzx|movsb [reg(not-stack)], reg
125118
mov|movzx|movsb [reg(not-stack)], #int
126119
lea reg, [reg(not-stack)]
127-
"""
128-
)
120+
""")
129121

130122

131123
def extract_insn_offset_features(
@@ -189,12 +181,10 @@ def is_security_cookie(
189181
return False
190182

191183

192-
NZXOR_PATTERNS = BinExport2InstructionPatternMatcher.from_str(
193-
"""
184+
NZXOR_PATTERNS = BinExport2InstructionPatternMatcher.from_str("""
194185
xor|xorpd|xorps|pxor reg, reg
195186
xor|xorpd|xorps|pxor reg, #int
196-
"""
197-
)
187+
""")
198188

199189

200190
def extract_insn_nzxor_characteristic_features(
@@ -228,17 +218,15 @@ def extract_insn_nzxor_characteristic_features(
228218
yield Characteristic("nzxor"), ih.address
229219

230220

231-
INDIRECT_CALL_PATTERNS = BinExport2InstructionPatternMatcher.from_str(
232-
"""
221+
INDIRECT_CALL_PATTERNS = BinExport2InstructionPatternMatcher.from_str("""
233222
call|jmp reg0
234223
call|jmp [reg + reg * #int + #int]
235224
call|jmp [reg + reg * #int]
236225
call|jmp [reg * #int + #int]
237226
call|jmp [reg + reg + #int]
238227
call|jmp [reg + #int]
239228
call|jmp [reg]
240-
"""
241-
)
229+
""")
242230

243231

244232
def extract_function_indirect_call_characteristic_features(

capa/features/extractors/viv/indirect_calls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def get_previous_instructions(vw: VivWorkspace, va: int) -> list[int]:
5656
if ploc is not None:
5757
# from vivisect.const:
5858
# location: (L_VA, L_SIZE, L_LTYPE, L_TINFO)
59-
(pva, _, ptype, pinfo) = ploc
59+
pva, _, ptype, pinfo = ploc
6060

6161
if ptype == LOC_OP and not (pinfo & IF_NOFALL):
6262
ret.append(pva)

capa/features/extractors/viv/insn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def extract_insn_api_features(fh: FunctionHandle, bb, ih: InsnHandle) -> Iterato
176176

177177
elif isinstance(insn.opers[0], envi.archs.i386.disasm.i386RegOper):
178178
try:
179-
(_, target) = resolve_indirect_call(f.vw, insn.va, insn=insn)
179+
_, target = resolve_indirect_call(f.vw, insn.va, insn=insn)
180180
except NotFoundError:
181181
# not able to resolve the indirect call, sorry
182182
return

capa/main.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,7 @@ def main(argv: Optional[list[str]] = None):
945945
argv = sys.argv[1:]
946946

947947
desc = "The FLARE team's open-source tool to identify capabilities in executable files."
948-
epilog = textwrap.dedent(
949-
"""
948+
epilog = textwrap.dedent("""
950949
By default, capa uses a default set of embedded rules.
951950
You can see the rule set here:
952951
https://github.com/mandiant/capa-rules
@@ -973,8 +972,7 @@ def main(argv: Optional[list[str]] = None):
973972
974973
filter rules by meta fields, e.g. rule name or namespace
975974
capa -t "create TCP socket" suspicious.exe
976-
"""
977-
)
975+
""")
978976

979977
parser = argparse.ArgumentParser(
980978
description=desc, epilog=epilog, formatter_class=argparse.RawDescriptionHelpFormatter

capa/render/proto/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
3232
Alternatively, --pyi_out=. can be used to generate a Python Interface file that supports development
3333
"""
34+
3435
import datetime
3536
from typing import Any, Union
3637

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ dev = [
145145
"flake8-use-pathlib==0.3.0",
146146
"flake8-copyright==0.2.4",
147147
"ruff==0.15.0",
148-
"black==25.12.0",
148+
"black==26.3.0",
149149
"isort==8.0.0",
150150
"mypy==1.19.1",
151151
"mypy-protobuf==5.0.0",

scripts/bulk-process.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
parallelism factor
6262
--no-mp disable subprocesses
6363
"""
64+
6465
import sys
6566
import json
6667
import logging

0 commit comments

Comments
 (0)