// need to convert to Tool_API format (this will uninstall
		public bool install()
		{			
			"Installing {0}".info(ToolName);
			var downloadUrl = "http://downloads.sourceforge.net/project/gitextensions/Git%20Extensions/Version%202.17/GitExtensions217Setup.msi?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fgitextensions%2Ffiles%2FGit%2520Extensions%2FVersion%25202.17%2F&ts=1300699408&use_mirror=netcologne"; 
			var targetDir = @"..\_O2Downloads".tempDir(false).fullPath() ; 
			var targetFile = targetDir.pathCombine(downloadUrl.uri().Segments.Last());
			downloadUrl.download(targetFile);
			var process = targetFile.startProcess();
			var guiAutomation = new API_GuiAutomation(process);
			guiAutomation.button("Next").click(); 
			if (guiAutomation.hasButton("Repair"))
			{
				"App is already installed".error();	
				if (unInstallIfAlreadyInstalled)
				{
					guiAutomation.button("Repair").click();
					guiAutomation.button("Next").click();  
					guiAutomation.button("Finish",20).click();	
				}
			} 
			else
			{
			  	guiAutomation.button("Next").click(); 
				guiAutomation.button("Next").click();  
				guiAutomation.button("Next").click(); 
				guiAutomation.button("Next").click();  
				guiAutomation.button("Install").click();		
				guiAutomation.button("Finish",20).click();	
			};
			return false;
		}
Exemple #2
0
		public bool install()
		{			
			if (this.isInstalled().isFalse())
			{  
				"[API_Fiddler] Starting Fiddler installation process".info();
				var fiddlerInstaller = this.installerFile(); 
				var guiAutomation = new API_GuiAutomation();
				guiAutomation.launch(fiddlerInstaller);
				var installWindow = guiAutomation.window("Fiddler2 Setup: License Agreement");
				installWindow.button("I Agree").click();   
				var installTextBox = installWindow.textBox(@"C:\Program Files\Fiddler2");
				installTextBox.set_Text(this.Install_Dir); 
				if (installTextBox.get_Text()==this.Install_Dir)
				{
					installWindow.button("Install").click();
				} 
				else
					"[API_Fiddler] in install automation, rrror setting the target directory".error(); 				
				installWindow.button("Close").click();													
				"[API_Fiddler] Fiddler installation complete".info();	
			}
			if (this.isInstalled())
			{
				"[API_Fiddler] Fiddler is installed in folder:{0}".info(this.Install_Dir);
				return true;
			}
			"[API_Fiddler] Counld NOT find Fiddler installation in folder:{0}".info(this.Install_Dir);
			return false;
		}
