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); } } }
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 = "检测完成"; } }