static void Main()
        {
            //  XRules_Config.PathTo_XRulesDatabase_fromLocalDisk = DI.PathToLocalUnitTestsFiles;
            //   O2AscxGUI.openAscxAsForm(typeof(ascx_PatchAndMonitor));
            //   return;
            if (O2AscxGUI.launch("O2 Scanner - DotNet (Dynamic tracing and patching)"))
            {
                O2AscxGUI.addControlToMenu(typeof(ascx_DotNetGac));

                O2AscxGUI.addControlToMenu(typeof(ascx_XRules_Editor), O2DockState.Document, "XRules Editor");
                O2AscxGUI.addControlToMenu(typeof(ascx_XRules_Execution), O2DockState.Document, "XRules Execution");

                //var unitTestExecution = "UnitTestExecution";
                //var patchandmonitor = "PatchAndMonitor";
                var xRulesEditor = "XRules Editor";
                //O2AscxGUI.openAscx(typeof(ascx_XRules_UnitTestExecution_BigGUI), O2DockState.DockRight, unitTestExecution);
                //O2AscxGUI.openAscx(typeof(ascx_PatchAndMonitor), O2DockState.Document, patchandmonitor);
                O2AscxGUI.openAscx(typeof(ascx_XRules_Editor), O2DockState.Document, xRulesEditor);
                O2AscxGUI.openAscx(typeof(ascx_XRules_UnitTests), O2DockState.DockRight, "XRules_UnitTests");

                O2AscxGUI.openAscx(typeof(ascx_AssemblyInvoke), O2DockState.DockRight, "Invoke Assesmblies");

                //O2DockUtils.setDocState(unitTestExecution,patchandmonitor, DockStyle.Left);
                //O2DockUtils.setDocState(unitTestExecution, xRulesEditor, DockStyle.Left);
            }
        }
示例#2
0
 private static void Main(String[] asArgs)
 {
     if (O2AscxGUI.launch("O2 Tool - Host Local Website"))
     {
         O2AscxGUI.openAscx(typeof(ascx_HostLocalWebsite), O2DockState.Document, "Host Local Website");
     }
 }
 public void openGUI()
 {
     O2AscxGUI.openAscxAsForm(typeof(ascx_ApplyRulesToFindings), applyRulesToFindingsControlName);
     ascx_FindingsViewer.o2AssessmentLoadEngines.Add(new O2AssessmentLoad_OunceV6());
     PublicDI.log.LogRedirectionTarget = null;  //so that the GUI messages go the debug
     loadTestData();
 }
示例#4
0
        // this test expects that there is a current ascx_XRules_Editor loaded in the current GUI
        public void addTextBoxToPanel()
        {
            log.info("in  addTextBoxToPanel");
            var xrulesControl = (ascx_XRules_Editor)O2AscxGUI.getAscx("XRules Editor");

            Assert.That(xrulesControl != null);
            Assert.That(O2Forms_ThreadSafe_ToolStrip.hasToolStripControl(xrulesControl), "xrulesControl control did not contain a ToolStrip control");

            var toolStripControl = O2Forms_ThreadSafe_ToolStrip.getToolStripControl(xrulesControl);

            Assert.That(toolStripControl != null, "toolStripControl was null");

            var newTextBoxName  = "TextBox To Add";
            var newTextBoxValue = "Content of temp textbox";

            Assert.That(false == O2Forms_ThreadSafe_ToolStrip.removeControl(xrulesControl, newTextBoxName), "TextBox To add should NOT BE there at this stage");

            var newTextBoxControl = O2Forms_ThreadSafe_ToolStrip.addTextBox(xrulesControl, newTextBoxName, newTextBoxValue);

            Assert.That(newTextBoxControl != null, "newTextBoxControl was null");

            var itemAdded = O2Forms_ThreadSafe_ToolStrip.getItem(xrulesControl, newTextBoxName);

            Assert.That(itemAdded != null, "itemAdded  == null");
            Assert.That(itemAdded.Text == newTextBoxValue, "itemAdded Text value should be: " + newTextBoxValue);

            Assert.That(O2Forms_ThreadSafe_ToolStrip.removeControl(xrulesControl, newTextBoxName), "TextBox To add should BE there at this stage");
        }
