コード例 #1
0
 def ExplainGlobExpression(
     self,
     args: api_flow.ApiExplainGlobExpressionArgs,
     context: Optional[api_call_context.ApiCallContext] = None,
 ) -> api_flow.ApiExplainGlobExpressionHandler:
     del args, context  # Unused.
     return api_flow.ApiExplainGlobExpressionHandler()
コード例 #2
0
 def ExplainGlobExpression(
     self,
     args: api_flow.ApiExplainGlobExpressionArgs,
     token: Optional[access_control.ACLToken] = None
 ) -> api_flow.ApiExplainGlobExpressionHandler:
     del args, token  # Unused.
     return api_flow.ApiExplainGlobExpressionHandler()
コード例 #3
0
ファイル: flow_test.py プロジェクト: viszsec/grr
    def testHandlerUsesKnowledgeBase(self, db: abstract_db.Database):
        token = _CreateToken(db)
        client_id = db_test_utils.InitializeClient(db)

        snapshot = rdf_objects.ClientSnapshot()
        snapshot.client_id = client_id
        snapshot.knowledge_base.users = [rdf_client.User(homedir="/home/foo")]
        db.WriteClientSnapshot(snapshot)

        handler = flow_plugin.ApiExplainGlobExpressionHandler()
        args = flow_plugin.ApiExplainGlobExpressionArgs(
            example_count=2,
            client_id=client_id,
            glob_expression="%%users.homedir%%/foo")
        results = handler.Handle(args, token=token)
        self.assertEqual(list(results.components), [
            rdf_paths.GlobComponentExplanation(
                glob_expression="%%users.homedir%%", examples=["/home/foo"]),
            rdf_paths.GlobComponentExplanation(glob_expression="/foo",
                                               examples=[]),
        ])