Beispiel #1
0
        internal static bool CanScan(Request Req)
        {
            string Signature = "";

            try
            {
                Signature = MakeSignature(Req);
            }
            catch (Exception Exp)
            {
                IronException.Report("ScanBranch error creating signatures", Exp.Message, Exp.StackTrace);
                return(true);//empty signature should not be added and checked
            }
            if (NewRequestSignatures.Contains(Signature))
            {
                return(false);
            }
            else
            {
                NewRequestSignatures.Add(Signature);
                if (SkipScanned)
                {
                    if (RequestSignatures.Contains(Signature))
                    {
                        return(false);
                    }
                }
                return(true);
            }
        }
Beispiel #2
0
 internal static void StartBranchScan()
 {
     try
     {
         ScanDone   = 0;
         TotalScans = ProxyLogIDs.Count;
         NewRequestSignatures.Clear();
         ScanItemUniquenessChecker UniqueChecker = new ScanItemUniquenessChecker(true);
         foreach (int i in ScanBranch.ProxyLogIDs)
         {
             ScanItem(UniqueChecker, "Proxy", i);
         }
         foreach (int i in ScanBranch.ProbeLogIDs)
         {
             ScanItem(UniqueChecker, "Probe", i);
         }
         foreach (string Signature in NewRequestSignatures)
         {
             if (!RequestSignatures.Contains(Signature))
             {
                 RequestSignatures.Add(Signature);
             }
         }
         NewRequestSignatures.Clear();
         IronUI.UpdateScanBranchStats(0, 0, "All Scan Jobs Created && Queued. Close this Window.", false, true);
     }
     catch (ThreadAbortException)
     {
         //
     }
     catch (Exception Exp)
     {
         IronException.Report("Scan Branch Exception", Exp.Message, Exp.StackTrace);
     }
 }
Beispiel #3
0
 static void Executor()
 {
     while (On)
     {
         try
         {
             On = false;
             if (QueuedCommands.Length > 0)
             {
                 InteractiveShellResult Result = IronScripting.ExecuteMultiLineShellInput(QueuedCommands);
                 IronUI.UpdateInteractiveShellResult(Result);
             }
             else
             {
                 InteractiveShellResult Result = IronScripting.ExecuteInteractiveShellInput(QueuedCommand);
                 IronUI.UpdateInteractiveShellResult(Result);
             }
         }
         catch (ThreadAbortException)
         {
         }
         catch (Exception exp)
         {
             IronException.Report("Error executing Scripting Shell commands", exp.Message, exp.StackTrace);
         }
         MSR.Reset();
         MSR.WaitOne();
     }
 }
Beispiel #4
0
        private void CodeTextBox_Load(object sender, EventArgs e)
        {
            Editor.ShowTabs         = false;
            Editor.ShowEOLMarkers   = false;
            Editor.ShowSpaces       = false;
            Editor.ShowInvalidLines = false;
            Editor.TabIndent        = 2;
            try
            {
                if (this.LangCode == 1)
                {
                    Editor.SetHighlighting("Python");
                }
                else
                {
                    Editor.SetHighlighting("Ruby");
                }
            }
            catch (Exception Exp)
            {
                IronException.Report("Unable to set Syntax Highlighting", Exp);
            }

            Editor.ActiveTextAreaControl.TextArea.KeyUp += new System.Windows.Forms.KeyEventHandler(Editor_KeyUp);
        }
Beispiel #5
0
 void SetUpDirAndFileDictionaries()
 {
     try
     {
         StreamReader Reader  = File.OpenText(Config.RootDir + "/DirNamesDictionary.txt");
         string       DirList = Reader.ReadToEnd();
         Reader.Close();
         DirNamesToCheck = new List <string>(DirList.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries));
     }
     catch (Exception Exp)
     {
         IronException.Report("Error loading DirNamesDictionary.txt", Exp);
     }
     try
     {
         StreamReader Reader   = File.OpenText(Config.RootDir + "/FileNamesDictionary.txt");
         string       FileList = Reader.ReadToEnd();
         Reader.Close();
         FileNamesToCheck = new List <string>(FileList.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries));
     }
     catch (Exception Exp)
     {
         IronException.Report("Error loading FileNamesDictionary.txt", Exp);
     }
 }
