Example #1
0
        public virtual Parser build()
        {
            var parser = new Parser();

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

            // save declarations
            var Decl     = new DetectDeclar();
            var saveDecl = new SaveDeclar(repo);

            Decl.add(saveDecl);
            parser.add(Decl);

            var Decl2 = new DetectParamDeclar();

            Decl2.add(saveDecl);
            parser.add(Decl2);

            var Decl3 = new DetectBaseClass();

            Decl3.add(saveDecl);
            parser.add(Decl3);

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

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

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

            // capture using info
            DetectUsing detectU = new DetectUsing();

            detectU.add(push);
            parser.add(detectU);

            // 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 function info
            DetectFunction detectFN = new DetectFunction();

            detectFN.add(push);
            parser.add(detectFN);

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

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

            // show public declarations
            DetectPublicDeclar pubDec = new DetectPublicDeclar();
            SaveDeclar         print  = new SaveDeclar(repo);

            pubDec.add(print);
            parser.add(pubDec);

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

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

            // parser configured
            return(parser);
        }
Example #3
0
        public virtual Parser build()
        {
            Parser parser = new Parser();

            AAction.displaySemi  = false;
            AAction.displayStack = false;
            PushStack       push     = new PushStack(repo);
            DetectNamespace detectNS = new DetectNamespace();

            detectNS.add(push);
            parser.add(detectNS);
            DetectUsing detectUS = new DetectUsing();

            detectUS.add(push);
            parser.add(detectUS);
            DetectDelegate detectDel = new DetectDelegate();

            detectDel.add(push);
            parser.add(detectDel);
            DetectClass detectCl = new DetectClass();

            detectCl.add(push);
            parser.add(detectCl);
            DetectFunction detectFN = new DetectFunction();

            detectFN.add(push);
            parser.add(detectFN);
            DetectAnonymousScope anon = new DetectAnonymousScope();

            anon.add(push);
            parser.add(anon);
            DetectPublicDeclar pubDec = new DetectPublicDeclar();
            SaveDeclar         print  = new SaveDeclar(repo);

            pubDec.add(print);
            parser.add(pubDec);
            DetectLeavingScope leave = new DetectLeavingScope();
            PopStack           pop   = new PopStack(repo);

            leave.add(pop);
            parser.add(leave);
            return(parser);
        }
        public virtual Parser build()
        {
            Parser parser = new Parser();

            // decide what to show
            AAction.displaySemi  = false;
            AAction.displayStack = false; // false is default
            // action used for namespaces, classes, and functions
            PushStack      push       = new PushStack(repo);
            writeTypeTable writetable = new writeTypeTable(repo);                            //add write TypeTable Action to the rules
            // capture namespace info
            DetectNamespace detectNS = new DetectNamespace();

            detectNS.add(push);
            //detectNS.add(writetable);                                                        //add write TypeTable Action to the rules
            parser.add(detectNS);
            // capture class info
            DetectClass detectCl = new DetectClass();

            detectCl.add(push);
            detectCl.add(writetable);
            parser.add(detectCl);
            // capture function info
            DetectFunction detectFN = new DetectFunction();

            detectFN.add(push);
            detectFN.add(writetable);                                                       //add write TypeTable Action to the rules
            parser.add(detectFN);
            DetectDelegate detectD = new DetectDelegate();                                  //capture delegate info

            detectD.add(push);
            detectD.add(writetable);
            parser.add(detectD);
            DetectAlias detectAl = new DetectAlias();                                       //capture Alias info

            detectAl.add(push);
            detectD.add(writetable);
            parser.add(detectAl);
            DetectEnum detectEn = new DetectEnum();                                          //capture Enum info

            detectEn.add(push);
            detectEn.add(writetable);
            parser.add(detectEn);
            // handle entering anonymous scopes, e.g., if, while, etc.
            DetectAnonymousScope anon = new DetectAnonymousScope();

            anon.add(push);
            parser.add(anon);
            // show public declarations
            DetectPublicDeclar pubDec = new DetectPublicDeclar();
            SaveDeclar         print  = new SaveDeclar(repo);

            pubDec.add(print);
            parser.add(pubDec);
            // handle leaving scopes
            DetectLeavingScope leave = new DetectLeavingScope();
            PopStack           pop   = new PopStack(repo);

            leave.add(pop);
            parser.add(leave);     // parser configured
            return(parser);
        }
Example #5
0
        public virtual Parser build(bool isFirstPass)
        {
            repo.isFirstPass = isFirstPass;

            Parser parser = new Parser();

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

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

            // capture namespace info
            DetectNamespace detectNS = new DetectNamespace();

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

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

            detectCl.add(push);
            AddClass addClass = new AddClass(repo);

            detectCl.add(addClass);
            parser.add(detectCl);

            // capture function info
            DetectFunction detectFN = new DetectFunction();

            detectFN.add(push);
            parser.add(detectFN);

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

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

            // detect class members
            DetectClassMembers detectClassMembers = new DetectClassMembers();
            SaveDeclar         saveDeclar         = new SaveDeclar(repo);

            detectClassMembers.add(saveDeclar);
            parser.add(detectClassMembers);

            // detect function members
            DetectFunctionMembers detectFunctionMembers = new DetectFunctionMembers();

            saveDeclar = new SaveDeclar(repo);
            detectFunctionMembers.add(saveDeclar);
            parser.add(detectFunctionMembers);

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

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

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

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

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

              // 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 function info
              DetectFunction detectFN = new DetectFunction();
              detectFN.add(push);
              parser.add(detectFN);

              // capture enum info
              DetectEnum detectEN = new DetectEnum();
              detectEN.add(push);
              parser.add(detectEN);

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

              // show public declarations
              DetectPublicDeclar pubDec = new DetectPublicDeclar();
              SaveDeclar print = new SaveDeclar(repo);
              pubDec.add(print);
              parser.add(pubDec);

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

              // parser configured
              return parser;
        }
Example #7
0
        public virtual Parser build()//Virtual function returns reference to parser ss
        {
            Parser parser = new Parser();


            // decide what to show
            AAction.displaySemi  = false;  //Change here to see things running ss
            AAction.displayStack = false;  // false is default

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

            // capture namespace info
            DetectNamespace detectNS = new DetectNamespace();

            detectNS.add(push);
            parser.add(detectNS);//one rule one action

            // capture delegate info
            DetectDelegate detectDG = new DetectDelegate();

            detectDG.add(push);
            parser.add(detectDG);

            // capture Alias info
            DetectAlias detectAL = new DetectAlias();

            detectAL.add(push);
            parser.add(detectAL);

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

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

            // capture function info
            DetectFunction detectFN = new DetectFunction();

            detectFN.add(push);
            parser.add(detectFN);

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

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

            // show public declarations
            DetectPublicDeclar pubDec = new DetectPublicDeclar();
            SaveDeclar         print  = new SaveDeclar(repo);

            pubDec.add(print);
            parser.add(pubDec);

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

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

            // parser configured
            return(parser);
        }