示例#5
0
        public void buildGui()
        {
            // this will make files to be opened on the main Document window
            HandleO2MessageOnSD.setO2MessageFileEventListener();

            if (O2AscxGUI.launch("O2 Tool - Search Engine"))
            // O2Messages.openGUI();
            {
                var fileMappings = (FileMappings)O2AscxGUI.openAscx(typeof(FileMappings), O2DockState.DockLeft, "File Mappings");

                //fileMappings.loadFilesFromFolder(DI.config.CurrentExecutableDirectory);
                //   O2Messages.openControlInGUI(typeof (ascx_TextSearch), O2DockState.Document, "Text Search");

                O2AscxGUI.openAscx(typeof(ascx_SearchTargets), O2DockState.DockRight, "Search Targets");
                O2AscxGUI.openAscx(typeof(ascx_SearchResults), O2DockState.DockTop, "Search Results");

                O2AscxGUI.addControlToMenu(typeof(ascx_FunctionsViewer), O2DockState.Document, "Signatures Viewer");

                OunceAvailableEngines.addAvailableEnginesToControl(typeof(ascx_FindingsViewer));
                //ascx_FindingsViewer.o2AssessmentLoadEngines.Add(new O2AssessmentLoad_OunceV6());
                O2AscxGUI.addControlToMenu(typeof(ascx_FindingsViewer), O2DockState.Document, "Findings Viewer");
                O2AscxGUI.addControlToMenu(typeof(SourceCodeEditor), O2DockState.Document, "Source Code Editor");

/*	            O2AscxGUI.addControlToMenu(typeof (ascx_TilesDefinition_xml));
 *                  O2AscxGUI.addControlToMenu(typeof(ascx_J2EE_web_xml));
 *                  O2AscxGUI.addControlToMenu(typeof (ascx_Validation_xml));
 *                  O2AscxGUI.addControlToMenu(typeof (ascx_Struts_config_xml));
 *                  O2AscxGUI.addControlToMenu(typeof (ascx_StrutsMappings_ManualMapping));
 *                  O2AscxGUI.addControlToMenu(typeof (ascx_DotNet_Dependencies));
 *
 *
 *                  O2AscxGUI.addControlToMenu(typeof(ascx_O2Rules_Struts),O2DockState.Document, "O2 Rules Struts");
 */
            }
        }
示例#6
0
        public void loadTestAssessments()
        {
            var joinSinksToSources = (ascx_JoinSinksToSources)O2AscxGUI.getAscx(joinSinksToSourcesControl);

            joinSinksToSources.getFindingsViewerObjectFor_Sinks().setFilter1Value("KnownSink");
            joinSinksToSources.getFindingsViewerObjectFor_Sources().setFilter1Value("KnownSink");
            var thread = joinSinksToSources.loadFileIntoSinks(testfile);

            Assert.That(thread != null, "thread was null");
            thread.Join();
            thread = joinSinksToSources.loadFileIntoSources(testfile);
            thread.Join();
            var findingsIn_Sinks   = joinSinksToSources.getFindingsIn_Sinks();
            var findingsIn_Sources = joinSinksToSources.getFindingsIn_Sources();

            Assert.That(findingsIn_Sinks.Count() > 0, "findingsIn_Sinks.Count() == 0");
            Assert.That(findingsIn_Sources.Count() > 0, "findingsIn_Sources.Count() == 0");

            var testSignature = "AAATestSignature()";
            var sinkId        = 0;
            var source        = 1;

            ((O2Finding)findingsIn_Sinks[sinkId]).Sink = testSignature;
            Assert.That(((O2Finding)findingsIn_Sinks[sinkId]).Sink == testSignature, "Sink set didn't match testSignature");
            ((O2Finding)findingsIn_Sources[source]).Source = testSignature;
            Assert.That(((O2Finding)findingsIn_Sources[source]).Source == testSignature, "Sink set didn't match testSignature");
            joinSinksToSources.refreshSinks();
            joinSinksToSources.refreshSources();
            joinSinksToSources.calculateJoinnedTraces();
            var o2Findings = joinSinksToSources.getFindingsViewerObjectFor_JoinnedTraces().getFindingsFromTreeView();

            Assert.That(o2Findings.Count == 1, "There should only be 1 finding in the trace created");
            Assert.That(((O2Finding)o2Findings[0]).Sink == testSignature, "There should only be 1 finding in the trace created");
        }
