Commit Graph

39 Commits

Author SHA1 Message Date
Ange Albertini 61c24ebcbb RelativeVirtualAddress deprecation warning 2026-05-28 13:09:53 +00:00
Willi Ballenthin e745fa6aab style: ruff format changed files 2026-04-23 18:04:10 +03:00
Willi Ballenthin 8bea7c700e fix: DNTokenOffsetAddress.__eq__ lacks type guard
Closes #3022
2026-04-23 18:04:10 +03:00
Willi Ballenthin 3c61d9956d fix: ProcessAddress.__eq__ and ThreadAddress.__eq__ assert on type
Closes #3021
2026-04-23 18:04:10 +03:00
Willi Ballenthin 0345a15744 fix: _NoAddress.__eq__ unconditionally returns True
Closes #3014
2026-04-23 18:04:10 +03:00
Mike Hunhoff ed7e0cd77d lint: replace black/isort/flake8 with ruff (#2992)
* lint: replace isort/flake8 with ruff

* update ruff links

* remove stale isort reference

* update CHANGELOG

* address review

* remove unused imports

* remove unnecessary list comprehension

* remove quotes from type annotation

* use dict.get instead of if-else block

* remove unnecessary utf-8 encoding declaration

* Revert "remove unused imports"

This reverts commit 18ba50a22b.

* skip check for unused imports

* fix UP036 Version block is outdated for minimum Python version

* add TODO comment for unused imports

* replace black with ruff

* address review comments
2026-04-07 12:10:41 -06:00
Ana Maria Martinez Gomez 3cd97ae9f2 [copyright + license] Fix headers
Replace the header from source code files using the following script:
```Python
for dir_path, dir_names, file_names in os.walk("capa"):
    for file_name in file_names:
        # header are only in `.py` and `.toml` files
        if file_name[-3:] not in (".py", "oml"):
            continue
        file_path = f"{dir_path}/{file_name}"
        f = open(file_path, "rb+")
        content = f.read()
        m = re.search(OLD_HEADER, content)
        if not m:
            continue
        print(f"{file_path}: {m.group('year')}")
        content = content.replace(m.group(0), NEW_HEADER % m.group("year"))
        f.seek(0)
        f.write(content)
```

Some files had the copyright headers inside a `"""` comment and needed
manual changes before applying the script. `hook-vivisect.py` and
`pyinstaller.spec` didn't include the license in the header and also
needed manual changes.

The old header had the confusing sentence `All rights reserved`, which
does not make sense for an open source license. Replace the header by
the default Google header that corrects this issue and keep capa
consistent with other Google projects.

Adapt the linter to work with the new header.

Replace also the copyright text in the `web/public/index.html` file for
consistency.
2025-01-15 08:52:42 -07:00
Willi Ballenthin 6869ef6520 engine, common: use FeatureSet type annotation for evaluate signature
It was used in some places already, but now used everywhere consistently.
This should make it easier to refactor the FeatureSet type, if necessary,
because its easier to see all the places its used.
2024-05-07 15:20:50 +02:00
N0stalgikow 0eb4291b25 Updating copyright across all files based on when it was first introduced. (#2027)
* updating copyright, back to the date of origin of file

* updating regex to account for linter violation
2024-03-13 14:04:53 +01:00
Willi Ballenthin c86ab51210 fix copyright headers everywhere 2023-07-13 05:03:33 +02:00
Willi Ballenthin 9441da4887 isort 2023-07-06 17:50:34 +02:00
Willi Ballenthin 47074fd129 fix ruff issues 2023-07-06 17:49:40 +02:00
Pratham Chauhan efb07fafb3 fix 2023-04-05 22:16:00 +05:30
Pratham Chauhan a40126aeff reformatting with black 2023-04-04 19:10:40 +05:30
Pratham Chauhan a260b35c9d --fix 2023-04-04 18:28:43 +05:30
Harsh Mehta 74009eb4a4 Updated Copyright (#1383)
* Updated Copyright
2023-03-14 17:58:43 +01:00
Willi Ballenthin 81500a4d1d black 2022-12-14 10:48:00 +01:00
Willi Ballenthin b819033da0 lots of mypy 2022-12-14 10:37:39 +01:00
William Ballenthin 845df282ef tests: split out match tests and validate alternative algorithms 2021-11-10 12:44:58 -07:00
William Ballenthin 3e74da96a6 engine: make short circuiting configurable 2021-11-08 14:55:11 -07:00
William Ballenthin 9fa9c6a5d0 tests: add test demonstrating short circuiting 2021-11-08 14:07:44 -07:00
William Ballenthin 6989e8b8cf rules: add substring feature
closes #737
2021-08-24 11:35:01 -06:00
William Ballenthin f013815b2a features: rename legacy term arch to bitness
makes space for upcoming feature `arch: ` for things like i386/amd64/aarch64
2021-08-16 12:21:25 -06:00
William Ballenthin 527e993bb4 engine: remove dependency on rules, fixing circular import 2021-06-09 22:30:43 -06:00
William Ballenthin ac59e50b5f move capa/features/__init__.py logic to common.py
also cleanup imports across the board,
thanks to pylance.
2021-06-09 22:20:53 -06:00
Moritz Raabe 34e7991081 black 20.8b1 updates 2020-08-27 11:26:28 +02:00
William Ballenthin b81b5e5993 rules: add support for arch flavors of Number and Offset features
closes #210
2020-08-03 16:28:47 -06:00
Ana María Martínez Gómez a74ab922a3 Get rid of * for Statement
They are not needed and complicate the code and make more difficult to
add more parameters to the initialization of Statements.

This produces many changes in the tests. The alternative would be to add
a parameter None in all of them, which are also a lot of changes.
2020-07-28 14:20:13 +02:00
William Ballenthin baeea5b6ec *: update license header to reference Apache 2.0
closes #173
2020-07-22 15:05:24 -06:00
William Ballenthin 3faf175da7 *: add license header
closes #144
2020-07-15 14:14:53 -06:00
William Ballenthin c185e9ef09 pep8: black 2020-07-02 10:32:26 -06:00
William Ballenthin db2b1caeae Merge branch 'master' into fmt-black 2020-07-02 10:25:24 -06:00
William Ballenthin d23ef48bb6 pep8 2020-07-01 12:33:13 -06:00
William Ballenthin 9aba2eb3a5 rules: range: correct handling of range with min==0
closes #57
2020-06-30 00:44:22 -06:00
William Ballenthin 970977ade5 tests: demonstrate a bit more depth to namespace matching 2020-06-30 00:20:40 -06:00
William Ballenthin 990c2010e9 pep8 2020-06-29 05:57:46 -06:00
William Ballenthin 3d0bd64e1b engine, rules: support matching namespaces, not just rule names
closes #37
2020-06-29 05:54:56 -06:00
Ana María Martínez Gómez 7e1e9e6618 Get rid of the Element class
The `Element` class is just used for testing. By using `Element` we are
not testing the actual code. Also, every time we implement a new feature
for the `Feature` class, we need to implement it for `Element` as well.
Replace `Element` by `Integer`.
2020-06-24 18:05:52 +02:00
William Ballenthin add3537447 import source files, forgetting about 938 prior commits 2020-06-18 09:13:19 -06:00