mirror of
https://github.com/mandiant/capa.git
synced 2025-12-21 23:00:29 -08:00
build(deps-dev): bump black from 23.12.1 to 24.1.1 (#1955)
* build(deps-dev): bump black from 23.12.1 to 24.1.1 Bumps [black](https://github.com/psf/black) from 23.12.1 to 24.1.1. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/23.12.1...24.1.1) --- updated-dependencies: - dependency-name: black dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * black 24.1.1 formatting * update flake config to match black 24.1.1 format --------- 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: mr-tz <moritz.raabe@mandiant.com>
This commit is contained in:
2
.github/flake8.ini
vendored
2
.github/flake8.ini
vendored
@@ -10,6 +10,8 @@ extend-ignore =
|
|||||||
F811,
|
F811,
|
||||||
# E501 line too long (prefer black)
|
# E501 line too long (prefer black)
|
||||||
E501,
|
E501,
|
||||||
|
# E701 multiple statements on one line (colon) (prefer black, see https://github.com/psf/black/issues/4173)
|
||||||
|
E701,
|
||||||
# B010 Do not call setattr with a constant attribute value
|
# B010 Do not call setattr with a constant attribute value
|
||||||
B010,
|
B010,
|
||||||
# G200 Logging statement uses exception in arguments
|
# G200 Logging statement uses exception in arguments
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ import abc
|
|||||||
|
|
||||||
class Address(abc.ABC):
|
class Address(abc.ABC):
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def __eq__(self, other):
|
def __eq__(self, other): ...
|
||||||
...
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|||||||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and limitations under the License.
|
See the License for the specific language governing permissions and limitations under the License.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import zlib
|
import zlib
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
@@ -932,9 +932,9 @@ class CapaExplorerForm(idaapi.PluginForm):
|
|||||||
update_wait_box("verifying cached results")
|
update_wait_box("verifying cached results")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
results: Optional[
|
results: Optional[capa.render.result_document.ResultDocument] = (
|
||||||
capa.render.result_document.ResultDocument
|
capa.ida.helpers.load_and_verify_cached_results()
|
||||||
] = capa.ida.helpers.load_and_verify_cached_results()
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
capa.ida.helpers.inform_user_ida_ui("Failed to verify cached results, reanalyzing program")
|
capa.ida.helpers.inform_user_ida_ui("Failed to verify cached results, reanalyzing program")
|
||||||
logger.exception("Failed to verify cached results (error: %s)", e)
|
logger.exception("Failed to verify cached results (error: %s)", e)
|
||||||
|
|||||||
@@ -200,9 +200,11 @@ class CapaExplorerRulegenPreview(QtWidgets.QTextEdit):
|
|||||||
" references:",
|
" references:",
|
||||||
" - <insert_references>",
|
" - <insert_references>",
|
||||||
" examples:",
|
" examples:",
|
||||||
|
(
|
||||||
f" - {capa.ida.helpers.get_file_md5().upper()}:{hex(ea)}"
|
f" - {capa.ida.helpers.get_file_md5().upper()}:{hex(ea)}"
|
||||||
if ea
|
if ea
|
||||||
else f" - {capa.ida.helpers.get_file_md5().upper()}",
|
else f" - {capa.ida.helpers.get_file_md5().upper()}"
|
||||||
|
),
|
||||||
" features:",
|
" features:",
|
||||||
]
|
]
|
||||||
self.setText("\n".join(metadata_default))
|
self.setText("\n".join(metadata_default))
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ def compute_dynamic_layout(
|
|||||||
)
|
)
|
||||||
for t in threads
|
for t in threads
|
||||||
if t in matched_threads
|
if t in matched_threads
|
||||||
) # this object is open to extension in the future,
|
), # this object is open to extension in the future,
|
||||||
# such as with the function name, etc.
|
# such as with the function name, etc.
|
||||||
)
|
)
|
||||||
for p, threads in threads_by_process.items()
|
for p, threads in threads_by_process.items()
|
||||||
@@ -524,7 +524,7 @@ def compute_static_layout(rules: RuleSet, extractor: StaticFeatureExtractor, cap
|
|||||||
address=frz.Address.from_capa(f),
|
address=frz.Address.from_capa(f),
|
||||||
matched_basic_blocks=tuple(
|
matched_basic_blocks=tuple(
|
||||||
rdoc.BasicBlockLayout(address=frz.Address.from_capa(bb)) for bb in bbs if bb in matched_bbs
|
rdoc.BasicBlockLayout(address=frz.Address.from_capa(bb)) for bb in bbs if bb in matched_bbs
|
||||||
) # this object is open to extension in the future,
|
), # this object is open to extension in the future,
|
||||||
# such as with the function name, etc.
|
# such as with the function name, etc.
|
||||||
)
|
)
|
||||||
for f, bbs in bbs_by_function.items()
|
for f, bbs in bbs_by_function.items()
|
||||||
|
|||||||
@@ -160,8 +160,7 @@ class CompoundStatementType:
|
|||||||
OPTIONAL = "optional"
|
OPTIONAL = "optional"
|
||||||
|
|
||||||
|
|
||||||
class StatementModel(FrozenModel):
|
class StatementModel(FrozenModel): ...
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
class CompoundStatement(StatementModel):
|
class CompoundStatement(StatementModel):
|
||||||
@@ -650,9 +649,9 @@ class ResultDocument(FrozenModel):
|
|||||||
return ResultDocument(meta=meta, rules=rule_matches)
|
return ResultDocument(meta=meta, rules=rule_matches)
|
||||||
|
|
||||||
def to_capa(self) -> Tuple[Metadata, Dict]:
|
def to_capa(self) -> Tuple[Metadata, Dict]:
|
||||||
capabilities: Dict[
|
capabilities: Dict[str, List[Tuple[capa.features.address.Address, capa.features.common.Result]]] = (
|
||||||
str, List[Tuple[capa.features.address.Address, capa.features.common.Result]]
|
collections.defaultdict(list)
|
||||||
] = collections.defaultdict(list)
|
)
|
||||||
|
|
||||||
# this doesn't quite work because we don't have the rule source for rules that aren't matched.
|
# this doesn't quite work because we don't have the rule source for rules that aren't matched.
|
||||||
rules_by_name = {
|
rules_by_name = {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|||||||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and limitations under the License.
|
See the License for the specific language governing permissions and limitations under the License.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from typing import cast
|
from typing import cast
|
||||||
|
|
||||||
import tabulate
|
import tabulate
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ dev = [
|
|||||||
"flake8-use-pathlib==0.3.0",
|
"flake8-use-pathlib==0.3.0",
|
||||||
"flake8-copyright==0.2.4",
|
"flake8-copyright==0.2.4",
|
||||||
"ruff==0.1.14",
|
"ruff==0.1.14",
|
||||||
"black==23.12.1",
|
"black==24.1.1",
|
||||||
"isort==5.13.2",
|
"isort==5.13.2",
|
||||||
"mypy==1.8.0",
|
"mypy==1.8.0",
|
||||||
"psutil==5.9.2",
|
"psutil==5.9.2",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|||||||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and limitations under the License.
|
See the License for the specific language governing permissions and limitations under the License.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
import argparse
|
import argparse
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|||||||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and limitations under the License.
|
See the License for the specific language governing permissions and limitations under the License.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
import argparse
|
import argparse
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|||||||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and limitations under the License.
|
See the License for the specific language governing permissions and limitations under the License.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import binascii
|
import binascii
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|||||||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and limitations under the License.
|
See the License for the specific language governing permissions and limitations under the License.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import gc
|
import gc
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|||||||
Reference in New Issue
Block a user