private void 导入数据ToolStripMenuItem1_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { if (ofd.FileName != "") { StreamReader sr = new StreamReader(ofd.FileName); StringBuilder sb = new StringBuilder(""); while (true) { string line = sr.ReadLine(); if (line == null) { break; } if (line.Equals("")) { continue; } try { ExpModule exp = (ExpModule)JsonHandle.toBean <ExpModule>(line); modifyExpInfo(exp, -1); } catch { } } sr.Close(); } } }
public void initLvi() { if (lvi == null) { for (int i = 0; i < parentMain.HeaderListview.Items.Count; i++) { addOrModifyHeader(parentMain.HeaderListview.Items[i].SubItems[0].Text, parentMain.HeaderListview.Items[i].SubItems[1].Text, -1); } return; } String expName = lvi.SubItems[1].Text; String language = lvi.SubItems[2].Text; String status = lvi.SubItems[5].Text; ExpNameTextBox.Text = expName; LanguafeComboBox.Text = language; ExpStatusComboBox.Text = status; //解析Header String json = lvi.SubItems[3].Text; ExpModule exp = (ExpModule)JsonHandle.toBean <ExpModule>(json); if (exp == null) { return; } if (exp.ExpContext != null) { //解析Header if (exp.ExpContext.Header != null) { foreach (String key in exp.ExpContext.Header.Keys) { ListViewItem lvitmp = new ListViewItem(); lvitmp.SubItems[0].Text = key; lvitmp.SubItems.Add(exp.ExpContext.Header[key]); HeaderListview.Items.Add(lvitmp); } } BodyTextBox.Text = exp.ExpContext.Body; EncodeComBox.Text = exp.ExpContext.Encode; FormatUrlComboBox.Text = "否"; RequestMethodComboBox.Text = exp.ExpContext.Method; if (exp.FormatUrl) { FormatUrlComboBox.Text = "是"; } } if (exp.Verification != null) { VerificationValueTextBox.Text = exp.Verification.Context; CalcComboBox.Text = exp.Verification.Calc; VerificationComboBox.Text = MainForm.verificationTypes[exp.Verification.Type]; } }
private void loadConfig() { try { StreamReader sr = new StreamReader(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf", Encoding.Default); String line; StringBuilder configContext = new StringBuilder(); while ((line = sr.ReadLine()) != null) { configContext.AppendLine(line); } sr.Close(); CoodyConfig config = (CoodyConfig)JsonHandle.toBean <CoodyConfig>(configContext.ToString()); ThreadNumComboBox.Text = config.ThreadNum; TimeOutComboBox.Text = config.TimeOut; if (config.ExpListViews != null) { foreach (String[] lines in config.ExpListViews) { ListViewItem lvi = new ListViewItem(); lvi.SubItems[0].Text = Convert.ToString(ExpListView.Items.Count + 1); lvi.SubItems.Add(lines[1]); lvi.SubItems.Add(lines[2]); lvi.SubItems.Add(lines[3]); lvi.SubItems.Add(lines[4]); lvi.SubItems.Add(lines[5]); ExpListView.Items.Add(lvi); } } if (config.HeaderListviews != null) { foreach (String[] lines in config.HeaderListviews) { addOrModifyHeader(lines[0], lines[1], -1); } } } catch { } finally { if (ExpListView.Items.Count == 0) { String jsons = Properties.Resources.Struts2_exp; String[] lines = jsons.Split(Environment.NewLine.ToCharArray()); foreach (String line in lines) { ExpModule exp = (ExpModule)JsonHandle.toBean <ExpModule>(line); modifyExpInfo(exp, -1); } } } }
private ExpModule getExpByIndex(Int32 expIndex) { if (expDics.ContainsKey(expIndex)) { return(expDics[expIndex]); } String expJson = ExpListView.Items[expIndex].SubItems[3].Text; ExpModule exp = (ExpModule)JsonHandle.toBean <ExpModule>(expJson); try { expDics.Add(expIndex, exp); } catch { } return(exp); }
private void loadConfig() { try { StreamReader sr = new StreamReader(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf", Encoding.Default); String line; StringBuilder configContext = new StringBuilder(); while ((line = sr.ReadLine()) != null) { configContext.AppendLine(line); } sr.Close(); List <KeywordCodeTrigger> triggers = (List <KeywordCodeTrigger>)JsonHandle.toBean <List <KeywordCodeTrigger> >(configContext.ToString()); foreach (KeywordCodeTrigger keywordCodeTrigger in triggers) { try { ListViewItem lvi = new ListViewItem(); lvi.SubItems[0].Text = Convert.ToString(ConfigListView.Items.Count + 1); lvi.SubItems.Add(keywordCodeTrigger.keyword); lvi.SubItems.Add(keywordCodeTrigger.code); lvi.SubItems.Add(keywordCodeTrigger.nextPageCode); ConfigListView.Items.Add(lvi); } catch { } } } catch { } finally { if (ConfigListView.Items.Count == 0) { ListViewItem lvi = new ListViewItem(); lvi.SubItems[0].Text = Convert.ToString(ConfigListView.Items.Count + 1); lvi.SubItems.Add("https://www.google.com"); lvi.SubItems.Add(GoogleSpider.Properties.Resources.GoogleCollScript); lvi.SubItems.Add(GoogleSpider.Properties.Resources.GoogleCollCallPageScript); ConfigListView.Items.Add(lvi); } } }
private void checkExpForSign(object indexObj) { int index = (int)indexObj; String url = UrlTextBox.Text; String expJson = ScannerExpListView.Items[index].SubItems[5].Text; ExpModule exp = (ExpModule)JsonHandle.toBean <ExpModule>(expJson); ScannerExpListView.Items[index].SubItems[3].Text = "检测中"; try { ExpVerificationResult result = ExpHandle.Verification(url, exp); ScannerExpListView.Items[index].SubItems[6].Text = result.Html; if (!String.IsNullOrEmpty(result.Html)) { ResultTextBox.Text = result.Html; } if (result.Code == 0) { ScannerExpListView.Items[index].SubItems[4].Text = result.Result; ScannerExpListView.Items[index].ForeColor = Color.Red; return; } if (result.Code == 1) { ScannerExpListView.Items[index].SubItems[4].Text = result.Result; ScannerExpListView.Items[index].ForeColor = Color.Green; } if (result.Code == 2) { ScannerExpListView.Items[index].SubItems[4].Text = "连接失败"; ScannerExpListView.Items[index].ForeColor = Color.Red; } } catch { } finally { ScannerExpListView.Items[index].SubItems[3].Text = "检测完成"; } }
private void loadConfig(String fileName) { try { if (String.IsNullOrEmpty(fileName)) { fileName = System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf"; } StreamReader sr = new StreamReader(fileName, Encoding.Default); String line; StringBuilder configContext = new StringBuilder(); while ((line = sr.ReadLine()) != null) { configContext.AppendLine(line); } sr.Close(); ExhausitiverConfig config = (ExhausitiverConfig)JsonHandle.toBean <ExhausitiverConfig>(configContext.ToString()); ConfigProtocolComboBox.Text = config.General.Protocol; ConfigHostTextBox.Text = config.General.Host; ConfigMethodComboBox.Text = config.General.Method; ConfigPortTextBox.Text = Convert.ToString(config.General.Port); ConfigTimeOutCombox.Text = (config.General.TimeOut * 1000) + "秒"; ConfigEncodeComboBox.Text = config.General.Encode; ConfigBodyTextBox.Text = Encoding.GetEncoding(ConfigEncodeComboBox.Text.Equals("自动") ? "UTF-8" : ConfigEncodeComboBox.Text).GetString(config.General.Data); ConfigVerificationTypeComboBox.SelectedIndex = config.Verification.CalcType; ConfigCalcComboBox.SelectedIndex = config.Verification.VerificationType; ConfigVerificationValueTextBox.Text = config.Verification.Value; ConfigThreadNumComboBox.Text = Convert.ToString(config.General.ThreadNum); SuccessStopCheckBox.Checked = config.Verification.SuccessThenStop; foreach (ExhausitiverDic dic in config.Dics) { ListViewItem lvi = new ListViewItem(); lvi.SubItems[0].Text = dic.ParamName; lvi.SubItems.Add(dic.Path); DicsListview.Items.Add(lvi); } } catch { } }
private void SignWebView_LoadCompleted(object sender, EO.WebBrowser.LoadCompletedEventArgs e) { UrlTextBox.Text = SignWebView.Url.ToString(); String jsCode = ""; String nextPageCode = ""; for (int i = 0; i < ConfigListView.Items.Count; i++) { if (!SignWebView.Url.ToString().Contains(ConfigListView.Items[i].SubItems[1].Text)) { ConfigListView.Items[i].ForeColor = Color.DarkGray; continue; } if (String.IsNullOrEmpty(ConfigListView.Items[i].SubItems[2].Text) && String.IsNullOrEmpty(ConfigListView.Items[i].SubItems[3].Text)) { ConfigListView.Items[i].ForeColor = Color.DarkGray; continue; } jsCode = ConfigListView.Items[i].SubItems[2].Text; nextPageCode = ConfigListView.Items[i].SubItems[3].Text; ConfigListView.Items[i].Selected = true; ConfigListView.Items[i].ForeColor = Color.Green; } if (!String.IsNullOrEmpty(jsCode)) { Object obj = SignWebView.EvalScript(jsCode); String json = Convert.ToString(obj); if (String.IsNullOrEmpty(json) || "[]".Equals(json)) { return; } try { List <UrlInfo> users = (List <UrlInfo>)JsonHandle.toBean <List <UrlInfo> >(json); foreach (UrlInfo urlInfo in users) { try { ListViewItem lvi = new ListViewItem(); lvi.SubItems[0].Text = Convert.ToString(DataListView.Items.Count + 1); lvi.SubItems.Add(urlInfo.url); lvi.SubItems.Add(urlInfo.title); lvi.SubItems.Add("待检测"); lvi.SubItems.Add("待检测"); DataListView.Items.Add(lvi); } catch { } } } catch { } } //翻页 try { if (!String.IsNullOrEmpty(nextPageCode)) { SignWebView.EvalScript(nextPageCode); } } catch { } }