Exemple #3
0
   		public static API_GitHub install_TortoiseGit(this API_GitHub gitHub, string msiPath)
   		{   	
			var process = msiPath.startProcess(); 
			var guiAutomation = new API_GuiAutomation(process);  
			var tortoiseGitSetup  = guiAutomation.windows()[0]; 
			//tortoiseGitSetup.bringToFront(); 
			//step 1
			tortoiseGitSetup.button("Next >").mouse().click();  
			//step2  
			tortoiseGitSetup  = guiAutomation.windows()[0];  
			tortoiseGitSetup.radioButton("I accept the terms in the License Agreement").mouse().click() ;
			tortoiseGitSetup.button("Next >").mouse().click();  
			//step3  
			tortoiseGitSetup  = guiAutomation.windows()[0];  
			tortoiseGitSetup.button("Next >").mouse().click();   
			//step4
			tortoiseGitSetup  = guiAutomation.windows()[0];  
			tortoiseGitSetup.button("Next >").mouse().click();   
			//step5
			tortoiseGitSetup  = guiAutomation.windows()[0];  
			tortoiseGitSetup.button("Install").mouse().click();  
			//step6					
			for(int i = 0 ; i< 20; i ++) 
			{
				gitHub.sleep(2000,true); // wait 2 secs and try again 
				tortoiseGitSetup  = guiAutomation.windows()[0];  
				if (tortoiseGitSetup.button("Next >").isNull())
				{
					tortoiseGitSetup.button("Finish").mouse().click();   
					break;
				}						
			}
			return gitHub;
		}
		public static API_GitHub unInstall_TortoiseGit(this API_GitHub gitHub, string msiPath)
		{
			var process = msiPath.startProcess(); 					
			var guiAutomation = new API_GuiAutomation(process);  					
			//step 1
			var tortoiseGitSetup  = guiAutomation.windows()[0];  
			tortoiseGitSetup.button("Next >").mouse().click();  
			//step 2
			tortoiseGitSetup  = guiAutomation.windows()[0];
			tortoiseGitSetup.button("Remove Installation").mouse().click();	 		  		
			//step 3
			tortoiseGitSetup  = guiAutomation.windows()[0];
			tortoiseGitSetup.button("Remove").mouse().click();	 	 	  		
			//step 4					
			for(int i = 0 ; i< 10; i ++)
			{
				gitHub.sleep(2000,true); // wait 2 secs and try again 
				tortoiseGitSetup  = guiAutomation.windows()[0];
				if (tortoiseGitSetup.button("Next >").isNull())
				{
					tortoiseGitSetup.button("Finish").mouse().click();   
					break;
				}						
			}
			return gitHub;
		}
		public API_VisualStudio_2010 attach()
		{
			GUI = VS_Process = new API_GuiAutomation("devenv");				
			if (VS_Process.TargetProcess.notNull())
				VS_MainWindow = VS_Process.windows()[0];//MAIN_WINDOW_TITLE);
			else
				start();
			return this;
		}
Exemple #6
0
		public bool install()
		{
			"Installing {0}".info(ToolName);
			startInstaller_FromMsi_Web(); 						
			if (this.Install_Process.notNull())
			{
				var guiAutomation = new API_GuiAutomation(this.Install_Process);  

				//step 1
				guiAutomation.windows()[0]
							 .button("Next >")
							 .mouse().click();
				//step 2
				var acceptTerms  = guiAutomation.windows()[0];  
				acceptTerms.radioButton("I accept the terms in the License Agreement")
						   .mouse().click() ;
				acceptTerms.button("Next >")
						   .mouse().click();  
				//step 3
				guiAutomation.windows()[0]
							 .button("Next >")
							 .mouse().click();
				//step 4
				guiAutomation.windows()[0]
							 .button("Install")
							 .mouse().click(); 
				//step5					
							for(int i = 0 ; i< 20; i ++) 
							{
								this.sleep(2000,true); // wait 2 secs and try again  
								var tortoiseGitSetup  = guiAutomation.windows()[0];  
								if (tortoiseGitSetup.button("Next >").isNull())
								{
									tortoiseGitSetup.button("Finish").mouse().click();   
									break;
								}						
							}
			}
			return isInstalled();
		}
