Ejemplo n.º 1
0
        public static API_WebScarab setInterface_Lite(this API_WebScarab webScarab)
        {
            if (webScarab.LiteMode)
            {
                "in API_WebScarab setInterface_Lite, we are already using the 'Lite' Interface, aborting request".error();
                return(webScarab);
            }


            //API_InputSimulator_NativeMethods.MoveWindow(windowHandle,0,0,600,400,true);
            webScarab.bringToFront();
            webScarab.InputSimulator.set_XY_OffsetToWindow(webScarab.WebScarab_Process);             // this will make the mouse_MoveTo below to be relative to the current webscarab window

            // open menu
            webScarab.InputSimulator.mouse_MoveTo(20, 30).click();

            //move to 'Use Lite Interface' Menu Item
            webScarab.InputSimulator.mouse_MoveTo(90, 30);
            webScarab.InputSimulator.mouse_MoveTo(90, 220).click();

            // Press Ok
            webScarab.InputSimulator.send_Tab();
            webScarab.InputSimulator.send_Enter();
//			webScarab.InputSimulator.mouse_MoveTo(390,215).click();
            // click 'exit' menu item
            webScarab.InputSimulator.mouse_MoveTo(20, 30).click();
            webScarab.InputSimulator.mouse_MoveTo(20, 120).click();

            webScarab.waitForExit();
            return(webScarab);
        }
        public string CheckInstallation()
        {
            var webScarab = new API_WebScarab();

            Assert.That(webScarab.install(), "webScarab.install() was false");
            return("ok");
        }
Ejemplo n.º 3
0
        public static API_WebScarab setInterface_FullFeatured(this API_WebScarab webScarab)
        {
            if (webScarab.LiteMode.isFalse())
            {
                "in API_WebScarab setInterface_FullFeatured, we are already using the 'FullFeatured(' Interface, aborting request".error();
                return(webScarab);
            }

            //var windowHandle = webScarab.WebScarab_Process.MainWindowHandle;
            //WindowsInput.Native.NativeMethods.SetForegroundWindow(windowHandle);
            //API_InputSimulator_NativeMethods.MoveWindow(windowHandle,0,0,600,400,true);

            webScarab.bringToFront();
            webScarab.InputSimulator.set_XY_OffsetToWindow(webScarab.WebScarab_Process);             // this will make the mouse_MoveTo below to be relative to the current webscarab window

            // open menu
            webScarab.InputSimulator.mouse_MoveTo(20, 30).click();

            //move to 'Use Full_Featured Interface' Menu Item
            webScarab.InputSimulator.mouse_MoveTo(90, 30);
            webScarab.InputSimulator.mouse_MoveTo(90, 150).click();

            // Press Ok
            webScarab.InputSimulator.send_Tab();
            webScarab.InputSimulator.send_Enter();
//			webScarab.InputSimulator.mouse_MoveTo(390,215).click();
            // click 'exit' menu item
            webScarab.InputSimulator.mouse_MoveTo(20, 30).click();
            webScarab.InputSimulator.mouse_MoveTo(20, 120).click();

            webScarab.waitForExit();
            return(webScarab);
        }
		public string ensureNoRunningInstances() 
		{
			var webScarab = new API_WebScarab();
			"in ensureNoRunningInstances".debug();
			webScarab.attach();
			Assert.That(webScarab.WebScarab_Process.isNull(), "webScarab.WebScarab_Process was not null, which means that there was a running instance of WebScarab");
			return "ok";
		}
		public string stop_RuninngInstances()    
		{
			var webScarab = new API_WebScarab();
			webScarab.attach();			
			webScarab.stop();
			ensureNoRunningInstances();
			return "ok";
		}
        public string ensureNoRunningInstances()
        {
            var webScarab = new API_WebScarab();

            "in ensureNoRunningInstances".debug();
            webScarab.attach();
            Assert.That(webScarab.WebScarab_Process.isNull(), "webScarab.WebScarab_Process was not null, which means that there was a running instance of WebScarab");
            return("ok");
        }
        public string stop_RuninngInstances()
        {
            var webScarab = new API_WebScarab();

            webScarab.attach();
            webScarab.stop();
            ensureNoRunningInstances();
            return("ok");
        }
