From ef39bc3c3a431cfe5ea2a5d31d110d43a69adc6a Mon Sep 17 00:00:00 2001 From: Aayush Goel <81844215+Aayush-Goel-04@users.noreply.github.com> Date: Tue, 11 Jul 2023 01:14:38 +0530 Subject: [PATCH] Merged Changes from PR #1591 --- capa/features/extractors/dotnetfile.py | 2 +- capa/helpers.py | 1 - capa/ida/plugin/form.py | 1 - capa/main.py | 2 +- scripts/cache-ruleset.py | 1 - scripts/capa_as_library.py | 2 +- scripts/lint.py | 1 - tests/fixtures.py | 1 - tests/test_rule_cache.py | 1 - tests/test_scripts.py | 1 - 10 files changed, 3 insertions(+), 10 deletions(-) diff --git a/capa/features/extractors/dotnetfile.py b/capa/features/extractors/dotnetfile.py index a64e51f3..75f34fa2 100644 --- a/capa/features/extractors/dotnetfile.py +++ b/capa/features/extractors/dotnetfile.py @@ -1,5 +1,5 @@ import logging -from typing import Tuple, Iterator, cast +from typing import Tuple, Iterator from pathlib import Path import dnfile diff --git a/capa/helpers.py b/capa/helpers.py index 0e77dcaa..b8100819 100644 --- a/capa/helpers.py +++ b/capa/helpers.py @@ -5,7 +5,6 @@ # Unless required by applicable law or agreed to in writing, software distributed under the License # 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. -import os import inspect import logging import contextlib diff --git a/capa/ida/plugin/form.py b/capa/ida/plugin/form.py index 92272c12..7436091e 100644 --- a/capa/ida/plugin/form.py +++ b/capa/ida/plugin/form.py @@ -5,7 +5,6 @@ # Unless required by applicable law or agreed to in writing, software distributed under the License # 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. -import os import copy import logging import itertools diff --git a/capa/main.py b/capa/main.py index 7698ca0c..2977b41d 100644 --- a/capa/main.py +++ b/capa/main.py @@ -576,7 +576,7 @@ def get_extractor( return capa.features.extractors.viv.extractor.VivisectFeatureExtractor(vw, path, os_) -def get_file_extractors(sample: str, format_: str) -> List[FeatureExtractor]: +def get_file_extractors(sample: Path, format_: str) -> List[FeatureExtractor]: file_extractors: List[FeatureExtractor] = list() if format_ == FORMAT_PE: diff --git a/scripts/cache-ruleset.py b/scripts/cache-ruleset.py index 7cf2f9f8..6630f2ee 100644 --- a/scripts/cache-ruleset.py +++ b/scripts/cache-ruleset.py @@ -15,7 +15,6 @@ 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. See the License for the specific language governing permissions and limitations under the License. """ -import os import sys import logging import argparse diff --git a/scripts/capa_as_library.py b/scripts/capa_as_library.py index 96b57988..ecc20de1 100644 --- a/scripts/capa_as_library.py +++ b/scripts/capa_as_library.py @@ -2,7 +2,7 @@ import json import collections -from typing import Any, Dict +from typing import Any, Set, Dict from pathlib import Path import capa.main diff --git a/scripts/lint.py b/scripts/lint.py index 0e14a62c..f4be97fd 100644 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -23,7 +23,6 @@ import string import difflib import hashlib import logging -import pathlib import argparse import itertools import posixpath diff --git a/tests/fixtures.py b/tests/fixtures.py index ba00dde0..9e36dd14 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -7,7 +7,6 @@ # 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. -import os import binascii import contextlib import collections diff --git a/tests/test_rule_cache.py b/tests/test_rule_cache.py index f5cca2b6..fd9e53c0 100644 --- a/tests/test_rule_cache.py +++ b/tests/test_rule_cache.py @@ -6,7 +6,6 @@ # 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. -import os import textwrap import capa.rules diff --git a/tests/test_scripts.py b/tests/test_scripts.py index 4b2b6bc1..e8971f0e 100644 --- a/tests/test_scripts.py +++ b/tests/test_scripts.py @@ -6,7 +6,6 @@ # 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. -import os import sys import logging import textwrap