コード例 #1
0
ファイル: IronJint.cs プロジェクト: welias/IronWASP
 public static TraceResult Trace(string Code, string Keyword)
 {
     IronJint IJ = new IronJint();
     IJ.SetSourcesAndSinks(new List<string>() { Keyword }, DefaultSinkObjects, new List<string>(), DefaultSinkReturningMethods, DefaultArgumentReturningMethods, DefaultArgumentAssignedASourceMethods, DefaultArgumentAssignedToSinkMethods);
     IJ.ClearAllTaint();
     IJ.JintStack.Clear();
     IJ.KeywordToTrace = Keyword;
     IJ.TraceKeyword = true;
     string CleanCode = Beautify(Code);
     //List<string> Lines = new List<string>(CleanCode.Split(new string[] { "\r\n" }, StringSplitOptions.None));
     IJ.Analyze(CleanCode);
     //return IJ;
     TraceResult TR = new TraceResult();
     TR.Lines.AddRange(IJ.RawLines);
     TR.SourceLineNos.AddRange(IJ.SourceLines);
     TR.SinkLineNos.AddRange(IJ.SinkLines);
     TR.SourceToSinkLineNos.AddRange(IJ.SourceToSinkLines);
     foreach (int LineNo in TR.SourceLineNos)
     {
         TR.SourceLines.Add(IJ.RawLines[LineNo - 1]);
     }
     foreach (int LineNo in TR.SinkLineNos)
     {
         TR.SinkLines.Add(IJ.RawLines[LineNo - 1]);
     }
     foreach (int LineNo in TR.SourceToSinkLineNos)
     {
         TR.SourceToSinkLines.Add(IJ.RawLines[LineNo - 1]);
     }
     TR.KeywordContexts.AddRange(IJ.KeywordContexts);
     return TR;
 }
コード例 #2
0
ファイル: IronJint.cs プロジェクト: welias/IronWASP
 public static TraceResult Trace(string Code)
 {
     IronJint IJ = new IronJint();
     IJ.SetSourcesAndSinks(DefaultSourceObjects, DefaultSinkObjects, DefaultSourceReturningMethods, DefaultSinkReturningMethods, DefaultArgumentReturningMethods, DefaultArgumentAssignedASourceMethods, DefaultArgumentAssignedToSinkMethods);
     IJ.ClearAllTaint();
     IJ.JintStack.Clear();
     string CleanCode = Beautify(Code);
     IJ.Analyze(CleanCode);
     TraceResult TR = new TraceResult();
     TR.Lines.AddRange(IJ.RawLines);
     TR.SourceLineNos.AddRange(IJ.SourceLines);
     TR.SinkLineNos.AddRange(IJ.SinkLines);
     TR.SourceToSinkLineNos.AddRange(IJ.SourceToSinkLines);
     foreach (int LineNo in TR.SourceLineNos)
     {
         TR.SourceLines.Add(IJ.RawLines[LineNo - 1]);
     }
     foreach (int LineNo in TR.SinkLineNos)
     {
         TR.SinkLines.Add(IJ.RawLines[LineNo - 1]);
     }
     foreach (int LineNo in TR.SourceToSinkLineNos)
     {
         TR.SourceToSinkLines.Add(IJ.RawLines[LineNo - 1]);
     }
     return TR;
 }