コード例 #1
0
		public static API_Chrome_Hijack add_Chrome_To_Panel(this API_Chrome_Hijack chromeHijack, Panel targetPanel)
		{
			var chrome_Panel 	   = targetPanel.add_GroupBox("Chrome").add_Panel();
			var chromeDriver_Panel = chromeHijack.Panel_Chrome.parent().insert_Below(150,"Chrome WebDriver");			
						
			return chromeHijack.hijack_Chrome	   (chrome_Panel,false)
							   .hijack_ChromeDriver(chromeDriver_Panel);						
		}
コード例 #2
0
ファイル: API_Mailman.cs プロジェクト: pusp/o2platform
		public static Panel show_Gui_with_ListAdmins_Mappings(this API_Mailman apiMailman, Panel topPanel) 		
		{
			var tableList = topPanel.add_GroupBox("OWASP Mailing list mappings").add_TableList();  
			var browser = topPanel.insert_Right("List Admin WebPage").add_WebBrowser_Control();
			tableList.add_Columns("email", "list name", "list #", "href" );
			tableList.afterSelect_get_Cell(3,
				(href)=>{ 
							browser.open(href);
						});
			
			
			var listNumber = 0;
			foreach(var listName in apiMailman.mailingLists())
			{
				listNumber++;
				foreach(var email in apiMailman.get_Admins_For_MailingList(listName))
				{
					tableList.add_Row(email,							
									  listName, 
									  listNumber.str() ,
									  "{0}admin/{1}".format(apiMailman.BaseUrl, listName));							
				}
			}
			tableList.makeColumnWidthMatchCellWidth();
			return topPanel;
		}
コード例 #3
0
		public static API_AmazonEC2 addStopInstanceGui(this API_AmazonEC2 amazonEC2, Panel targetPanel, TreeView treeViewWithInstances)
		{						
			Action startTimer = null;
			Action stopTimer = null;
			var instancesToStop = targetPanel.add_GroupBox("Stop Instance in {0} minutes".format((amazonEC2.TimerCount * amazonEC2.TimerCount / 60))) 
									         .add_TreeView();						
			var timerBar = instancesToStop.insert_Below(20).add_ProgressBar();
			instancesToStop.add_ContextMenu().add_MenuItem("Stop now",true, 
													()=>{
															"Stopping {0} instances now".debug(instancesToStop.nodes().size()); 
															foreach(var node in instancesToStop.nodes())
																amazonEC2.stopInstance((RunningInstance)node.get_Tag());
														})
											 .add_MenuItem("Clear list", ()=>instancesToStop.clear());
			var startTimerLink = instancesToStop.insert_Above(15).add_Link("Add instance to list",0,0, 
													()=>{
															var selectedNode = treeViewWithInstances.selected();
															if (selectedNode.notNull())
															{
																var tag = selectedNode.get_Tag();  
																if (tag is RunningInstance)
																{
																	var selectedInstance = (RunningInstance)tag;
																	var nodeText = "{0} - {1}".format(selectedInstance.InstanceId, selectedInstance.IpAddress);
																	instancesToStop.add_Node(nodeText, selectedInstance);
																}
															}
															//treeViewWithInstances.nodes().showInfo();
														})
											.append_Link("Start timer", ()=>startTimer());  
			var timerEnabled = false;								
			var	stopTimerLink = startTimerLink.append_Link("Stop timer", ()=>stopTimer()).enabled(false);  							
			startTimer = ()=>{											
									"starting timer".info();
									timerEnabled = true;												
									timerBar.maximum(amazonEC2.TimerCount);
									timerBar.value(0);
									startTimerLink.enabled(false);
									stopTimerLink.enabled(true);
									while(timerEnabled && timerBar.Value < amazonEC2.TimerCount)
									{
										"In StopInstances Timer [{0}/{1}], sleeping for {2} seconds".info(timerBar.Value, amazonEC2.TimerCount, amazonEC2.TimerSleep/1000);
										timerBar.sleep(amazonEC2.TimerSleep, false);
										timerBar.increment(1);																										
									}
									if (timerEnabled)
									{													
										"Timer is completed stopping {0} instances now".debug(instancesToStop.nodes().size());
										foreach(var node in instancesToStop.nodes())
											amazonEC2.stopInstance((RunningInstance)node.get_Tag());
									}
									else
										"Timer was stopped so nothing to do".debug();			
									startTimerLink.enabled(true);
									stopTimerLink.enabled(false);

							 };
			stopTimer = ()=>{
								
									"stopping timer".info();
									timerEnabled = false; 
									
									startTimerLink.enabled(true);
									stopTimerLink.enabled(false);
							 };
			targetPanel.onClosed(()=> 	timerEnabled=false);					 
			
			return amazonEC2;
		}						