Beispiel #6
0
 public static void Add(FormatPlugin FP)
 {
     if ((FP.Name.Length > 0) && !(FP.Name.Equals("All") || FP.Name.Equals("None") || FP.Name.Equals("Normal")))
     {
         if (!List().Contains(FP.Name))
         {
             if (FP.FileName != "Internal")
             {
                 FP.FileName = PluginEngine.FileName;
             }
             Collection.Add(FP);
         }
     }
     else
     {
         if (FP.Name.Length == 0)
         {
             IronException.Report("Invalid Format Plugin Name", "The Format Plugin's name is empty so it cannot be loaded.");
         }
         else
         {
             IronException.Report("Invalid Format Plugin Name", string.Format("The Format Plugin's name is '{0}' which is an invalid value. Set a different name.", FP.Name));
         }
     }
 }
Beispiel #7
0
 internal static void DoStop()
 {
     try
     {
         Stopped = true;
         if (ScanManagerThread != null)
         {
             if (ScanManagerThread.ThreadState == ThreadState.Running && !CanStop)
             {
                 //ask if user is sure about stopping scan and then call...
                 EndAll();
             }
             else
             {
                 EndAll();
             }
         }
         else
         {
             IronUI.UpdateConsoleControlsStatus(false);
         }
     }
     catch (Exception Exp)
     {
         IronException.Report("Error stopping the Scan", Exp);
     }
 }
Beispiel #8
0
        static void MarkForJavaScriptTesting(object Details)
        {
            try
            {
                object[]      DetailsArray = (object[])Details;
                RequestSource Source       = (RequestSource)DetailsArray[0];
                int           ID           = (int)DetailsArray[1];

                Session IrSe = GetLog(Source, ID);
                if (IrSe == null)
                {
                    IronUI.ShowLogStatus("Unable to read Response from log", true);
                    return;
                }
                if (IrSe.Response == null)
                {
                    IronUI.ShowLogStatus("Unable to read Response from log", true);
                    return;
                }
                IronUI.FillAndShowJavaScriptTester(IrSe.Response.BodyString);
            }
            catch (Exception Exp)
            {
                IronUI.ShowLogStatus("Unable to read Response from Log", true);
                IronException.Report("Error reading from log", Exp.Message, Exp.StackTrace);
            }
        }
Beispiel #9
0
        static void CopyResponse(object Details)
        {
            try
            {
                object[]      DetailsArray = (object[])Details;
                RequestSource Source       = (RequestSource)DetailsArray[0];
                int           ID           = (int)DetailsArray[1];

                Session IrSe = GetLog(Source, ID);
                if (IrSe == null)
                {
                    IronUI.ShowLogStatus("Unable to read Response from log", true);
                    return;
                }
                if (IrSe.Response == null)
                {
                    IronUI.ShowLogStatus("Unable to read Response from log", true);
                    return;
                }
                IronUI.SetClipBoard(IrSe.Response.ToString());
            }
            catch (Exception Exp)
            {
                IronUI.ShowLogStatus("Unable to read Request from Log", true);
                IronException.Report("Error reading from log", Exp.Message, Exp.StackTrace);
            }
        }
Beispiel #10
0
        void ShowSelectedLog(object SelectedLogInfoObject)
        {
            object[] SelectedLogInfo = (object[])SelectedLogInfoObject;
            string   Source          = SelectedLogInfo[0].ToString();
            int      LogId           = (int)SelectedLogInfo[1];

            try
            {
                Session Session = Session.FromLog(LogId, Source);

                if (Session.Request != null)
                {
                    RequestView.SetRequest(Session.Request);

                    if (Session.Response != null)
                    {
                        ResponseView.SetResponse(Session.Response, Session.Request);
                    }
                }
            }
            catch (ThreadAbortException) { }
            catch (Exception Exp) { IronException.Report("Error loading Selected Log info in Log Analyzer", Exp); }
            finally
            {
                EndLogLoad();
            }
        }
Beispiel #11
0
        static void MarkForScanning(object Details)
        {
            try
            {
                object[]      DetailsArray = (object[])Details;
                RequestSource Source       = (RequestSource)DetailsArray[0];
                int           ID           = (int)DetailsArray[1];

                Session IrSe = GetLog(Source, ID);
                if (IrSe == null)
                {
                    IronUI.ShowLogStatus("Unable to read Request from log", true);
                    return;
                }
                if (IrSe.Request == null)
                {
                    IronUI.ShowLogStatus("Unable to read Request from log", true);
                    return;
                }
                int ScanID = Interlocked.Increment(ref Config.ScanCount);
                IronDB.CreateScan(ScanID, IrSe.Request);
                IronUI.CreateScan(ScanID, "Not Started", IrSe.Request.Method, IrSe.Request.FullUrl);
                IronUI.ShowScanJobsQueue();
            }
            catch (Exception Exp)
            {
                IronUI.ShowLogStatus("Unable to read Request from Log", true);
                IronException.Report("Error reading from log", Exp.Message, Exp.StackTrace);
            }
        }
