private void btnExport_Click(object sender, System.EventArgs e) { if (lstCrowResponse.Items.Count<=0){ return; } showresults formres = new showresults(); formres.Show(); foreach (string item in lstCrowResponse.Items){ /* string[] parts = new string[5]; parts=item.Split(':'); string display = parts[0]+":"+parts[1]+":"+parts[2]+":"+parts[4]; string remain=""; for (int y=3; y<parts.Length; y++){ remain+=parts[y]; } display+=":"+remain; */ formres.rtbResults.BackColor=Color.Snow; formres.rtbResults.ForeColor=Color.Black; formres.rtbResults.Font = new System.Drawing.Font("MS Reference Sans Serif", 7.75F); int height=lstCrowResponse.Items.Count * 18; if (height>600){ height=600; } formres.Size=new Size(500,height); formres.Text="Exported Results"; formres.rtbResults.AppendText(item+"\r\n"); } }
private void clickGroupShowResponseRaw(object sender, System.EventArgs e) { Button fakebut = new Button(); fakebut=(Button)sender; try{ int ID=(int)fakebut.Tag; foreach (CrowResponses response in CrowResponsesA){ if (response.ID==ID){ showresults resultwin = new showresults(); resultwin.Controls.Remove(resultwin.rtbResults); RichTextBox box = new RichTextBox(); box.Dock=DockStyle.Fill; box.Text=response.response; box.BackColor=Color.Snow; box.ForeColor=Color.Black; box.Font = new System.Drawing.Font("MS Reference Sans Serif", 7.75F); int height=response.response.Split('\n').Length * 18; if (height>600){ height=600; } resultwin.Size=new Size(500,height); resultwin.Text="Raw result"; resultwin.Controls.Add(box); resultwin.Show(); } } }catch{} }
private void btnSendRawRequest_Click(object sender, System.EventArgs e) { if (txtHTTPdetails.Text.Length<=0 || txtTargetHost.Text.Length<=0 || txtTargetPort.Text.Length<=0){ return; } try{ rawsendwindow.Dispose(); rawsendwindow.Show(); rawsendwindow.Controls.Clear(); } catch { rawsendwindow = new showresults(); rawsendwindow.Show(); rawsendwindow.Controls.Clear(); } rawsendwindow.StartPosition=System.Windows.Forms.FormStartPosition.WindowsDefaultLocation; rawsendwindow.AutoScale=true; //we need to create a panel for the text System.Windows.Forms.Panel mainpanel = new Panel(); mainpanel.Dock=DockStyle.Fill; mainpanel.Size=new System.Drawing.Size(752, 477); //and one for the buttons System.Windows.Forms.Panel buttonpanel = new Panel(); buttonpanel.Dock=DockStyle.Top; buttonpanel.Size = new System.Drawing.Size(752, 30); buttonpanel.BackColor=Color.DarkGray; //rawsendwindow.Controls.Remove(rawsendwindow.rtbResults); //add the panels to the main window rawsendwindow.Controls.Add(mainpanel); rawsendwindow.Controls.Add(buttonpanel); //create the buttons System.Windows.Forms.Button butSearch = new DotNetSkin.SkinControls.SkinButton(); System.Windows.Forms.Button butClear = new DotNetSkin.SkinControls.SkinButtonYellow(); //search butSearch.Location=new System.Drawing.Point(5,5); butSearch.Size=new Size(80,21); butSearch.Text="Search"; butSearch.ForeColor=Color.Black; butSearch.BackColor=Color.DarkGray; butSearch.FlatStyle=FlatStyle.Popup; butSearch.Font = new System.Drawing.Font("MS Reference Sans Serif", 7.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); butSearch.Click += new System.EventHandler(rawReqSearch); buttonpanel.Controls.Add(butSearch); //clear butClear.Location=new System.Drawing.Point(345,5); butClear.Size=new Size(80,21); butClear.Text="Clear"; butClear.ForeColor=Color.Black; butClear.BackColor=Color.DarkGray; butClear.FlatStyle=FlatStyle.Popup; butClear.Font = new System.Drawing.Font("MS Reference Sans Serif", 7.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); butClear.Click += new System.EventHandler(rawReqClear); buttonpanel.Controls.Add(butClear); //create the search box searchRawReq = new TextBox(); searchRawReq.Location=new Point(90,5); searchRawReq.Size=new Size(250,21); //add to the panel buttonpanel.Controls.Add(searchRawReq); //the RTB RawReqreply = new RichTextBox(); RawReqreply.Location=new Point(0,0); RawReqreply.Multiline=true; RawReqreply.Size=new Size (580,685); RawReqreply.WordWrap=true; RawReqreply.DetectUrls=false; RawReqreply.BackColor=Color.DimGray; RawReqreply.ForeColor=Color.WhiteSmoke; RawReqreply.Dock=DockStyle.Fill; RawReqreply.Font=new System.Drawing.Font("MS Reference Sans Serif", 7.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); //finally the count label RawReqCountL=new Label(); RawReqCountL.Location=new Point(430,7); buttonpanel.Controls.Add(RawReqCountL); Cursor.Current=System.Windows.Forms.Cursors.WaitCursor; cleanHTTP(); string newheader=ComputeNewContentLength(txtHTTPdetails.Text); txtHTTPdetails.Text=newheader; newheader+="\r\n"; string replyz=""; bool useSSL=chkTargetIsSSL.Checked; if (useSSL){ replyz=sendraw(txtTargetHost.Text,txtTargetPort.Text,newheader,65535,(int)updownTimeOut.Value,2,useSSL); } else { replyz=sendraw(txtTargetHost.Text,txtTargetPort.Text,newheader,65535,(int)updownTimeOut.Value); } //now add the rtfbox to the main panel mainpanel.Controls.Add(RawReqreply); RawReqreply.Text=replyz; rawsendwindow.AcceptButton=butSearch; }
private void contextshowContent(object sender, System.EventArgs e) { try{ string[] parts = new string[5]; parts=lstCrowResponse.SelectedItem.ToString().Split(':'); int ID=Int32.Parse(parts[2]); foreach (CrowResponses response in CrowResponsesA){ if (response.ID==ID){ if (response.response.Length>0){ showresults formres = new showresults(); formres.Show(); formres.rtbResults.AppendText(response.response); } else { MessageBox.Show("No content for this request - did you disable saving of content?"); } } } }catch{ MessageBox.Show("No content for this request - did you disable saving of content?"); } }
private void btnReplay_Click(object sender, System.EventArgs e) { try{ if (txtHTTPdetails.Text.Length<=0 || txtTargetHost.Text.Length<=0 || txtTargetPort.Text.Length<=0){ return; } showresults formres=null; detailedRequest_IE work = new detailedRequest_IE(); work=getHTTPdetails(txtHTTPdetails.Text,true); if (chkReplayIE.Checked){ //IE try{ if (ie.FullName.Length>1){ ie.Stop(); ie.Quit(); ie = new InternetExplorer(); } } catch{ ie = new InternetExplorer(); } ie.Visible=true; Thread.Sleep(300); ie.Navigate2(ref work.url, ref isnull, ref isnull, ref work.postdata, ref work.headers); } if (chkReplayFireFox.Checked){ //FF try{ if (FF.FullName.Length>1){ formres.Controls.Remove(FF); FF.Stop(); FF.Quit(); FF = new AxMOZILLACONTROLLib.AxMozillaBrowser(); ((System.ComponentModel.ISupportInitialize)(this.FF)).BeginInit(); FF.Location = new System.Drawing.Point(0, 0); FF.Size = new System.Drawing.Size(792, 541); formres.Controls.Add(FF); Thread.Sleep(300); } } catch{ formres = new showresults(); try{ formres.Text="FireFox Browser results"; FF = new AxMOZILLACONTROLLib.AxMozillaBrowser(); ((System.ComponentModel.ISupportInitialize)(this.FF)).BeginInit(); FF.Location = new System.Drawing.Point(0, 0); FF.Size = new System.Drawing.Size(792, 541); formres.Controls.Remove(formres.rtbResults); formres.Controls.Add(FF); formres.Show(); } catch {} } //hack - Firefox adds its own content length try{ work.headers=work.headers.ToString().Replace("Content-Length","Firefix").Replace("Content-length","Firefix"); FF.Navigate2(ref work.url, ref isnull, ref isnull, ref work.postdata, ref work.headers); } catch {} } } catch {} }