Exemple #7
0
    	public API_GuiAutomation launchRdpClient(string ipAddress, string username, string password)
    	{
    		var terminalServicesClient = Processes.startProcess("mstsc.exe");
			var guiAutomation = new API_GuiAutomation(terminalServicesClient);
			var window = guiAutomation.window("Remote Desktop Connection");
			window.textBox("Computer:").set_Text(ipAddress);
			
			if (username.valid())
			{
				window.button("Options ").click(); 					
				this.sleep(1000) ;	
				window.textBox("User name:").set_Text(username); 				
			}
			
			window.button("Connect").mouse().click();
			var loginWindow = guiAutomation.window("Windows Security",3);	
			if (password.valid())		
				guiAutomation.keyboard_sendText(password);									
			loginWindow.button("OK").click(); 
			
			return guiAutomation;
		}
    	public API_GuiAutomation setGuiAutomation()
    	{
    		"Mapping GuiAutomation Objects".info();
    		//var localProcess = Processes.getCurrentProcess();    		
    		//guiAutomation = new API_GuiAutomation(localProcess);
    		var ieProcess = Processes.getProcesses()
						.Where((process)=> process.MainWindowTitle.contains("SI Question Pool"))
						.First();
			guiAutomation = new API_GuiAutomation(ieProcess);						
    		if (guiAutomation.notNull())
    			"got GuiAutomation Object for local Process".info();    		
    		guiAutomationWindow = guiAutomation.windows()[0]; 
    		if (guiAutomationWindow.notNull())
    			"got GuiAutomation Window Object for local Process".info();
    		else
    			"failed to get GuiAutomation Window Object for local Process".error();
    		
    		//setGuiAutomationExamGroupBox();
    		//if (guiAutomation.isNull() || guiAutomationWindow.isNull() || guiAutomationExamGroupBox.isNull());
    		//	"in setGuiAutomation, one of the expected UIAutomation objects could not be calculated".error();
    		return guiAutomation;
    	}    	
		public override bool unInstall()
		{
			if (this.isInstalled() && this.Uninstall_Exe.fileExists())
			{
				"[API_Fiddler] Starting Fiddler UnInstall process".info();
				var guiAutomation = new API_GuiAutomation();
				guiAutomation.launch(this.Uninstall_Exe);
				 
				var processID = guiAutomation.TargetProcess.Id;
				//var finder = new AutomationElementFinder(AutomationElement.RootElement);    
				var uninstallWindow = guiAutomation.desktopWindow("Fiddler2 Uninstall: Confirmation");
				uninstallWindow.button("Uninstall").click();
				uninstallWindow.button("Close").click(); 				
				"[API_Fiddler] Fiddler UnInstall complete".info();
				if (this.isInstalled().isFalse())
					return true;
				"[API_Fiddler] There was an error in the UnInstall process (since fiddler is still installed)".info();
				return false;
			}
			"[API_Fiddler] in unInstall, Fiddler is not installed, so nothing to do".debug();
			return false;
		}
    	public string OpenGuiAndExecuteOneTest()
    	{
    		var desktopIconText = "OWASP O2 Platform (ClickOnce version)";  

			var step2_windowTitle = "OWASP O2 Platform - v1.4 beta (Sep 2010)";
			var step3_windowTitle = "O2 GUI - Browser Automation / BlackBox Testing";
			var step4_windowTitle = "Browser Automation / IE Demos";
			var guiAutomation = new API_GuiAutomation();
			
			Action step1 = 
				()=>{	
						guiAutomation.showDesktop();				 
						var icon = guiAutomation.desktopIcon(desktopIconText)
								 				.mouse()
								 				.doubleClick(); 
								 				
						//guiAutomation.desktopWindow("O2 Simple Script Editor").restored();
					}; 
					 						 			 
			Action step2 = 
				()=>{
						var window = guiAutomation.desktopWindow(step2_windowTitle, 20);
						window.bringToFront();
						window.move(0,0);					
						var buttonText = " Browser Automation / BlackBox Testing  ";		
						window.button(buttonText).mouse().click();
					};
				
			Action step3 =	
				()=>{			
						var step3_window = guiAutomation.desktopWindow(step3_windowTitle,20).restored();
						step3_window.tabPage("Demo Vulnerable Applications").mouse().click();
						step3_window.button("Browser Automation - IE Demos").mouse().click(); 
					};
					
			Action step4 =	 
				()=>{			
						var step4_window = guiAutomation.desktopWindow(step4_windowTitle,20).restored();
						step4_window.move(0,0);			
						step4_window.treeView()
								    .treeNodes()[2]
								    .mouse().doubleClick();
						step4_window.treeView() 
								    .treeNodes()[3]
								    .mouse().doubleClick();	 				    			
									 
					};
			
			Action step5 =	
				()=>{	
						//this.sleep(10*1000);	// wait 10 seconds before closing everying down
						guiAutomation.desktopWindow(step4_windowTitle).bringToFront().button("Close").mouse().click();
						guiAutomation.desktopWindow(step3_windowTitle).bringToFront().button("Close").mouse().click();
						guiAutomation.desktopWindow(step2_windowTitle).bringToFront().button("Close").mouse().click();
					};
			step1();
			step2(); 
			step3();
			step4();
			step5();
			return "ok - OpenGuiAndExecuteOneTest";
    	}