Beispiel #12
0
 internal static void Initialise()
 {
     try
     {
         PyAPI.Load(string.Format("{0}//APIdoc_Py.xml", Config.Path));
     }
     catch (Exception Exp)
     {
         IronException.Report("Unable to load Python API Doc", Exp.Message, Exp.StackTrace);
     }
     try
     {
         RbAPI.Load(string.Format("{0}//APIdoc_Rb.xml", Config.Path));
     }
     catch (Exception Exp)
     {
         IronException.Report("Unable to load Ruby API Doc", Exp.Message, Exp.StackTrace);
     }
     try
     {
         BuildPyAPITrees();
     }
     catch (Exception Exp)
     {
         IronException.Report("Unable to build Python API Doc tree", Exp.Message, Exp.StackTrace);
     }
     try
     {
         BuildRbAPITrees();
     }
     catch (Exception Exp)
     {
         IronException.Report("Unable to build Python API Doc tree", Exp.Message, Exp.StackTrace);
     }
 }
Beispiel #13
0
 internal static void AddScanRequest(Request Request)
 {
     if (Request != null)
     {
         try
         {
             Request ClonedRequest = Request.GetClone(true);
             if (ClonedRequest != null)
             {
                 lock (ScanRequestQ)
                 {
                     ScanRequestQ.Enqueue(ClonedRequest);
                 }
             }
             else
             {
                 Tools.Trace("IronUpdater", "Null Scan Request");
             }
         }
         catch (Exception Exp)
         {
             IronException.Report("Error adding Scan Request for updating", Exp.Message, Exp.StackTrace);
         }
     }
 }
Beispiel #14
0
        void SerializeNewXmlWithFormatPlugin(object PluginNameObject)
        {
            string PluginName = PluginNameObject.ToString();

            try
            {
                Request      Req        = DisplayedRequest.GetClone(true);
                FormatPlugin FP         = FormatPlugin.Get(PluginName);
                Request      NewRequest = FP.ToRequestFromXml(Req, CurrentFormatXml);
                this.DisplayedRequest = NewRequest;
                ShowStatusMsg("");
                this.SetNonFormatPluginRequestFields(NewRequest);
                ShowProgressBar(false);
            }
            catch (ThreadAbortException)
            {
                ShowStatusMsg("");
            }
            catch (Exception Exp)
            {
                IronException.Report(string.Format("Error converting {0} to Request", PluginName), Exp);
                ShowErrorMsg(string.Format("Unable to update edited values in {0}", PluginName));
                ShowProgressBar(false);
            }
        }
Beispiel #15
0
        internal static void SerializeRequestBody(object BFPObject)
        {
            string PluginName = "";

            try
            {
                BodyFormatParamters BFP     = (BodyFormatParamters)BFPObject;
                Request             Request = BFP.Request;
                FormatPlugin        Plugin  = BFP.Plugin;
                PluginName = Plugin.Name;
                string XML = BFP.XML;

                Request NewRequest = Plugin.ToRequestFromXml(Request, XML);
                IronUI.FillMTRequestWithNewRequestFromFormatXML(NewRequest, PluginName);
            }
            catch (ThreadAbortException)
            {
                //
            }
            catch (Exception Exp)
            {
                IronException.Report("Error Serializing 'Manual Testing' Request using Format Plugin - " + PluginName, Exp.Message, Exp.StackTrace);
                IronUI.ShowMTException("Error Serializing");
            }
        }
Beispiel #16
0
        void LoadAndFill()
        {
            if (this.Trace == null)
            {
                this.Trace = IronDB.GetScanTrace(this.TraceId);
            }

            try
            {
                List <object[]> Rows = IronTrace.GetGridRowsFromTraceAndOverviewXml(Trace.OverviewXml, Trace.MessageXml);

                StringBuilder SB = new StringBuilder(@"{\rtf1{\colortbl ;\red0\green77\blue187;\red247\green150\blue70;\red255\green0\blue0;\red0\green200\blue50;\red255\green255\blue255;}");
                SB.Append(Tools.RtfSafe(Trace.GetScanTracePrettyMessage()));

                this.SetTraceData(Rows, SB.ToString());
            }
            catch (Exception Exp)
            {
                IronException.Report("Error loading Scan Trace", Exp);
                this.CloseTraceWindow();
            }

            if (this.UiResults == null)
            {
                DoAnalysis();
            }
            else
            {
                SetAnalysisUiResults(this.UiResults);
            }
        }
