Example #1
0
  /*
   * Move include file symbolTable from mst to mift
   */
  public void mvIncludeFiles(List fileList, String file) throws IOException {
    if (GlobalDataApp.args_flags[3] == 1) {
      if (GlobalDataSqli.MainIncludeFilesTable.containsKey(file) == false) {
        if (GlobalDataSqli.MainSymbolTable.containsKey(file) == true) {
          GlobalDataSqli.MainIncludeFilesTable.put(
              file, (SymbolTable) GlobalDataSqli.MainSymbolTable.get(file));
          GlobalDataSqli.MainSymbolTable.remove(file);
        } else {
          try {
            // file include do not exists in mst and mift
            // Create AST
            buildAST ast = new buildAST(file, 0);
            CommonTreeNodeStream nodes = ast.getNodes();

            // build walker tree to SQLI
            buildWalkerTree_sqli sqli =
                new buildWalkerTree_sqli(
                    nodes,
                    file,
                    GlobalDataSqli.MainSymbolTable,
                    GlobalDataSqli.MainIncludeFilesTable,
                    GlobalDataSqli.MainFunctionsTable,
                    GlobalDataSqli.MainFunctionsTaintedTable,
                    GlobalDataSqli.MainTaintedTable,
                    GlobalDataSqli.mus,
                    GlobalDataSqli.MainLinesToCorrect,
                    GlobalDataSqli.MainClassesTable,
                    GlobalDataSqli.MainInstancesTable,
                    fileList);

            GlobalDataSqli.MainIncludeFilesTable.put(
                file, (SymbolTable) GlobalDataSqli.MainSymbolTable.get(file));
            GlobalDataSqli.MainSymbolTable.remove(file);
          } catch (RecognitionException ex) {
            Logger.getLogger(SymbolTable.class.getName()).log(Level.SEVERE, null, ex);
          }
        }
      }
    }

    if (GlobalDataApp.args_flags[6] == 1) {
      if (GlobalDataCodeInj.MainIncludeFilesTable.containsKey(file) == false) {
        if (GlobalDataCodeInj.MainSymbolTable.containsKey(file) == true) {
          GlobalDataCodeInj.MainIncludeFilesTable.put(
              file, (SymbolTable) GlobalDataCodeInj.MainSymbolTable.get(file));
          GlobalDataCodeInj.MainSymbolTable.remove(file);
        } else {
          try {
            // file include do not exists in mst and mift
            // Create AST
            buildAST ast = new buildAST(file, 0);
            CommonTreeNodeStream nodes = ast.getNodes();

            // build walker tree to Code Injection
            buildWalkerTree_CodeInj ci =
                new buildWalkerTree_CodeInj(
                    nodes,
                    file,
                    GlobalDataCodeInj.MainSymbolTable,
                    GlobalDataCodeInj.MainIncludeFilesTable,
                    GlobalDataCodeInj.MainFunctionsTable,
                    GlobalDataCodeInj.MainFunctionsTaintedTable,
                    GlobalDataCodeInj.MainTaintedTable,
                    GlobalDataCodeInj.mus,
                    GlobalDataCodeInj.MainLinesToCorrect,
                    GlobalDataCodeInj.MainClassesTable,
                    GlobalDataCodeInj.MainInstancesTable,
                    fileList);

            GlobalDataCodeInj.MainIncludeFilesTable.put(
                file, (SymbolTable) GlobalDataCodeInj.MainSymbolTable.get(file));
            GlobalDataCodeInj.MainSymbolTable.remove(file);
          } catch (Exception ex) {
            Logger.getLogger(SymbolTable.class.getName()).log(Level.SEVERE, null, ex);
          }
        }
      }
    }

    if (GlobalDataApp.args_flags[7] == 1) {
      if (GlobalDataXSS.MainIncludeFilesTable.containsKey(file) == false) {
        if (GlobalDataXSS.MainSymbolTable.containsKey(file) == true) {
          GlobalDataXSS.MainIncludeFilesTable.put(
              file, (SymbolTable) GlobalDataXSS.MainSymbolTable.get(file));
          GlobalDataXSS.MainSymbolTable.remove(file);
        } else {
          try {
            // file include do not exists in mst and mift
            // Create AST
            buildAST ast = new buildAST(file, 0);
            CommonTreeNodeStream nodes = ast.getNodes();

            // build walker tree to XSS
            buildWalkerTree_XSS xss =
                new buildWalkerTree_XSS(
                    nodes,
                    file,
                    GlobalDataXSS.MainSymbolTable,
                    GlobalDataXSS.MainIncludeFilesTable,
                    GlobalDataXSS.MainFunctionsTable,
                    GlobalDataXSS.MainFunctionsTaintedTable,
                    GlobalDataXSS.MainTaintedTable,
                    GlobalDataXSS.mus,
                    GlobalDataXSS.MainLinesToCorrect,
                    GlobalDataXSS.MainClassesTable,
                    GlobalDataXSS.MainInstancesTable,
                    fileList);

            GlobalDataXSS.MainIncludeFilesTable.put(
                file, (SymbolTable) GlobalDataXSS.MainSymbolTable.get(file));
            GlobalDataXSS.MainSymbolTable.remove(file);
          } catch (Exception ex) {
            Logger.getLogger(SymbolTable.class.getName()).log(Level.SEVERE, null, ex);
          }
        }
      }
    }
  }
