private void checkAExp(Object index) { while (urlMappings.Count > 0) { BatchExps batchExp = null; lock (base_lock) { batchExp = urlMappings.Dequeue(); } if (batchExp == null) { continue; } try { String url = ""; if (BatchCheckListView.Items[batchExp.Index].ForeColor == Color.Green) { continue; } ExpModule exp = getExpByIndex(batchExp.ExpIndex); url = BatchCheckListView.Items[batchExp.Index].SubItems[1].Text; BatchCheckListView.Items[batchExp.Index].SubItems[3].Text = "检测" + exp.Name; ExpVerificationResult result = ExpHandle.Verification(url, exp); result.Index = batchExp.Index; if (result.Code == 1) { BatchCheckListView.Items[result.Index].SubItems[3].Text = result.Result; BatchCheckListView.Items[result.Index].SubItems[2].Text = result.ExpName; BatchCheckListView.Items[result.Index].ForeColor = Color.Green; successProsion++; } if (result.Code == 2) { continue; } } catch { } finally { try { lock (base_lock) { checkNum[batchExp.Index]++; } if (BatchCheckListView.Items[batchExp.Index].ForeColor != Color.Green) { if (checkNum[batchExp.Index] >= expLength) { BatchCheckListView.Items[batchExp.Index].ForeColor = Color.DarkGray; BatchCheckListView.Items[batchExp.Index].SubItems[3].Text = "不存在漏洞"; } } } catch { } Thread.Sleep(1); } } }
public static string Timer(ExpHandle fn, double x, int n) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); fn(x, n); stopwatch.Stop(); return(stopwatch.Elapsed.ToString()); }
private ExpModule parseFormToExp() { ExpModule exp = new ExpModule(); exp.Name = ExpNameTextBox.Text; exp.Language = LanguafeComboBox.Text; exp.Status = 1; if (ExpStatusComboBox.Text.Equals("禁用")) { exp.Status = 0; } exp.FormatUrl = false; if (FormatUrlComboBox.Text.Equals("是")) { exp.FormatUrl = true; } ExpVerification verification = new ExpVerification(); verification.Context = VerificationValueTextBox.Text; foreach (Int32 key in MainForm.verificationTypes.Keys) { if (MainForm.verificationTypes[key].Equals(VerificationComboBox.Text)) { verification.Type = key; } } exp.Verification = verification; exp.Verification.Calc = CalcComboBox.Text; HttpModule expContext = new HttpModule(); Dictionary <String, String> headers = new Dictionary <string, string>(); for (int index = 0; index < HeaderListview.Items.Count; index++) { try { headers.Add(HeaderListview.Items[index].SubItems[0].Text, HeaderListview.Items[index].SubItems[1].Text); } catch { } } expContext.Header = headers; expContext.Encode = EncodeComBox.Text; expContext.Body = BodyTextBox.Text; if (!String.IsNullOrEmpty(expContext.Body)) { if (ExpHandle.IsHexadecimal(expContext.Body)) { expContext.IsHex = true; } } expContext.Method = RequestMethodComboBox.Text; exp.ExpContext = expContext; return(exp); }
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 = "检测完成"; } }