示例#7
0
 private static void Main()
 {
     if (O2AscxGUI.launch("Dot Net Callback maker"))
     {
         O2AscxGUI.openAscx(typeof(ascx_dotNetCallbacksMaker), O2DockState.Document, "DotNet callback maker");
     }
 }
 private static void Main()
 {
     if (O2AscxGUI.launch("Java Velocity Parser"))
     {
         O2AscxGUI.openAscx(typeof(ascx_JavaVelocityAnalyzer));
     }
 }
        public void testIndividualViewers()
        {
            // view webXml mappings
            var webXmlControl = (ascx_J2EE_web_xml)O2AscxGUI.openAscx(typeof(ascx_J2EE_web_xml));

            Assert.That(webXmlControl != null, "webXmlControl was null");
            webXmlControl.mapFile(web_xml);


            // view strutsConfig mappings
            var strusConfigControl = (ascx_Struts_config_xml)O2AscxGUI.openAscx(typeof(ascx_Struts_config_xml));

            Assert.That(strusConfigControl != null, "strusConfigControl was null");
            strusConfigControl.mapFile(struts_config_xml);

            // view validation mappings
            var validationControl = (ascx_Validation_xml)O2AscxGUI.openAscx(typeof(ascx_Validation_xml));

            Assert.That(validationControl != null, "validationControl was null");
            validationControl.mapFile(validation_xml);

            // view validation mappings
            var tilesDefinitions = (ascx_TilesDefinition_xml)O2AscxGUI.openAscx(typeof(ascx_TilesDefinition_xml));

            Assert.That(validationControl != null, "ascx_TilesDefinition_xml was null");

            O2AscxGUI.waitForAscxGuiClose();
            O2AscxGUI.close();
        }
