type: capa.render.result_document

This commit is contained in:
William Ballenthin
2021-06-09 23:15:45 -06:00
parent 469e2ff870
commit 6918a039e9

View File

@@ -5,10 +5,14 @@
# 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.
from typing import Dict, List, Tuple
import capa.rules
import capa.engine
import capa.render.utils
import capa.features.common
from capa.rules import RuleSet
from capa.engine import Result
def convert_statement_to_result_document(statement):
@@ -209,7 +213,7 @@ def convert_meta_to_result_document(meta):
return meta
def parse_canonical_attack(attack):
def parse_canonical_attack(attack: str):
"""
parse capa's canonical ATT&CK representation: `Tactic::Technique::Subtechnique [Identifier]`
"""
@@ -233,7 +237,7 @@ def parse_canonical_attack(attack):
}
def parse_canonical_mbc(mbc):
def parse_canonical_mbc(mbc: str):
"""
parse capa's canonical MBC representation: `Objective::Behavior::Method [Identifier]`
"""
@@ -257,7 +261,7 @@ def parse_canonical_mbc(mbc):
}
def convert_capabilities_to_result_document(meta, rules, capabilities):
def convert_capabilities_to_result_document(meta, rules: RuleSet, capabilities: Dict[str, List[Tuple[int, Result]]]):
"""
convert the given rule set and capabilities result to a common, Python-native data structure.
this format can be directly emitted to JSON, or passed to the other `capa.render.*.render()` routines