Beispiel #17
0
        void DeserializeWithFormatPlugin(object PluginNameObject)
        {
            string PluginName = PluginNameObject.ToString();

            try
            {
                Request      Req = DisplayedRequest.GetClone(true);
                FormatPlugin FP  = FormatPlugin.Get(PluginName);
                CurrentFormatXml         = FP.ToXmlFromRequest(Req);
                CurrentXmlNameValueArray = FormatPlugin.XmlToArray(CurrentFormatXml);
                ShowStatusMsg("");
                SetDeserializedDataInUi(PluginName, CurrentFormatXml, CurrentXmlNameValueArray);
                this.ResetBodyParametersChangedStatus();
                ShowProgressBar(false);
            }
            catch (ThreadAbortException)
            {
                ShowStatusMsg("");
            }
            catch (Exception Exp)
            {
                IronException.Report(string.Format("Error converting Request to {0}", PluginName), Exp);
                ShowErrorMsg(string.Format("Unable to parse Request body as {0}", PluginName));
                ShowProgressBar(false);
            }
        }
Beispiel #18
0
        static void DownloadModule(string ModuleName, string PseudoName)
        {
            Request ModuleFetchReq = new Request(ModuleDownloadBaseUrl + "/" + PseudoName);

            ModuleFetchReq.Source = RequestSource.Stealth;
            Response ModuleFetchRes = ModuleFetchReq.Send();

            if (!ModuleFetchRes.IsSslValid)
            {
                throw new Exception("Invalid SSL Certificate provided by the server");
            }
            if (ModuleFetchRes.Code != 200)
            {
                throw new Exception("Downloading updated modules failed");
            }
            try
            {
                ModuleFetchRes.SaveBody(Config.Path + "\\updates\\modules\\" + ModuleName + ".zip");
                using (ZipFile ZF = ZipFile.Read(Config.Path + "\\updates\\modules\\" + ModuleName + ".zip"))
                {
                    ZF.ExtractAll(Config.Path + "\\updates\\modules\\");
                }
                NewUpdateAvailable = true;
            }
            catch (Exception Exp) { IronException.Report(string.Format("Error Downloading Module: {0} - {1} ", ModuleName, PseudoName), Exp); }
        }
Beispiel #19
0
 internal static void AddScanResponse(Response Response)
 {
     if (Response != null)
     {
         try
         {
             Response ClonedResponse = Response.GetClone(true);
             if (ClonedResponse != null)
             {
                 lock (ScanResponseQ)
                 {
                     ScanResponseQ.Enqueue(ClonedResponse);
                 }
             }
             else
             {
                 Tools.Trace("IronUpdater", "Null Scan Response");
             }
         }
         catch (Exception Exp)
         {
             IronException.Report("Error adding Scan Response for updating", Exp.Message, Exp.StackTrace);
         }
     }
 }
Beispiel #20
0
 private static void ModUi_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
 {
     try
     {
         IronException.Report("Unhandled Exception in ModUi Thread", e.Exception);
         MessageBox.Show("Unhanled Exception was encountered in this Module/Script. Exception details are available under the Exception node.");
     }
     catch { }
 }