示例#10
0
        static void Main(string[] args)
        {
            OunceAvailableEngines.addAvailableEnginesToControl(typeof(ascx_FindingsViewer));

            if (O2AscxGUI.launch("O2 Scripts"))
            {
                var scriptsFolder = (ascx_ScriptsFolder)O2AscxGUI.openAscx(typeof(ascx_ScriptsFolder), O2DockState.DockLeft, "Sample Scripts");
                scriptsFolder.loadSampleScripts(new ScriptSamples(), true);

                var sourceCodeEditor = (ascx_SourceCodeEditor)O2AscxGUI.openAscx(typeof(ascx_SourceCodeEditor), O2DockState.Document, "Script Editor");
                sourceCodeEditor.loadSampleScripts();

                /*   O2AscxGUI.addControlToMenu("O2 Object Model", () =>
                 *                                                   {
                 *                                                       var cirDataViewer = (ascx_CirDataViewer)O2AscxGUI.openAscx(typeof(ascx_CirDataViewer), O2DockState.DockRight, "O2 Object Model");
                 *                                                       cirDataViewer.loadO2ObjectModel();
                 *                                                       //DI.log.info("code executed")
                 *                                                   });
                 */
                //
                O2AscxGUI.addControlToMenu(typeof(ascx_FunctionsViewer), O2DockState.Document, "Functions Viewer");

                // preloaded menu items
                O2AscxGUI.addControlToMenu(typeof(ascx_FileMappings), O2DockState.Document, "File Mappings");

                O2AscxGUI.addControlToMenu(typeof(ascx_FindingsViewer), O2DockState.Document, "Findings Viewer");
                HandleO2MessageOnSD.setO2MessageFileEventListener();        // set this up so that we can open files from the Findings Viewer
            }
        }
        //public static string ascx_ScriptControl { get; set; }
        //[STAThread]

        private static void Main()

        {
            if (O2Messages.openAscxGui())
            {
                KO2MessageQueue.getO2KernelQueue().onMessages += ascx_Scripts_onMessages;

                // O2 Debugger
                O2AscxGUI.openAscx(typeof(ascx_O2MdbgShell), O2DockState.DockBottom, ascx_O2MdbgShellName); //this needs to be opened before the ascx_Breakpoints


                // scripts controls
                //O2AscxGUI.openAscx(typeof(ascx_Scripts), O2DockState.Document, ascx_ScriptsName); // this needs to loaded before ascx_ScriptsFolder
                var scriptsFolder = (ascx_ScriptsFolder)O2AscxGUI.openAscx(typeof(ascx_ScriptsFolder), O2DockState.DockLeft, ascx_ScriptsFolderName);
                scriptsFolder.loadSampleScripts();

                O2AscxGUI.openAscx(typeof(ascx_AssemblyInvoke), O2DockState.DockRight, ascx_AssemblyInvokeName);

                /*O2AscxGUI.openAscx(typeof(ascx_Breakpoints), O2DockState.DockRightAutoHide, ascx_BreakpointsName);
                *  O2AscxGUI.openAscx(typeof(ascx_BreakpointCreator), O2DockState.DockRightAutoHide, ascx_BreakpointCreatorName);
                *  O2AscxGUI.openAscx(typeof(ascx_Variables), O2DockState.DockRightAutoHide, ascx_CurrentFrameDetailsName);
                *  O2AscxGUI.openAscx(typeof(ascx_FindingsCreator), O2DockState.DockRight, ascx_FindingsCreatorName);*/
                O2AscxGUI.addControlToMenu(typeof(ascx_Breakpoints), O2DockState.DockRightAutoHide, ascx_BreakpointsName);
                O2AscxGUI.addControlToMenu(typeof(ascx_BreakpointCreator), O2DockState.DockRightAutoHide, ascx_BreakpointCreatorName);
                O2AscxGUI.addControlToMenu(typeof(ascx_Variables), O2DockState.DockRightAutoHide, ascx_CurrentFrameDetailsName);
                O2AscxGUI.addControlToMenu(typeof(ascx_FindingsCreator), O2DockState.DockRight, ascx_FindingsCreatorName);
            }
        }
        public void loadCodeFile_FindBugs()
        {
            Assert.That(File.Exists(findBugsExample), "File Didn't exist");
            var loadEngine = new O2AssesmentLoad_FindBugs();

            Assert.That(loadEngine.canLoadFile(findBugsExample), "load engine could not load file");
            var o2Assessment = loadEngine.loadFile(findBugsExample);

            Assert.That(o2Assessment != null, "o2Assessment was null");
            Assert.That(o2Assessment.o2Findings.Count > 0, "There were no findings imported");
            var savedFile = o2Assessment.save(new O2AssessmentSave_OunceV6());

            Assert.That(File.Exists(savedFile), "savedFile didnt exist:" + savedFile);
            DI.log.info("Imported file saved to :{0}", savedFile);

            ascx_FindingsViewer.o2AssessmentLoadEngines.Add(new O2AssessmentLoad_OunceV6());
            var findingsViewerControlName = "FindingsViewer";

            O2AscxGUI.openAscxAsForm(typeof(ascx_FindingsViewer), findingsViewerControlName);
            var findingsViewerControl = (ascx_FindingsViewer)O2AscxGUI.getAscx(findingsViewerControlName);

            findingsViewerControl.loadO2Assessment(savedFile);
            //O2AscxGUI.waitForAscxGuiClose();
            O2AscxGUI.close();
        }
        public static void showFindingsInFindingsViewer(List <IO2Finding> findingsToShow)
        {
            var findingsViewerControl = (ascx_FindingsViewer)O2AscxGUI.getAscx("Findings Viewer");

            findingsViewerControl.clearO2Findings();
            findingsViewerControl.loadO2Findings(findingsToShow);
        }
        static void Main()
        {
            const string staticViewerControlName = "Findings Viewer";

            // this will make files to be opened on the main Document window
            HandleO2MessageOnSD.setO2MessageFileEventListener(staticViewerControlName);

            // add load and save engines for Ounce Ozasmt file formats
            OunceAvailableEngines.addAvailableEnginesToControl(typeof(ascx_FindingsViewer));

            if (O2AscxGUI.launch("Rules Manager", 1000, 800))
            {
                O2AscxGUI.openAscx(typeof(ascx_Scan), O2DockState.DockLeft, "Scan");
                O2AscxGUI.openAscx(typeof(ascx_FindingsViewer), O2DockState.DockLeft, staticViewerControlName);
                O2DockUtils.setDocState("Scan", staticViewerControlName, DockStyle.Bottom);

                O2AscxGUI.openAscx(typeof(ascx_CirDataViewer), O2DockState.DockRight, "Cir Data Viewer");

                O2AscxGUI.openAscx(typeof(ascx_RulePackViewer), O2DockState.DockTop, "Rule Pack Viewer");

                O2DockUtils.setPaneHeight("Rule Pack Viewer", 500);

                O2AscxGUI.addControlToMenu(typeof(ascx_FindingsFilterDevGui), O2DockState.Document, "Fidings Filter");

                O2AscxGUI.addControlToMenu(typeof(ascx_SourceCodeEditor), O2DockState.Document, "Source Code Editor");
                O2AscxGUI.addControlToMenu(typeof(ascx_FunctionsViewer), O2DockState.Document, "Functions Signatures");
                O2AscxGUI.addControlToMenu(typeof(ascx_ApplyRulesToFindings), O2DockState.Document, "O2 'Call-Flow Scanner' (Apply Rules To Findings)");
                O2AscxGUI.openAscx(typeof(ascx_XRules_Editor), O2DockState.Document, "O2 XRules Editor");
            }
        }
        public void loadAscxGUI()
        {
            O2AscxGUI.openAscxAsForm(typeof(ascx_ScanWizard));
            var ascxScanWizard = O2AscxGUI.getAscx(typeof(ascx_ScanWizard).Name);

            Assert.That(ascxScanWizard != null, "ascxScanWizard was null");
            O2AscxGUI.waitForAscxGuiClose();
        }
