示例#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
        public virtual Parser build()
        {
            Parser parser = new Parser();

            // decide what to show
            AAction.displaySemi  = true;
            AAction.displayStack = false;  // this is default so redundant

            // action used for namespaces, classes, and functions
            PushStack_rel push = new PushStack_rel(repo_rel);

            //detect Inheritance elem info
            DetectInheritance detectIn = new DetectInheritance();

            detectIn.add(push);
            parser.add(detectIn);
            // capture namespace info
            DetectNamespace detectNS = new DetectNamespace();

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

            // capture class info
            DetectClass detectCl = new DetectClass();

            detectCl.add(push);
            parser.add(detectCl);

            // capture aggregation info
            DetectAggregation detectAg = new DetectAggregation();

            detectAg.add(push);
            parser.add(detectAg);

            DetectComposition detectComp = new DetectComposition();

            detectComp.add(push);
            parser.add(detectComp);

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

            anon.add(push);
            parser.add(anon);
            return(parser);
        }
        public virtual Parser build()
        {
            Parser parser = new Parser();

            // decide what to show
            AAction.displaySemi  = false;
            AAction.displayStack = false;  // this is default so redundant

            // action used for inheritance, aggregation, composition and using
            PushStackRelationship push = new PushStackRelationship(repo);

            // capture Inheritance info
            DetectInheritance detectNS = new DetectInheritance();

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

            // capture class info
            DetectClass detectCl = new DetectClass();

            detectCl.add(push);
            parser.add(detectCl);

            // capture Aggr info
            DetectAggregation detectAG = new DetectAggregation();

            detectAG.add(push);
            parser.add(detectAG);

            // capture Composition info
            DetectComposition detectCP = new DetectComposition();

            detectCP.add(push);
            parser.add(detectCP);

            // capture Using info
            DetectUsing detectUs = new DetectUsing();

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

            // parser configured
            return(parser);
        }
示例#4
0
        /*creates the parser object and adds all the rules used to find the relationships like
         * inheritance/aggregation/composition/using
         */
        public virtual Parser build()
        {
            Parser parser = new Parser();

            // decide what to show
            AAction.displaySemi  = true;
            AAction.displayStack = false;  // this is default so redundant

            // action used for namespaces, classes, and functions
            PushStack push = new PushStack(repo);

            // Find inheritance info
            DetectInheritance detectIn = new DetectInheritance();

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

            // Find aggregated info
            DetectAggregation detectAg = new DetectAggregation();

            detectAg.add(push);
            parser.add(detectAg);

            // Find composition info
            DetectComposition detectCs = new DetectComposition();

            detectCs.add(push);
            parser.add(detectCs);

            // Find using info
            DetectUsing detectUs = new DetectUsing();

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

            // parser configured
            return(parser);
        }
        public virtual Parser build()
        {
            Parser parser = new Parser();

            // decide what to show
            AAction.displaySemi = true;
            AAction.displayStack = false;  // this is default so redundant

            // action used for namespaces, classes, and functions
            PushStack push = new PushStack(repo);

            // capture inheritance info
            DetectInheritance detectIn = new DetectInheritance();
            detectIn.add(push);
            parser.add(detectIn);

            // capture aggregated info
            DetectAggregation detectAg = new DetectAggregation();
            detectAg.add(push);
            parser.add(detectAg);

            DetectComposition detectCs = new DetectComposition();
            detectCs.add(push);
            parser.add(detectCs);

            DetectUsing detectUs = new DetectUsing();
            detectUs.add(push);
            parser.add(detectUs);

            // parser configured
            return parser;
        }
示例#6
0
        public virtual Parser build()
        {
            Parser parser = new Parser();

            // decide what to show
            AAction.displaySemi = false;
            AAction.displayStack = false;  // this is default so redundant

            // action used for inheritance, aggregation, composition and using
            PushStackRelationship push = new PushStackRelationship(repo);

            // capture Inheritance info
            DetectInheritance detectNS = new DetectInheritance();
            detectNS.add(push);
            parser.add(detectNS);

            // capture class info
            DetectClass detectCl = new DetectClass();
            detectCl.add(push);
            parser.add(detectCl);

            // capture Aggr info
            DetectAggregation detectAG = new DetectAggregation();
            detectAG.add(push);
            parser.add(detectAG);

            // capture Composition info
            DetectComposition detectCP = new DetectComposition();
            detectCP.add(push);
            parser.add(detectCP);

            // capture Using info
            DetectUsing detectUs = new DetectUsing();
            detectUs.add(push);
            parser.add(detectUs);

            // parser configured
            return parser;
        }
    public virtual Parser build_relation()
    {
        Parser parser_rel = new Parser();

        // decide what to show
        AAction.displaySemi = false;
        AAction.displayStack = false;  // this is default so redundant

        //// action used for namespaces, classes, and functions
        PushStack_relation push_rel = new PushStack_relation(repo);

        // capture inheritence info
        DetectInheritance detectIn = new DetectInheritance();
        detectIn.add(push_rel);
        parser_rel.add(detectIn);

        // capture inheritence info
        DetectAggregation detectAg = new DetectAggregation();
        detectAg.add(push_rel);
        parser_rel.add(detectAg);

        // capture using info
        DetectUsing detectUs = new DetectUsing();
        detectUs.add(push_rel);
        parser_rel.add(detectUs);

        // capture using info
        DetectComposition detectCm = new DetectComposition();
        detectCm.add(push_rel);
        parser_rel.add(detectCm);

        // capture inheritence info
        DetectClassRelation detectCl = new DetectClassRelation();
        detectCl.add(push_rel);
        parser_rel.add(detectCl);


        // parser configured
        return parser_rel;

    }