Beispiel #21
0
 void SyntaxChecker()
 {
     try
     {
         while (Open)
         {
             string EditorText = "";
             lock (EditorTextStack)
             {
                 if (EditorTextStack.Count > 0)
                 {
                     EditorText = EditorTextStack.Pop();
                     EditorTextStack.Clear();
                 }
             }
             string ErrorMessage = "";
             try
             {
                 string IndentError = "";
                 if (CurrentLanguage.Equals("py"))
                 {
                     IndentError = CheckPythonIndentation(EditorText)[0];
                 }
                 ScriptSource        Source        = Engine.CreateScriptSourceFromString(EditorText);
                 ScriptErrorReporter CompileErrors = new ScriptErrorReporter();
                 Source.Compile(CompileErrors);
                 ErrorMessage = CompileErrors.GetErrors();
                 if (IndentError.Length > 0)
                 {
                     ErrorMessage = string.Format("{0}\r\n{1}", IndentError, ErrorMessage);
                     ShowHideIndentationFixMenu(true);
                 }
                 else
                 {
                     ShowHideIndentationFixMenu(false);
                 }
                 if (ErrorMessage.Length == 0)
                 {
                     ErrorMessage = "0";
                 }
             }
             catch (Exception Exp)
             {
                 ErrorMessage = Exp.Message;
             }
             IronUI.ShowPluginCompilerError(ErrorMessage);
             MRE.Reset();
             MRE.WaitOne();
         }
     }
     catch (ThreadAbortException) { }
     catch (Exception Exp)
     {
         IronException.Report("Error performing Syntax checking", Exp);
     }
 }
Beispiel #22
0
 private static void ModUi_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     try
     {
         Exception Exp = (Exception)e.ExceptionObject;
         IronException.Report("Unhandled Exception in ModUi", Exp);
         MessageBox.Show("Unhanled Exception was encountered in this Module/Script. Exception details are available under the Exception node.");
     }
     catch { }
 }
Beispiel #23
0
        static void LoadPlugin(string PluginFile, ScriptEngine Engine)
        {
            try
            {
                ScriptSource        PluginSource;
                CompiledCode        CompiledPlugin;
                ScriptErrorReporter CompileErrors = new ScriptErrorReporter();
                string ErrorMessage = "";

                fileName = PluginFile.Substring(PluginFile.LastIndexOf('\\') + 1);
                if (StartUp)
                {
                    IronUI.ShowLoadMessage("Loading Plugin - " + fileName);
                }
                if (PluginFile.EndsWith(".py", StringComparison.CurrentCultureIgnoreCase))
                {
                    Engine.Runtime.TryGetEngine("py", out Engine);
                    PluginSource = Engine.CreateScriptSourceFromFile(PluginFile);
                    string IndentError = PluginEditor.CheckPythonIndentation(PluginSource.GetCode())[1];
                    CompiledPlugin = PluginSource.Compile(CompileErrors);
                    ErrorMessage   = CompileErrors.GetErrors();
                    if (IndentError.Length > 0)
                    {
                        ErrorMessage = string.Format("{0}\r\n{1}", IndentError, ErrorMessage);
                    }
                    if (ErrorMessage.Length == 0)
                    {
                        PluginSource.ExecuteProgram();
                    }
                }
                else if (PluginFile.EndsWith(".rb", StringComparison.CurrentCultureIgnoreCase))
                {
                    Engine.Runtime.TryGetEngine("rb", out Engine);
                    PluginSource   = Engine.CreateScriptSourceFromFile(PluginFile);
                    CompiledPlugin = PluginSource.Compile(CompileErrors);
                    ErrorMessage   = CompileErrors.GetErrors();
                    if (ErrorMessage.Length == 0)
                    {
                        PluginSource.ExecuteProgram();
                    }
                }
                if (ErrorMessage.Length > 0)
                {
                    IronException.Report("Syntax error in Plugin - " + PluginFile, ErrorMessage);
                }
            }
            catch (Exception Exp)
            {
                IronException.Report("Error loading plugin - " + PluginFile, Exp.Message, Exp.StackTrace);
            }
            finally
            {
                fileName = "";
            }
        }
Beispiel #24
0
 public static void RunWith(string Executable, string Arguments)
 {
     try
     {
         Process.Start(Executable, Arguments);
     }
     catch (Exception Exp)
     {
         IronException.Report("Unable to start external application", Exp);
     }
 }
Beispiel #25
0
 private void NewDesignToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         CreateDesigner(true, "");
     }
     catch (Exception Exp)
     {
         IronException.Report("Error Creating New Design", Exp);
     }
 }
Beispiel #26
0
 internal static string GetRbDecription(TreeNode Node)
 {
     try
     {
         return(GetDecription(Node, RbAPI));
     }
     catch (Exception Exp)
     {
         IronException.Report("Error reading Ruby API Doc information", Exp.Message, Exp.StackTrace);
         return("");
     }
 }