Ejemplo n.º 8
0
 public static API_WebScarab stop(this API_WebScarab webScarab)
 {
     if (webScarab.WebScarab_Process.notNull())
     {
         webScarab.WebScarab_Process.stop();
         webScarab.waitForExit();
         webScarab.WebScarab_Process = null;
     }
     return(webScarab);
 }
		public string set_Interface_LiteMode() 
		{ 
			var webScarab = new API_WebScarab();
			stop_RuninngInstances(); 
			
			Assert.That(webScarab.start().started(), "WebScarab did not start");
			webScarab.setInterface_Lite(); 			
			"Moving mouse to set interface to Lite".info();
			webScarab.stop();
			ensureNoRunningInstances();
			return "ok"; 
		}				
        public string set_Interface_LiteMode()
        {
            var webScarab = new API_WebScarab();

            stop_RuninngInstances();

            Assert.That(webScarab.start().started(), "WebScarab did not start");
            webScarab.setInterface_Lite();
            "Moving mouse to set interface to Lite".info();
            webScarab.stop();
            ensureNoRunningInstances();
            return("ok");
        }
		public string launch_WebScarab() 
		{ 
			var webScarab = new API_WebScarab();
			stop_RuninngInstances();
			webScarab.start();  
			 
			Assert.That(webScarab.WebScarab_Process.notNull(), "webScarab.WebScarab_Process was null");
			Assert.That(webScarab.WebScarab_Process.HasExited.isFalse(), "webScarab.WebScarab_Process.HasExited was true");			
			Assert.That(webScarab.WebScarab_Process.MainWindowHandle != IntPtr.Zero, "webScarab.WebScarab_Process.MainWindowHandle was 0");
						
			webScarab.stop();
			ensureNoRunningInstances();
			return "ok";  
		}
        public string launch_WebScarab()
        {
            var webScarab = new API_WebScarab();

            stop_RuninngInstances();
            webScarab.start();

            Assert.That(webScarab.WebScarab_Process.notNull(), "webScarab.WebScarab_Process was null");
            Assert.That(webScarab.WebScarab_Process.HasExited.isFalse(), "webScarab.WebScarab_Process.HasExited was true");
            Assert.That(webScarab.WebScarab_Process.MainWindowHandle != IntPtr.Zero, "webScarab.WebScarab_Process.MainWindowHandle was 0");

            webScarab.stop();
            ensureNoRunningInstances();
            return("ok");
        }
 public static IO2Assessment createO2AssessmentFromWebScarabFile(string conversationFile)
 {
     O2Assessment o2Assessment = new O2Assessment();
     try
     {
         o2Assessment.name = "Webscarab Import of: " + conversationFile;
         var webScarabConversations = new API_WebScarab().loadConversationsFile(conversationFile);                
         List<IO2Finding> o2Findings = createFindingsFromConversation(webScarabConversations);
         o2Assessment.o2Findings = o2Findings;
     }
     catch (Exception ex)
     {
         ex.log("in createO2AssessmentFromWebScarabFile");
     }
     return o2Assessment;
 }       
Ejemplo n.º 14
0
 public static API_WebScarab loadConversations(this API_WebScarab webScarab, Control hostControl, string conversationsSavePath)
 {
     // open menu
     webScarab.bringToFront();
     webScarab.InputSimulator.set_XY_OffsetToWindow(webScarab.WebScarab_Process);             // this will make the mouse_MoveTo below to be relative to the current webscarab window
     webScarab.InputSimulator.mouse_MoveTo(20, 30).click();
     // save button
     webScarab.InputSimulator.mouse_MoveTo(20, 80).click();
     hostControl.sendKeys("").sleep(1000);
     hostControl.sendKeys(conversationsSavePath).sleep(1000);              // this API is more robust for WebScarab
     Application.DoEvents();
     hostControl.sendKeys("").sleep(1000);
     webScarab.InputSimulator.send_Tab().sleep(500);
     webScarab.InputSimulator.send_Tab().sleep(500);
     webScarab.InputSimulator.send_Enter().sleep(500);
     "API_WebScarab conversation load complete".info();
     return(webScarab);
 }
Ejemplo n.º 15
0
        // this should only be executed once per Form
        public static API_WebScarab syncGuiPositionWithControl(this API_WebScarab webScarab, Control control)
        {
            Action moveToControl =
                () => {
                webScarab.alwaysOnTop(true);
                var xPos   = control.PointToScreen(System.Drawing.Point.Empty).X;
                var yPos   = control.PointToScreen(System.Drawing.Point.Empty).Y;
                var width  = control.width();
                var height = control.height();
                webScarab.moveWindow(xPos, yPos, width, height);
            };

            control.parentForm().Move +=
                (sender, e) => moveToControl();

            control.Resize +=
                (sender, e) => moveToControl();
            moveToControl();
            return(webScarab);
        }