Example #2
0
  /*
   * Move include file symbolTable from mst to mift
   */
  public void mvIncludeFiles(List fileList) throws IOException {
    for (Iterator<String> it1 = this.getIncludeFiles().iterator(); it1.hasNext(); ) {
      String s = it1.next();
      if (GlobalDataApp.args_flags[3] == 1) {
        if (GlobalDataSqli.MainSymbolTable.containsKey(s) == true) {
          GlobalDataSqli.MainIncludeFilesTable.put(
              s, (SymbolTable) GlobalDataSqli.MainSymbolTable.get(s));
          GlobalDataSqli.MainSymbolTable.remove(s);
        } else {
          if (GlobalDataSqli.MainIncludeFilesTable.containsKey(s) == false) {
            try {
              // file include do not exists in mst and mift
              // Create AST
              buildAST ast = new buildAST(s, 0);
              CommonTreeNodeStream nodes = ast.getNodes();

              // build walker tree to SQLI
              buildWalkerTree_sqli sqli =
                  new buildWalkerTree_sqli(
                      nodes,
                      s,
                      GlobalDataSqli.MainSymbolTable,
                      GlobalDataSqli.MainIncludeFilesTable,
                      GlobalDataSqli.MainFunctionsTable,
                      GlobalDataSqli.MainFunctionsTaintedTable,
                      GlobalDataSqli.MainTaintedTable,
                      GlobalDataSqli.mus,
                      GlobalDataSqli.MainLinesToCorrect,
                      GlobalDataSqli.MainClassesTable,
                      GlobalDataSqli.MainInstancesTable,
                      fileList);

              GlobalDataSqli.MainIncludeFilesTable.put(
                  s, (SymbolTable) GlobalDataSqli.MainSymbolTable.get(s));
              GlobalDataSqli.MainSymbolTable.remove(s);
            } catch (RecognitionException ex) {
              Logger.getLogger(SymbolTable.class.getName()).log(Level.SEVERE, null, ex);
            }
          }
        }

        SymbolTable st_aux = GlobalDataSqli.MainIncludeFilesTable.get(s);
        if (st_aux.getIncludeFiles().isEmpty() == false) {
          st_aux.mvIncludeFiles(fileList);
        }
      }

      if (GlobalDataApp.args_flags[6] == 1) {
        if (GlobalDataCodeInj.MainSymbolTable.containsKey(s) == true) {
          GlobalDataCodeInj.MainIncludeFilesTable.put(
              s, (SymbolTable) GlobalDataCodeInj.MainSymbolTable.get(s));
          GlobalDataCodeInj.MainSymbolTable.remove(s);
        } else {
          if (GlobalDataCodeInj.MainIncludeFilesTable.containsKey(s) == false) {
            // file include do not exists in mst and mift
            // Create AST
            buildAST ast = new buildAST(s, 0);
            CommonTreeNodeStream nodes = ast.getNodes();

            // build walker tree to SQLI
            buildWalkerTree_CodeInj ci =
                new buildWalkerTree_CodeInj(
                    nodes,
                    s,
                    GlobalDataCodeInj.MainSymbolTable,
                    GlobalDataCodeInj.MainIncludeFilesTable,
                    GlobalDataCodeInj.MainFunctionsTable,
                    GlobalDataCodeInj.MainFunctionsTaintedTable,
                    GlobalDataCodeInj.MainTaintedTable,
                    GlobalDataCodeInj.mus,
                    GlobalDataCodeInj.MainLinesToCorrect,
                    GlobalDataCodeInj.MainClassesTable,
                    GlobalDataCodeInj.MainInstancesTable,
                    fileList);

            GlobalDataCodeInj.MainIncludeFilesTable.put(
                s, (SymbolTable) GlobalDataCodeInj.MainSymbolTable.get(s));
            GlobalDataCodeInj.MainSymbolTable.remove(s);
          }
        }

        SymbolTable st_aux = GlobalDataCodeInj.MainIncludeFilesTable.get(s);
        if (st_aux.getIncludeFiles().isEmpty() == false) {
          st_aux.mvIncludeFiles(fileList);
        }
      }

      if (GlobalDataApp.args_flags[7] == 1) {
        if (GlobalDataXSS.MainSymbolTable.containsKey(s) == true) {
          GlobalDataXSS.MainIncludeFilesTable.put(
              s, (SymbolTable) GlobalDataXSS.MainSymbolTable.get(s));
          GlobalDataXSS.MainSymbolTable.remove(s);
        } else {
          if (GlobalDataXSS.MainIncludeFilesTable.containsKey(s) == false) {
            // file include do not exists in mst and mift
            // Create AST
            buildAST ast = new buildAST(s, 0);
            CommonTreeNodeStream nodes = ast.getNodes();

            // build walker tree to SQLI
            buildWalkerTree_XSS xss =
                new buildWalkerTree_XSS(
                    nodes,
                    s,
                    GlobalDataXSS.MainSymbolTable,
                    GlobalDataXSS.MainIncludeFilesTable,
                    GlobalDataXSS.MainFunctionsTable,
                    GlobalDataXSS.MainFunctionsTaintedTable,
                    GlobalDataXSS.MainTaintedTable,
                    GlobalDataXSS.mus,
                    GlobalDataXSS.MainLinesToCorrect,
                    GlobalDataXSS.MainClassesTable,
                    GlobalDataXSS.MainInstancesTable,
                    fileList);

            GlobalDataXSS.MainIncludeFilesTable.put(
                s, (SymbolTable) GlobalDataXSS.MainSymbolTable.get(s));
            GlobalDataXSS.MainSymbolTable.remove(s);
          }
        }

        SymbolTable st_aux = GlobalDataXSS.MainIncludeFilesTable.get(s);
        if (st_aux.getIncludeFiles().isEmpty() == false) {
          st_aux.mvIncludeFiles(fileList);
        }
      }
    }
  }