Beispiel #27
0
        void DoDiff()
        {
            try
            {
                if (FetchFromLogs)
                {
                    this.A = Session.FromLog(this.ALogId, this.LogSource);
                    this.B = Session.FromLog(this.BLogId, this.LogSource);
                }

                string RequestA  = "";
                string RequestB  = "";
                string ResponseA = "";
                string ResponseB = "";
                if (A != null)
                {
                    if (A.Request != null)
                    {
                        RequestA = A.Request.ToString();
                    }
                    if (A.Response != null)
                    {
                        ResponseA = A.Response.ToString();
                    }
                }
                if (B != null)
                {
                    if (B.Request != null)
                    {
                        RequestB = B.Request.ToString();
                    }
                    if (B.Response != null)
                    {
                        ResponseB = B.Response.ToString();
                    }
                }

                string[] RequestSidebySideResults  = DiffWindow.DoSideBySideDiff(RequestA, RequestB);
                string[] ResponseSidebySideResults = DiffWindow.DoSideBySideDiff(ResponseA, ResponseB);
                string   RequestSinglePageResults  = DiffWindow.DoSinglePageDiff(RequestA, RequestB);
                string   ResponseSinglePageResults = DiffWindow.DoSinglePageDiff(ResponseA, ResponseB);
                RequestDRV.ShowDiffResults(RequestSinglePageResults, RequestSidebySideResults[0], RequestSidebySideResults[1]);
                ResponseDRV.ShowDiffResults(ResponseSinglePageResults, ResponseSidebySideResults[0], ResponseSidebySideResults[1]);
            }
            catch (Exception Exp)
            {
                IronException.Report("Error doing diff on Sessions", Exp);
                ShowError();
            }
            EndDiff();
        }
Beispiel #28
0
 private void NewRbScriptFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         PluginEditorTE.Text = File.ReadAllText(Config.RootDir + "\\NewRubyScriptTemplate.txt");
     }
     catch (Exception Exp)
     {
         PluginEditorTE.Text = "";
         IronException.Report("Script Editor Template Error", Exp);
     }
     SetLanguageAsIronRuby();
     OpenedFile = new FileInfo(Config.RootDir + "\\Plugins\\Enter an unique name.rb");
 }
Beispiel #29
0
        private void LogTraceViewer_Load(object sender, EventArgs e)
        {
            try
            {
                MainLoadProgressBar.Visible = true;
                AnalysisProgressBar.Visible = true;

                AnalysisThread = new Thread(LoadAndFill);
                AnalysisThread.Start();
            }
            catch (Exception Exp)
            {
                IronException.Report("Error loading Scan Trace", Exp);
            }
        }
Beispiel #30
0
 void DoAnalysis()
 {
     try
     {
         BehaviourAnalysis BA = new BehaviourAnalysis(ScanTraceBehaviourAnalysis.DefaultErrorKeywords, ScanTraceBehaviourAnalysis.DefaultResponseTimeChange, ScanTraceBehaviourAnalysis.DefaultResponseTimeChangeFactor, ScanTraceBehaviourAnalysis.DefaultCharsCount);
         BA.Analyze(this.Trace.OverviewXml, this.Trace.Section);
         ScanTraceBehaviourAnalysisResultsUiInformation UiReslts = ScanTraceBehaviourAnalysis.GetUiDisplayResults(BA.ResultsXml, BA.BaseLineSession.Response.Code.ToString(), BA.BaseLineRoundtripTime.ToString());
         SetAnalysisUiResults(UiReslts);
     }
     catch (Exception Exp)
     {
         IronException.Report("Error calculating Payload Effect Analysis", Exp);
         SetAnalysisUiResults(new ScanTraceBehaviourAnalysisResultsUiInformation());
     }
 }
Beispiel #31
0
 internal static void Report(string Title, string Message, string StackTrace)
 {
     try
     {
         int ExceptionID = Interlocked.Increment(ref Config.ExceptionsCount);
         IronException IrEx = new IronException();
         IrEx.ID = ExceptionID;
         IrEx.Title = Title;
         IrEx.Message = Message;
         IrEx.StackTrace = StackTrace;
         IronDB.LogException(IrEx);
         IronUI.UpdateException(IrEx);
     }
     catch
     {
         //End of the road
     }
 }