Exemple #11
0
		public API_Fiddler start()
		{		
			install();
			if (Fiddler_Process.notNull())
			{
				"[API_Fiddler] in start, the Fiddler_Process is already mapped to a running process. Stopping request".error();
				return this;
			}
			attach();
			if (Fiddler_Process.isNull())		// means we were NOT able find a running instance and get its process object
			{		
				if (Fiddler_Exe.fileExists().isFalse())
				{
					"[API_Fiddler] Could not find Fiddler Exe file at location: {0}".error(Fiddler_Exe);
					return null;
				}
				Fiddler_Process = Processes.startProcess(Fiddler_Exe);
			}									
			Fiddler_GuiAutomation = new API_GuiAutomation(Fiddler_Process);
			if (Fiddler_GuiAutomation.isNull())
			{
				"[API_Fiddler] Could not set Fiddler_GuiAutomation".error();
				return null;				
			}				
			Fiddler_Window = Fiddler_GuiAutomation.window(FIDDLER_MAIN_WINDOW_TITLE);
			if (Fiddler_Window.isNull())
			{
				"[API_Fiddler] Could not get Fiddler main window with title: {0}".error(FIDDLER_MAIN_WINDOW_TITLE);
				return null;				
			}			
			return this;
		}				
        public string OpenGuiAndExecuteOneTest()
        {
            var desktopIconText = "OWASP O2 Platform (ClickOnce version)";

            var step2_windowTitle = "OWASP O2 Platform - v1.4 beta (Sep 2010)";
            var step3_windowTitle = "O2 GUI - Browser Automation / BlackBox Testing";
            var step4_windowTitle = "Browser Automation / IE Demos";
            var guiAutomation     = new API_GuiAutomation();

            Action step1 =
                () => {
                guiAutomation.showDesktop();
                var icon = guiAutomation.desktopIcon(desktopIconText)
                           .mouse()
                           .doubleClick();

                //guiAutomation.desktopWindow("O2 Simple Script Editor").restored();
            };

            Action step2 =
                () => {
                var window = guiAutomation.desktopWindow(step2_windowTitle, 20);
                window.bringToFront();
                window.move(0, 0);
                var buttonText = " Browser Automation / BlackBox Testing  ";
                window.button(buttonText).mouse().click();
            };

            Action step3 =
                () => {
                var step3_window = guiAutomation.desktopWindow(step3_windowTitle, 20).restored();
                step3_window.tabPage("Demo Vulnerable Applications").mouse().click();
                step3_window.button("Browser Automation - IE Demos").mouse().click();
            };

            Action step4 =
                () => {
                var step4_window = guiAutomation.desktopWindow(step4_windowTitle, 20).restored();
                step4_window.move(0, 0);
                step4_window.treeView()
                .treeNodes()[2]
                .mouse().doubleClick();
                step4_window.treeView()
                .treeNodes()[3]
                .mouse().doubleClick();
            };

            Action step5 =
                () => {
                //this.sleep(10*1000);	// wait 10 seconds before closing everying down
                guiAutomation.desktopWindow(step4_windowTitle).bringToFront().button("Close").mouse().click();
                guiAutomation.desktopWindow(step3_windowTitle).bringToFront().button("Close").mouse().click();
                guiAutomation.desktopWindow(step2_windowTitle).bringToFront().button("Close").mouse().click();
            };

            step1();
            step2();
            step3();
            step4();
            step5();
            return("ok - OpenGuiAndExecuteOneTest");
        }
