Commit Graph

27 Commits

Author SHA1 Message Date
Willi Ballenthin b505ba7621 fix: remove unused imports and un-suppress F401
closes #2996
2026-05-08 17:58:07 +02:00
Willi Ballenthin eb81901d71 fix: correct capa/subscope-rule key in RuleMetadata.from_capa
`RuleMetadata.from_capa` used `rule.meta.get("capa/subscope", False)` and
`Field(False, alias="capa/subscope")`, but the actual key set by
`_extract_subscope_rules_rec` is `"capa/subscope-rule"`. This caused
`is_subscope_rule` to always be `False` in every `RuleMetadata` instance,
making downstream filters in `render/utils.py`, `render/vverbose.py`, and
`scripts/import-to-ida.py` ineffective (though subscope rules are already
excluded from `ResultDocument` before reaching those callers).
2026-05-08 17:58:07 +02:00
Willi Ballenthin d16a85bdba fix: add missing explicit submodule imports for Pyright attribute resolution 2026-04-23 16:11:58 +03:00
Willi Ballenthin 8d17319128 capabilities: use dataclasses to represent complicated return types
foo
2025-01-29 02:25:06 -07: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
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 e6d64ef561 pydantic: remove use of deprecated routines
closes #1718
2023-08-15 08:41:56 +00:00
Aayush Goel 2bed3468f6 bump pydantic to 2.1.1 2023-08-03 17:21:46 +05:30
Willi Ballenthin b9090b86ce tests: make fixtures available via conftest.py
closes #1592
2023-07-13 09:37:39 +02:00
Willi Ballenthin c86ab51210 fix copyright headers everywhere 2023-07-13 05:03:33 +02:00
Willi Ballenthin a43d2c115f tests: fix fixture imports 2023-07-06 19:04:53 +02:00
Willi Ballenthin 47074fd129 fix ruff issues 2023-07-06 17:49:40 +02:00
Aayush Goel 445214b23b Update Metadata type in capa main 2023-06-02 00:40:38 +05:30
Willi Ballenthin a64a88981f tests: add another test demonstrating rd format output 2023-04-03 15:35:20 +02:00
Pratham Chauhan 1b90a28acd resolved merge conflicts 2023-03-30 11:05:32 +05:30
Pratham Chauhan 7cb4ea9273 Fix lint issues 2023-03-30 10:35:31 +05:30
Pratham Chauhan c3fdab8ec5 Add new test test_rdoc_to_capa 2023-03-29 22:57:11 +05:30
Pratham Chauhan a13ce094b3 use rd/test json 2023-03-29 19:41:14 +05:30
Pratham Chauhan fe1193f374 removes unused imports 2023-03-29 16:12:17 +05:30
Pratham Chauhan abbf3db2ac Revert "remove unused imports"
This reverts commit 9e12c563bc.
2023-03-29 16:11:21 +05:30
Pratham Chauhan 9e12c563bc remove unused imports 2023-03-29 16:02:17 +05:30
Pratham Chauhan 637dd6bf0a Added a unit test 2023-03-29 15:51:25 +05:30
Willi Ballenthin 4754a84a8a pep8 2023-03-22 10:52:40 +01:00
Willi Ballenthin 02fdf41969 tests: add tests demonstrating result document round tripping 2023-03-22 10:47:45 +01:00
Harsh Mehta 74009eb4a4 Updated Copyright (#1383)
* Updated Copyright
2023-03-14 17:58:43 +01:00
Willi Ballenthin b819033da0 lots of mypy 2022-12-14 10:37:39 +01:00
Mike Hunhoff e1735f0a5e update pydantic models to guarantee type coercion (#1176)
* add CompoundStatement to fix Pydantic typing bug

* explorer: fix #1151

* explorer: support rendering operand number/offset
2022-09-20 08:38:19 -06:00