示例#1
0
        private void AddRules(Parser parser, PushStack push, AddRelationship addRelationship)
        {
            // capture namespace info
            DetectNamespace detectNS = new DetectNamespace();

            detectNS.add(push);
            parser.add(detectNS);

            // capture Aggregation
            DetectAggregation detectAg = new DetectAggregation();

            detectAg.add(addRelationship);
            parser.add(detectAg);

            // capture class info
            DetectInheritance detectIn = new DetectInheritance();

            detectIn.add(push);
            detectIn.add(addRelationship);
            parser.add(detectIn);


            // capture function info and try to detect using relationship
            DetectUsing detectUs = new DetectUsing();

            detectUs.add(push);
            detectUs.add(addRelationship);
            parser.add(detectUs);

            // handle entering anonymous scopes, e.g., if, while, etc.
            DetectAnonymousScope anon = new DetectAnonymousScope();

            anon.add(push);
            parser.add(anon);

            // handle leaving scopes
            DetectLeavingScope leave = new DetectLeavingScope();
            PopStack           pop   = new PopStack(repo);

            leave.add(pop);
            parser.add(leave);


            // capture Composition
            DetectComposition detectComp = new DetectComposition();

            detectComp.add(addRelationship);
            parser.add(detectComp);
        }
示例#2
0
 private void AddActions(TypeTable interestedTypes, TypeTable allTypes, out PushStack push, out AddRelationship addRelationship)
 {
     // action used for namespaces, classes, and functions
     push            = new PushStack(repo);
     addRelationship = new AddRelationship(repo, interestedTypes, allTypes);
 }