From 0a61d86d99f6c57e81ece423d29b671907c69032 Mon Sep 17 00:00:00 2001 From: Adam Storek Date: Tue, 5 Jul 2022 12:23:45 -0400 Subject: [PATCH] Modifying extraction of global statements to omit local function declarations. --- capa/features/extractors/ts/query.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/capa/features/extractors/ts/query.py b/capa/features/extractors/ts/query.py index 25de4c22bd..796817e9a9 100644 --- a/capa/features/extractors/ts/query.py +++ b/capa/features/extractors/ts/query.py @@ -35,6 +35,8 @@ def __init__(self, language: str): self.namespace = self.language.query( "(using_directive [(identifier) @namespace (qualified_name) @namespace])" ) - self.global_statement = self.language.query("(global_statement) @global-statement") + self.global_statement = self.language.query( + "(global_statement [(expression_statement) @global-statement (local_declaration_statement) @global-statement])" + ) else: raise NotImplementedError(f"Tree-sitter queries for {language} are not implemented.")