Beispiel #32
0
 internal static List<IronException> GetExceptionLogRecords(int StartID)
 {
     List<IronException> ExceptionLogRecords = new List<IronException>();
     using (SQLiteConnection DB = new SQLiteConnection("data source=" + ExceptionsLogFile))
     {
         DB.Open();
         using (SQLiteCommand cmd = DB.CreateCommand())
         {
             cmd.CommandText = "SELECT ID, Title, Message, StackTrace FROM Exceptions WHERE ID > @StartID LIMIT 1000";
             cmd.Parameters.AddWithValue("@StartID", StartID);
             using (SQLiteDataReader result = cmd.ExecuteReader())
             {
                 while (result.Read())
                 {
                     IronException IrEx = new IronException();
                     IrEx.ID = Int32.Parse(result["ID"].ToString());
                     IrEx.Title = result["Title"].ToString();
                     ExceptionLogRecords.Add(IrEx);
                 }
             }
         }
     }
     return ExceptionLogRecords;
 }
Beispiel #33
0
 internal static IronException GetException(int ID)
 {
     IronException IrEx = null;
     using (SQLiteConnection DB = new SQLiteConnection("data source=" + ExceptionsLogFile))
     {
         DB.Open();
         using (SQLiteCommand cmd = DB.CreateCommand())
         {
             cmd.CommandText = "SELECT Title, Message, StackTrace FROM Exceptions WHERE ID=@ID";
             cmd.Parameters.AddWithValue("@ID", ID);
             using (SQLiteDataReader result = cmd.ExecuteReader())
             {
                 IrEx = new IronException();
                 IrEx.Title = result["Title"].ToString();
                 IrEx.Message = result["Message"].ToString();
                 IrEx.StackTrace = result["StackTrace"].ToString();
             }
         }
     }
     return IrEx;
 }
Beispiel #34
0
 internal static void LogException(IronException IrEx)
 {
     using(SQLiteConnection DB = new SQLiteConnection("data source=" + ExceptionsLogFile))
     {
     DB.Open();
         using(SQLiteCommand Cmd = DB.CreateCommand())
         {
         Cmd.CommandText = "INSERT INTO Exceptions (ID, Title, Message, StackTrace) VALUES (@ID, @Title, @Message, @StackTrace)";
         Cmd.Parameters.AddWithValue("@ID", IrEx.ID);
         Cmd.Parameters.AddWithValue("@Title", IrEx.Title);
         Cmd.Parameters.AddWithValue("@Message", IrEx.Message);
         Cmd.Parameters.AddWithValue("@StackTrace", IrEx.StackTrace);
         Cmd.ExecuteNonQuery();
         }
     }
 }
Beispiel #35
0
 internal static void UpdateException(IronException IrEx)
 {
     if (UI.IronTree.InvokeRequired)
     {
         UpdateException_d UE_d = new UpdateException_d(UpdateException);
         UI.Invoke(UE_d, new object[] { IrEx });
     }
     else
     {
         TreeNode ExceptionsNode = UI.IronTree.Nodes[0].Nodes["Exceptions"];
         ExceptionsNode.Nodes.Add(IrEx.ID.ToString(), IrEx.Title);
         ExceptionsNode.Text = string.Format("Exceptions ({0})", ExceptionsNode.Nodes.Count.ToString());
     }
 }
Beispiel #36
0
 internal static void UpdateResultsTab(IronException IrEx)
 {
     if (UI.ResultsDisplayRTB.InvokeRequired)
     {
         UpdateResultsTabWithException_d URTWE_d = new UpdateResultsTabWithException_d(UpdateResultsTab);
         UI.Invoke(URTWE_d, new object[] { IrEx });
     }
     else
     {
         ResetPluginResultsTab();
         StringBuilder SB = new StringBuilder(@"{\rtf1{\colortbl ;\red0\green77\blue187;}");
         SB.Append(@" \b \fs30 "); SB.Append(Tools.RtfSafe(IrEx.Title)); SB.Append(@"\b0 ");
         SB.Append(@" \par"); SB.Append(@" \par"); SB.Append(@" \fs20 ");
         SB.AppendLine(Tools.RtfSafe(IrEx.Message)); SB.Append(@" \par \par ");
         SB.Append(@" \cf1 \b StackTrace: \b0 \cf0 "); SB.Append(@" \par "); SB.AppendLine(Tools.RtfSafe(IrEx.StackTrace.Replace("\r\n","<i<br>>")));
         SB.Append(@" \par "); SB.Append(@" \par ");
         UI.ResultsDisplayRTB.Rtf = SB.ToString();
         UI.ResultsTriggersGrid.Rows.Clear();
         if (!UI.main_tab.SelectedTab.Name.Equals("mt_results")) UI.main_tab.SelectTab("mt_results");
     }
 }