コード例 #4
0
		public static Panel show_Gui_with_ListAdmins_Mappings(this API_Mailman apiMailman, Panel topPanel) 		
		{
			var tableList = topPanel.add_GroupBox("OWASP Mailing list mappings").add_TableList();  
			var browser = topPanel.insert_Right("List Admin WebPage").add_WebBrowser_Control();
			tableList.add_Columns("email", "list name", "list #", "href" );
			tableList.afterSelect_get_Cell(3,
				(href)=>{ 
							browser.open(href);														
						});
						
			/*browser.onNavigated( // not working the browser still gets the focus
				(url)=> {
							"onNavigated".info();							
							tableList.listView().focus();
							tableList.focus();
							
						});*/
			
			var listNumber = 0;
			tableList.visible(false);
			foreach(var listName in apiMailman.mailingLists().Take(20))
			{
				listNumber++;
				foreach(var email in apiMailman.get_Admins_For_MailingList(listName))
				{
					tableList.add_Row(email,							
									  listName, 
									  listNumber.str() ,
									  "{0}admin/{1}".format(apiMailman.BaseUrl, listName));							
				}
			}
			tableList.visible(true);
			tableList.makeColumnWidthMatchCellWidth();
			return topPanel;
		}
コード例 #5
0
ファイル: REPL_Gui.cs プロジェクト: njmube/FluentSharp
        public REPL_Gui buildGui(Control targetControl)
        {
            try
            {
                TopPanel = targetControl.clear().add_Panel();

                Code_Panel = TopPanel.insert_Left("Code");

                Output_Panel = TopPanel.add_GroupBox("Invoke and Result")
                                       .add_GroupBox("Output").add_Panel();
                Execute_Button = Output_Panel.parent().insert_Above(60).add_Button("Execute").fill();
                Execute_Button.insert_Below(20).add_Link("stop execution", () => this.stopCurrentExecution());
                Output_View_RichTextBox = Output_Panel.add_RichTextBox();
                Output_View_Object = Output_Panel.add_Panel();
                //set actions

                Execute_Button.onClick(
                    () =>
                        {
                            try
                            {
                                ExecutionThread = O2Thread.mtaThread(() => On_ExecuteCode.invoke());
                            }
                            catch (Exception ex)
                            {
                                ex.log();
                            }
                        });
            }
            catch (Exception ex)
            {
                ex.log("[REPL_Gui] in buildGui");
            }
            return this;
        }
コード例 #6
0
		public Win32_Handle_Hijack buildGui()
		{									
			Action restore = 
				()=>{												
						if (hijackedHandle != IntPtr.Zero)
						{
							"restoring {0} to parent {1}".info(hijackedHandle, hijackedParent);
							hijackedHandle.setParent(hijackedParent);
							hijackedParent.window_Redraw();
							hijackedHandle.window_Redraw();
						}
					};
					
			Action hijack = 
				()=>{ 
						restore();
						var handle = targetHandle.get_Text().toInt().intPtr();						
						var newParent = hijackedWindow.clear().handle();
						"Hijacking {0} into window {1}".info(handle, newParent);
						hijackedHandle = handle;
						hijackedParent = parentHandle.get_Text().toInt().intPtr();
						handle.setParent(newParent);						
					};					
			Action screenShot = 
				()=>{	
						restore();
						try
						{
							var handle = targetHandle.get_Text().toInt().intPtr();						
							var bitmap = handle.window_ScreenShot();
							hijackedWindow.clear().add_PictureBox().layout_Zoom().show(bitmap);
						}
						catch(Exception ex)
						{
							ex.log();
						}
					};
			Action<IntPtr> setTarget = 
				(handle)=>{
							 	targetHandle.set_Text(handle.str());
							 	className.set_Text(handle.className());
							 	pictureBox.show(handle.window_ScreenShot());
								//pictureBox
							};
			topPanel = this.add_Panel();				
			topPanel.insert_Above(35).splitContainerFixed()
						.add_WindowFinder(ref windowFinder) 
						.append_Label("Handle:").top(10).append_TextBox(ref targetHandle)
						.append_Label("Parent:").top(10).append_TextBox(ref parentHandle)
						.append_Link("Hijack", ()=> hijack()).top(10)
						.append_Link("Restore", ()=> restore()) 
						.append_Link("Screenshot", ()=> screenShot()) 
						.append_PictureBox(ref pictureBox)
						.append_TextBox(ref test).set_Text("Hijack me").top(10) 
						.append_Label(ref className).topAdd(2);

				
						
			hijackedWindow = topPanel.add_GroupBox("Hijacked Window/Control").add_Panel();		
					
			targetHandle.onTextChange((text)=> parentHandle.set_Text(text.toInt().intPtr().parent().str())); 
			windowFinder.Window_Changed = setTarget; 
				
//			setTarget(test.handle()); 
			
			pictureBox.layout_Zoom();					  
			this.onClosed(
				()=>{
						"On Closed".info();
						restore();
					});
			var groupBox = hijackedWindow.parent();;
			var originalText = groupBox.get_Text();
			var splitcontainer = groupBox.splitContainer();
			
			groupBox.DoubleClick+=(sender,e)=>
				{		
					var collapsed = splitcontainer.Panel1Collapsed;
					if (collapsed)
					{
						splitcontainer.panel1Collapsed(false);					
						groupBox.set_Text(originalText);		
					}
					else
					{
						splitcontainer.panel1Collapsed(true);		
						groupBox.set_Text(".");			
					}
				};	
			return this;	
		}