mirror of
https://github.com/mandiant/capa.git
synced 2026-02-04 19:12:01 -08:00
linter: improve linter-data.json opening and add documentation
- Open linter-data.json in byte mode - Add a comment explaining how to invoke the script
This commit is contained in:
@@ -24,7 +24,6 @@ import difflib
|
||||
import hashlib
|
||||
import inspect
|
||||
import logging
|
||||
import os.path
|
||||
import pathlib
|
||||
import argparse
|
||||
import itertools
|
||||
@@ -236,7 +235,7 @@ class InvalidAttckOrMbcTechnique(Lint):
|
||||
super(InvalidAttckOrMbcTechnique, self).__init__()
|
||||
|
||||
try:
|
||||
with open("scripts/linter-data.json", "r") as fd:
|
||||
with open(f"{os.path.dirname(__file__)}/linter-data.json", "rb") as fd:
|
||||
self.data = json.load(fd)
|
||||
self.enabled_frameworks = self.data.keys()
|
||||
except BaseException:
|
||||
@@ -247,7 +246,7 @@ class InvalidAttckOrMbcTechnique(Lint):
|
||||
)
|
||||
self.enabled_frameworks = []
|
||||
|
||||
# This regex match the format defined in the recommendation attribute
|
||||
# This regex matches the format defined in the recommendation attribute
|
||||
self.reg = re.compile("^([a-zA-Z| ]+)::(.*) \[([A-Za-z0-9.]+)\]$")
|
||||
|
||||
def _entry_check(self, framework, category, entry, eid):
|
||||
|
||||
Reference in New Issue
Block a user