Ejemplo n.º 16
0
        public static List <IWebscarabConversation> loadConversationsFile(this API_WebScarab webScarab, string conversationFile)
        {
            var webScarabConversations = new List <IWebscarabConversation>();

            if (!File.Exists(conversationFile))
            {
                "Could not find webscarab conversation file: {0}".error(conversationFile);
            }
            else
            {
                List <string> fileLines = Files.getFileLines(conversationFile);
                string        requestAndResponseFiles = Path.Combine(Path.GetDirectoryName(conversationFile), "conversations");
                "There are {0} lines in the loaded file: {1}".info(fileLines.Count, conversationFile);
                IWebscarabConversation currentConversation = null;
                foreach (string line in fileLines)
                {
                    DictionaryEntry parsedLine = getParsedLine(line);
                    if (parsedLine.Key != null)
                    {
                        switch (parsedLine.Key.ToString())
                        {
                        case "### Conversation ":
                            if (currentConversation != null)
                            {
                                webScarabConversations.Add(currentConversation);
                            }
                            currentConversation    = new WebscarabConversation();
                            currentConversation.id = parsedLine.Value.ToString();
                            goto Label_039B;

                        case "RESPONSE_SIZE":
                            currentConversation.RESPONSE_SIZE = parsedLine.Value.ToString();
                            goto Label_039B;

                        case "WHEN":
                            currentConversation.WHEN = parsedLine.Value.ToString();
                            goto Label_039B;

                        case "METHOD":
                            currentConversation.METHOD = parsedLine.Value.ToString();
                            goto Label_039B;

                        case "COOKIE":
                            currentConversation.COOKIE = parsedLine.Value.ToString();
                            goto Label_039B;

                        case "STATUS":
                            currentConversation.STATUS = parsedLine.Value.ToString();
                            goto Label_039B;

                        case "URL":
                            currentConversation.URL = parsedLine.Value.ToString();
                            goto Label_039B;

                        case "TAG":
                            currentConversation.TAG = parsedLine.Value.ToString();
                            goto Label_039B;

                        case "ORIGIN":
                            currentConversation.ORIGIN = parsedLine.Value.ToString();
                            goto Label_039B;

                        case "XSS-GET":
                            currentConversation.XSS_GET.Add(parsedLine.Value.ToString());
                            goto Label_039B;

                        case "CRLF-GET":
                            currentConversation.CRLF_GET.Add(parsedLine.Value.ToString());
                            goto Label_039B;

                        case "SET-COOKIE":
                            currentConversation.SET_COOKIE.Add(parsedLine.Value.ToString());
                            goto Label_039B;

                        case "XSS-POST":
                            currentConversation.XSS_POST.Add(parsedLine.Value.ToString());
                            goto Label_039B;
                        }
                        "Key value not handled: {0} for {1}".error(parsedLine.Key.ToString(), parsedLine.Value.ToString());
                    }
Label_039B:
                    if (currentConversation != null)
                    {
                        currentConversation.request  = string.Format(@"{0}\{1}-request", requestAndResponseFiles, currentConversation.id);
                        currentConversation.response = string.Format(@"{0}\{1}-response", requestAndResponseFiles, currentConversation.id);
                    }
                }
            }
            return(webScarabConversations);
        }
		public string CheckInstallation() 
		{
			var webScarab = new API_WebScarab();
			Assert.That(webScarab.install(), "webScarab.install() was false");						
			return "ok";
		}
Ejemplo n.º 18
0
 public static API_WebScarab restart(this API_WebScarab webScarab)
 {
     webScarab.stop();
     return(webScarab.start());
 }
Ejemplo n.º 19
0
 public static API_WebScarab moveWindow(this API_WebScarab webScarab, int left, int top, int width, int height)
 {
     webScarab.InputSimulator.moveWindow(webScarab.WebScarab_Process, left, top, width, height);
     return(webScarab);
 }
Ejemplo n.º 20
0
 public static API_WebScarab startAndSync(this API_WebScarab webScarab, Control control)
 {
     webScarab.start();
     webScarab.syncGuiPositionWithControl(control);
     return(webScarab);
 }
Ejemplo n.º 21
0
 public static API_WebScarab alwaysOnTop(this API_WebScarab webScarab, bool value)
 {
     webScarab.InputSimulator.alwaysOnTop(webScarab.WebScarab_Process, value);
     return(webScarab);
 }
Ejemplo n.º 22
0
 public static API_WebScarab alwaysOnTop(this API_WebScarab webScarab)
 {
     return(webScarab.alwaysOnTop(true));
 }
Ejemplo n.º 23
0
 public static API_WebScarab bringToFront(this API_WebScarab webScarab)
 {
     webScarab.InputSimulator.bringToFront(webScarab.WebScarab_Process);
     return(webScarab);
 }
Ejemplo n.º 24
0
 public static bool started(this API_WebScarab webScarab)
 {
     return(webScarab.WebScarab_Process.notNull() &&
            webScarab.WebScarab_Process.HasExited.isFalse() &&
            webScarab.WebScarab_Process.MainWindowHandle != IntPtr.Zero);
 }
Ejemplo n.º 25
0
 public static API_WebScarab waitForExit(this API_WebScarab webScarab)
 {
     webScarab.WebScarab_Process.WaitForExit();
     return(webScarab);
 }