示例#16
0
        public void editRule()
        {
            xRulesEditor.invokeOnThread(() => editRule_Thread());

            //O2AscxGUI.waitForAscxGuiClose();
            O2AscxGUI.close();
            DI.log.info("all done");
        }
示例#17
0
 static void Main()
 {
     if (O2AscxGUI.launch("Cir Viewer"))
     {
         HandleO2MessageOnSD.setO2MessageFileEventListener();
         O2AscxGUI.openAscx(typeof(ascx_CirDataViewer), O2DockState.DockLeft, "Cir Viewer");
     }
 }
 public void openGui()
 {
     O2AscxGUI.openAscxAsForm(typeof(ascx_FindingsSplitter), findingsSplitterControlName);
     findingsSplitter = (ascx_FindingsSplitter)O2AscxGUI.getAscx(findingsSplitterControlName);
     cirDataViewer    = findingsSplitter.getCirDataViewer_ToProcess();
     findingsViewer   = findingsSplitter.getFindingsViewer_toProcess();
     ascx_FindingsViewer.o2AssessmentLoadEngines.Add(new O2AssessmentLoad_OunceV6());
 }
        public void openControl2()
        {
            log.info("in openControl2");
            var o2ObjectModelControl = (ascx_O2ObjectModel)O2AscxGUI.openAscx(typeof(ascx_O2ObjectModel), O2DockState.Float, "O2 Object Model");

            Assert.That(o2ObjectModelControl != null, "o2ObjectModelControl was null");
            //((Form)o2ObjectModelControl.Parent).close();
        }
示例#20
0
 public static void setSelectedLineNumber(string filename, int lineNumber)
 {
     if (false == String.IsNullOrEmpty(filename))
     {
         var scriptEditor = getScriptEditor(filename);
         O2AscxGUI.invokeOnAscxControl(scriptEditor, "setSelectedLineNumber", new object[] { filename, lineNumber });
     }
 }
示例#21
0
        public static void showWebInspectResultsInO2DockWindow(WebInspectResults webInspectResults)
        {
            O2DockPanel.addAscxControlToO2GuiWithDockPanel(typeof(ascx_TableList), true,
                                                           PoC.dockContentTitle_WebInspectResults);
            var tableList = (ascx_TableList)O2AscxGUI.getAscx(PoC.dockContentTitle_WebInspectResults);

            showWebInspectResultsInTableList(webInspectResults, tableList);
        }
