-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sync master #1615
Closed
Closed
sync master #1615
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
25a6d78
ruff: update config
williballenthin 6f0d1f7
add pre-commit config
williballenthin 75a76b4
setup: add pre-commit dev dependency
williballenthin 691ef1c
remove old linter configs
williballenthin f17edb3
ci: use pre-commit to invoke linters
williballenthin adbfb8d
doc: installation: document pre-commit
williballenthin 47074fd
fix ruff issues
williballenthin 9441da4
isort
williballenthin 90e607f
flake8
williballenthin 511aa0f
doc: installation: more details on pre-commit
williballenthin e675bef
ci: invoke linter directly
williballenthin a43d2c1
tests: fix fixture imports
williballenthin 982dc46
add flake8-bugbear linter
williballenthin 9f6165f
doc: installation: better enumerate current linters
williballenthin 3ad4de7
gitignore
williballenthin ff47270
add flake8-encoding plugin
williballenthin 13a8e25
introduce flake8-comprehensions
williballenthin 3ca233e
Merge branch 'master' into fix/issue-1579
williballenthin 8c86011
changelog
williballenthin fc1dd40
Sync capa rules submodule
capa-bot 54203f3
introduce flake8-logging-format linter
williballenthin 7fe738e
introduce flake8-no-implicit-concat linter
williballenthin 106b12e
move flake8 config to its own config file
williballenthin 4a49543
introduce flake8-print linter
williballenthin ae10a2e
introduce flake8-todos linter
williballenthin 118b955
features: fix circular import
williballenthin dd2bbc9
migrate to pyproject.toml
williballenthin fb17619
changelog
williballenthin cb289e3
ci: publish: use trusted publishing
williballenthin 81b9643
ci: publish to PyPI using trusted publishing
williballenthin 1f8aa7c
changelog
williballenthin 430f9da
Merge branch 'master' into fix/issue-1579
williballenthin d89dd49
add issue links for TODOs
williballenthin a712bf3
Sync capa rules submodule
capa-bot f983307
Merge branch 'master' into fix/issue-1579
williballenthin 506d677
Merge pull request #1591 from mandiant/fix/issue-1579
williballenthin ac12d5a
Merge pull request #1611 from mandiant/fix/issue-1301
williballenthin 320539b
Merge branch 'master' into fix/issue-1491
williballenthin 1373fab
Merge pull request #1613 from mandiant/fix/issue-1491
williballenthin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[flake8] | ||
max-line-length = 120 | ||
|
||
extend-ignore = | ||
# E203: whitespace before ':' (black does this) | ||
E203, | ||
# F401: `foo` imported but unused (prefer ruff) | ||
F401, | ||
# F811 Redefinition of unused `foo` (prefer ruff) | ||
F811, | ||
# E501 line too long (prefer black) | ||
E501, | ||
# B010 Do not call setattr with a constant attribute value | ||
B010, | ||
# G200 Logging statement uses exception in arguments | ||
G200 | ||
|
||
|
||
per-file-ignores = | ||
# T201 print found. | ||
# | ||
# scripts are meant to print output | ||
scripts/*: T201 | ||
# capa.exe is meant to print output | ||
capa/main.py: T201 | ||
# IDA tests emit results to output window so need to print | ||
tests/test_ida_features.py: T201 | ||
# utility used to find the Binary Ninja API via invoking python.exe | ||
capa/features/extractors/binja/find_binja_api.py: T201 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,61 @@ | ||
# Enable pycodestyle (`E`) codes | ||
select = ["E"] | ||
# Enable the pycodestyle (`E`) and Pyflakes (`F`) rules by default. | ||
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or | ||
# McCabe complexity (`C901`) by default. | ||
select = ["E", "F"] | ||
|
||
# Allow autofix for all enabled rules (when `--fix`) is provided. | ||
fixable = ["ALL"] | ||
unfixable = [] | ||
|
||
# E402 module level import not at top of file | ||
# E722 do not use bare 'except' | ||
ignore = ["E402", "E722"] | ||
exclude = ["*_pb2.py", "*_pb2.pyi"] | ||
# E501 line too long | ||
ignore = ["E402", "E722", "E501"] | ||
|
||
line-length = 120 | ||
|
||
exclude = [ | ||
# Exclude a variety of commonly ignored directories. | ||
".bzr", | ||
".direnv", | ||
".eggs", | ||
".git", | ||
".git-rewrite", | ||
".hg", | ||
".mypy_cache", | ||
".nox", | ||
".pants.d", | ||
".pytype", | ||
".ruff_cache", | ||
".svn", | ||
".tox", | ||
".venv", | ||
"__pypackages__", | ||
"_build", | ||
"buck-out", | ||
"build", | ||
"dist", | ||
"node_modules", | ||
"venv", | ||
# protobuf generated files | ||
"*_pb2.py", | ||
"*_pb2.pyi" | ||
] | ||
|
||
# Same as pycodestyle. | ||
line-length = 180 | ||
[per-file-ignores] | ||
# until we address #1592 and move test fixtures into conftest.py | ||
# then we need to ignore imports done to enable pytest fixtures. | ||
# | ||
# F401: `foo` imported but unused | ||
# F811 Redefinition of unused `foo` | ||
"tests/test_main.py" = ["F401", "F811"] | ||
"tests/test_proto.py" = ["F401", "F811"] | ||
"tests/test_freeze.py" = ["F401", "F811"] | ||
"tests/test_function_id.py" = ["F401", "F811"] | ||
"tests/test_viv_features.py" = ["F401", "F811"] | ||
"tests/test_binja_features.py" = ["F401", "F811"] | ||
"tests/test_pefile_features.py" = ["F401", "F811"] | ||
"tests/test_dnfile_features.py" = ["F401", "F811"] | ||
"tests/test_dotnet_features.py" = ["F401", "F811"] | ||
"tests/test_result_document.py" = ["F401", "F811"] | ||
"tests/test_dotnetfile_features.py" = ["F401", "F811"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# install the pre-commit hooks: | ||
# | ||
# ❯ pre-commit install --hook-type pre-commit | ||
# pre-commit installed at .git/hooks/pre-commit | ||
# | ||
# ❯ pre-commit install --hook-type pre-push | ||
# pre-commit installed at .git/hooks/pre-push | ||
# | ||
# run all linters liks: | ||
# | ||
# ❯ pre-commit run --all-files | ||
# isort....................................................................Passed | ||
# black....................................................................Passed | ||
# ruff.....................................................................Passed | ||
# flake8...................................................................Passed | ||
# mypy.....................................................................Passed | ||
# | ||
# run a single linter like: | ||
# | ||
# ❯ pre-commit run --all-files isort | ||
# isort....................................................................Passed | ||
|
||
repos: | ||
- repo: local | ||
hooks: | ||
- id: isort | ||
name: isort | ||
stages: [commit, push] | ||
language: system | ||
entry: isort | ||
args: | ||
- "--length-sort" | ||
- "--profile" | ||
- "black" | ||
- "--line-length=120" | ||
- "--skip-glob" | ||
- "*_pb2.py" | ||
- "capa/" | ||
- "scripts/" | ||
- "tests/" | ||
always_run: true | ||
pass_filenames: false | ||
|
||
- repo: local | ||
hooks: | ||
- id: black | ||
name: black | ||
stages: [commit, push] | ||
language: system | ||
entry: black | ||
args: | ||
- "--line-length=120" | ||
- "--extend-exclude" | ||
- ".*_pb2.py" | ||
- "capa/" | ||
- "scripts/" | ||
- "tests/" | ||
always_run: true | ||
pass_filenames: false | ||
|
||
- repo: local | ||
hooks: | ||
- id: ruff | ||
name: ruff | ||
stages: [commit, push] | ||
language: system | ||
entry: ruff | ||
args: | ||
- "check" | ||
- "--config" | ||
- ".github/ruff.toml" | ||
- "capa/" | ||
- "scripts/" | ||
- "tests/" | ||
always_run: true | ||
pass_filenames: false | ||
|
||
- repo: local | ||
hooks: | ||
- id: flake8 | ||
name: flake8 | ||
stages: [commit, push] | ||
language: system | ||
entry: flake8 | ||
args: | ||
- "--config" | ||
- ".github/flake8.ini" | ||
- "--extend-exclude" | ||
- "capa/render/proto/capa_pb2.py" | ||
- "capa/" | ||
- "scripts/" | ||
- "tests/" | ||
always_run: true | ||
pass_filenames: false | ||
|
||
- repo: local | ||
hooks: | ||
- id: mypy | ||
name: mypy | ||
stages: [commit, push] | ||
language: system | ||
entry: mypy | ||
args: | ||
- "--check-untyped-defs" | ||
- "--ignore-missing-imports" | ||
- "--config-file=.github/mypy/mypy.ini" | ||
- "capa/" | ||
- "scripts/" | ||
- "tests/" | ||
always_run: true | ||
pass_filenames: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,15 @@ | |
### New Features | ||
- Utility script to detect feature overlap between new and existing CAPA rules [#1451](https://github.com/mandiant/capa/issues/1451) [@Aayush-Goel-04](https://github.com/aayush-goel-04) | ||
- use fancy box drawing characters for default output #1586 @williballenthin | ||
- use [pre-commit](https://pre-commit.com/) to invoke linters #1579 @williballenthin | ||
- publish via PyPI trusted publishing #1491 @williballenthin | ||
- migrate to pyproject.toml #1301 @williballenthin | ||
|
||
### Breaking Changes | ||
- Update Metadata type in capa main [#1411](https://github.com/mandiant/capa/issues/1411) [@Aayush-Goel-04](https://github.com/aayush-goel-04) @manasghandat | ||
- Python 3.8 is now the minimum supported Python version #1578 @williballenthin | ||
|
||
### New Rules (22) | ||
### New Rules (23) | ||
|
||
- load-code/shellcode/execute-shellcode-via-windows-callback-function [email protected] [email protected] | ||
- nursery/execute-shellcode-via-indirect-call [email protected] | ||
|
@@ -34,6 +37,7 @@ | |
- anti-analysis/anti-debugging/debugger-evasion/hide-thread-from-debugger [email protected] [email protected] | ||
- host-interaction/memory/create-new-application-domain-in-dotnet [email protected] | ||
- host-interaction/gui/switch-active-desktop [email protected] | ||
- host-interaction/service/query-service-configuration @mr-tz | ||
- | ||
|
||
### Bug Fixes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / Scorecard
Token-Permissions High