Exemple #13
0
		public static API_GitHub gitClone(this API_GitHub gitHub, string url, string targetDir, string privateKeyFile)
		{
			if (targetDir.inValid())
				targetDir = "".tempDir();
			var guiAutomation = new API_GuiAutomation();

			if (guiAutomation.desktopWindow("Git clone").isNull())  // see if there is already an 'Git clone' window 
			{
				//Create a form window with a webbrowser that will open a local folder
				var windowName = "This is Git Clone target folder  (id:{0})".format(3.randomNumbers());
				var topPanel = O2Gui.open<Panel>(windowName,600,200 );
				var webBrowser = topPanel.add_WebBrowser_Control();
				webBrowser.open(targetDir);
				webBrowser.mouse_MoveTo_WinForm();  
				
				// get the form and right click on it
				var window = guiAutomation.desktopWindow(windowName);
				guiAutomation.mouse().click().rightClick(); 
			
				// get the context menu and click on the 'Git Clone...' menu button
				var contextMenu =  guiAutomation.getContextMenu();
				contextMenu.menu("Git Clone...").mouse().click();
			}
			// get the Git Clone window
			var gitClone = guiAutomation.desktopWindow("Git clone", 10);
			gitClone.bringToFront();
			// get a reference to the textboxes we will need to populate
			var url_TextBox = gitClone.textBox("Url: ");
			var directory_TextBox = gitClone.textBox("Directory:");
			var puttyKey_TextBox = gitClone.textBoxes().id(1571);
			if (url.valid())
				url_TextBox.set_Text(url); 
			if (privateKeyFile.valid() && privateKeyFile.fileExists())
				puttyKey_TextBox.set_Text(privateKeyFile);
			//directory_TextBox.set_Text(targetDir);   // no need to do this since it is added when we use the context menu
			
			// Click button
			gitClone.button("OK").mouse().click();			
			
			return gitHub;
		}
Exemple #14
0
		public static API_GitHub putty_generateKeys(this API_GitHub gitHub, string keyPassPhrase, string publicKey,string publicKeyForSSH, string privateKey)
		{
			if (publicKey.inValid() || privateKey.inValid() || publicKeyForSSH.inValid())
			{
				"the  publicKey, publicKeyForSSH, privateKey paths needs to be valid".error();
				return gitHub;
			}
			var puttyGenPath = @"C:\Program Files\TortoiseGit\bin\puttygen.exe";
			if (puttyGenPath.fileExists().isFalse())
			{
				"Error: could not find puttyGen in TortoiseGit folder: {0}".error(puttyGenPath);
				return gitHub;
			}
			var process = puttyGenPath.startProcess(); 
			var puttyGen = new API_GuiAutomation(process);   
			var window = puttyGen.windows()[0];
			var generateButton = window.button("Generate").click();
			/// lets move the mouse a bit to create some randomness for PuttyGen
			window.mouse();
			generateButton.mouse();
			window.mouse();
			generateButton.mouse();
			window.mouse();
			//once the key is generated we need to put in the passphrase
			if (keyPassPhrase.inValid() )
			{
				window.textBox("Key passphrase:").set_Text(keyPassPhrase ?? "");
				window.textBox("Confirm passphrase:").set_Text(keyPassPhrase ?? "");  
			}
						
			//Saving public Key for SSH
			var keyForOpenSSH = window.textBoxes()[0].get_Text();
			keyForOpenSSH.saveAs(publicKeyForSSH);
			
			//Saving private Key
			window.button("Save private key").mouse().click(); 
			var warning = puttyGen.window("PuTTYgen Warning");  
			if (warning.notNull())
				warning.button("Yes").mouse().click();
			var saveAsWindow = puttyGen.window("Save private key as:");
			saveAsWindow.textBox("File name:").set_Text(privateKey); 
			saveAsWindow.button("Save").mouse().click(); 
			
			//Saving public Key
			window.button("Save public key").mouse().click(); 
			warning = puttyGen.window("PuTTYgen Warning");  
			if (warning.notNull())
				warning.button("Yes").mouse().click();

			saveAsWindow = puttyGen.window("Save public key as:");
			saveAsWindow.textBox("File name:").set_Text(publicKey); 
			saveAsWindow.button("Save").mouse().click();
			
			process.stop();
			
			"The keys were saved to {0} and {1}: {0}".info(publicKey, privateKey);
			
			return gitHub;
		}