示例#22
0
 public void editRule_InGUI()
 {
     O2AscxGUI.launch("test Rule execution");
     xRulesEditor    = (ascx_XRules_Editor)O2AscxGUI.openAscx(typeof(ascx_XRules_Editor));
     xRulesExecution = (ascx_XRules_Execution)O2AscxGUI.openAscx(typeof(ascx_XRules_Execution), O2DockState.DockLeft, "Rules Execution");
     Assert.That(xRulesEditor != null, "xRulesEditor was null");
     Assert.That(xRulesExecution != null, "xRulesEditor was null");
     O2AscxGUI.waitForAscxGuiClose();
 }
 public static void openTempGUI()
 {
     log.info("in openTempGUI");
     if (O2AscxGUI.launch("test Breakpoings", 1000, 800))
     {
         O2AscxGUI.openAscx(typeof(ascx_SourceCodeEditor), O2DockState.Document, "sourceCodeEditor");
         O2AscxGUI.waitForAscxGuiClose();
     }
 }
示例#24
0
        private static string getScriptEditor(string filename)
        {
            var ascxSourceCodeEditor = getScriptEditorControlName(filename);

            if (false == O2AscxGUI.isAscxLoaded(ascxSourceCodeEditor))
            {
                O2AscxGUI.openAscx(typeof(ascx_SourceCodeEditor), O2DockState.Document, ascxSourceCodeEditor);
            }
            return(ascxSourceCodeEditor);
        }
示例#25
0
        public void loadShowStrutsConfigFiles()
        {
            //var strutsConfig = Serialize.getDeSerializedObjectFromXmlFile(Struts_Sample_Validator, typeof(formvalidation));
            //Assert.That(strutsConfig != null, "validator.xml was null");
            O2AscxGUI.openAscxAsForm(typeof(ascx_ShowStrutsConfigFiles));
            var ascxControl = (ascx_ShowStrutsConfigFiles)O2AscxGUI.getAscx("ascx_ShowStrutsConfigFiles");

            //ascxControl.invokeOnThread(() => ascxControl.mapFile(Struts_Sample_Validator));
            O2AscxGUI.waitForAscxGuiClose();
        }
示例#26
0
        private static void loadTestData()
        {
            var findingsToLoad       = @"C:\O2\_tempDir\tmp1B11.tmp.ozasmt";
            var findingsFilterDevGui = (ascx_FindingsFilterDevGui)O2AscxGUI.getAscx("Findings Filter");

            if (findingsFilterDevGui != null)
            {
                findingsFilterDevGui.loadOzasmtFile(findingsToLoad);
            }
        }
        public void testStrutsMapping_ManualTest()
        {
            O2AscxGUI.launch("test Struts Mappings - Manual Test");
            var strutsMappingsControl =
                (ascx_StrutsMappings_ManualMapping)
                O2AscxGUI.openAscx(typeof(ascx_StrutsMappings_ManualMapping), O2DockState.Document, "Struts Mappings");

            O2AscxGUI.waitForAscxGuiClose();
            O2AscxGUI.close();
        }
示例#28
0
 public void actionsToExecuteOnCirAnalysisControl(object ascxControl)
 {
     if (ascxControl is ascx_CirAnalysis)
     {
         var cirAnalysis = (ascx_CirAnalysis)ascxControl;
         O2AscxGUI.logInfo(cirAnalysis.GetType().FullName);
         cirAnalysis.loadO2CirDataFile(DI.config.ExecutingAssembly);
         //DI.log.info();
     }
 }
示例#29
0
 public void openGui()
 {
     DI.log.info("Opening GUI");
     if (O2AscxGUI.launch())
     {
         O2AscxGUI.setLogViewerDockState(O2DockState.DockBottom);
         O2Messages.openControlInGUISync(typeof(ascx_CirCreator), O2DockState.Document, cirAnalysisControlName);
         //DI.log.info("after launch");
         //O2AscxGUI.logInfo("from Test_CirCreatorAscxControl");  // this is actually a hack since there is still a bug in the thread invocation which makes sometimes the getGuiAscx below to fail
     }
 }
示例#30
0
        public void test_loadO2Packs()
        {
            var rulePackViewerControl = (ascx_RulePackViewer)O2AscxGUI.getAscx(rulePackViewerControlName);
            var thread = rulePackViewerControl.importFromLocalMySqlDatabase();

            //var thread = rulePackViewerControl.loadO2RulePack(testRulePackFile);
            thread.Join();
            thread = rulePackViewerControl.refreshRulesViewer("All", "");
            thread.Join();
            Assert.That(rulePackViewerControl.currentO2RulePack.o2Rules.Count > 0);
        }