• 大小: 57KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-26
  • 语言: C#
  • 标签:

资源简介

采用多线程技术,实现了多主机,多端口的扫描,速度挺快!

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
//增加的如下.. 
using System.Data;
using System.Net.Sockets;
using System.Net;
using System.IO;
using System.Text;
using System.Threading;


namespace Scnner
{
    public partial class Form1 : Form
    {
        //该处放的是程序要用到的公共变量 
        public string scanHost = Dns.GetHostName(); //默认当前本机IP 
        public Int32 tport = 0; //当前连接端口编号 
        public Int32 connState = 0; //扫描状态 
        public int portSum = 0; //端口总计 
        public bool endThread = false; //结束状态 
        public int ThreadSum = 0; //当前线程总数
        public IPAddress startip;
        public IPAddress endip;
        public AutoResetEvent asyncOpsAreDone = new AutoResetEvent(false);

        delegate void AppendStringDelgate(string str);

        AppendStringDelgate appendStringDelegate;
        AppendStringDelgate logListappendStringDelegate;
        AppendStringDelgate cmdExecappendStringDelgate;
        AppendStringDelgate SuccessPortappendStringDelgate;

        public Form1()
        {
            InitializeComponent();
            appendStringDelegate = new AppendStringDelgate(AppendString);
            logListappendStringDelegate = new AppendStringDelgate(logListAppendString);
            cmdExecappendStringDelgate = new AppendStringDelgate(cmdExecAppendString);
            SuccessPortappendStringDelgate = new AppendStringDelgate(successPortAppendString);
        }

        private void AppendString(string str)
        {
            portList.Items.Add(str);
        }
        private void logListAppendString(string str)
        {
            logList.Items.Add(str); 
        }

        private void successPortAppendString(string str)
        {
            SuccessPort.Items.Add(str);
        }
       
        private void cmdExecAppendString(string str)
        {
            cmdExec.Text=str; 
        }
       
        public void Startscan(object state)
        {
            Int32 port = (Int32)state;
            string tMsg = ““;
            string getData = ““;
            int lindex = 0;
            int eindex = 0;
            connState++; //判断线程数目 

            if (endThread == true)
            {
                if (connState == ((Int32)eNum.Value - (Int32)sNum.Value))
                {
                    cmdExec.Invoke(cmdExecappendStringDelgate “&Scan“);

                    logList.Invoke(logListappendStringDelegate “扫描完毕!“);
                }
                else
                {
                   cmdExec.Invoke(cmdExecappendStringDelgate“&Stop“);
                   logList.Invoke(logListappendStringDelegate “正在停止对“ + port.ToString() + “端口的扫描线程“);
                }
                logList.Invoke(logListappendStringDelegate “结束线程:“ + port.ToString());
                asyncOpsAreDone.Close();
                //ThreadSu

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .CA....     32768  2007-11-03 13:22  MultiThreadingScanner\Scnner\bin\Debug\Scnner.exe

    .CA....     32256  2007-11-03 13:22  MultiThreadingScanner\Scnner\bin\Debug\Scnner.pdb

    .CA....      8080  2007-11-03 23:04  MultiThreadingScanner\Scnner\bin\Debug\Scnner.rar

    .CA....      5632  2005-12-08 14:51  MultiThreadingScanner\Scnner\bin\Debug\Scnner.vshost.exe

    .C.D...         0  2007-12-29 22:40  MultiThreadingScanner\Scnner\bin\Debug

    .C.D...         0  2007-12-29 22:40  MultiThreadingScanner\Scnner\bin

    .CA....     10717  2007-12-28 00:13  MultiThreadingScanner\Scnner\Form1.cs

    .CA....     27451  2007-11-03 13:22  MultiThreadingScanner\Scnner\Form1.Designer.cs

    .CA....      6211  2007-11-03 13:22  MultiThreadingScanner\Scnner\Form1.resx

    .C.D...         0  2007-12-29 22:40  MultiThreadingScanner\Scnner\obj\Debug\Refactor

    .CA....       842  2007-11-03 13:22  MultiThreadingScanner\Scnner\obj\Debug\Scnner.csproj.GenerateResource.Cache

    .CA....     32768  2007-11-03 13:22  MultiThreadingScanner\Scnner\obj\Debug\Scnner.exe

    .CA....       180  2007-11-03 13:22  MultiThreadingScanner\Scnner\obj\Debug\Scnner.Form1.resources

    .CA....     32256  2007-11-03 13:22  MultiThreadingScanner\Scnner\obj\Debug\Scnner.pdb

    .CA....       180  2007-10-26 16:35  MultiThreadingScanner\Scnner\obj\Debug\Scnner.Properties.Resources.resources

    .C.D...         0  2007-12-29 22:40  MultiThreadingScanner\Scnner\obj\Debug\TempPE

    .C.D...         0  2007-12-29 22:40  MultiThreadingScanner\Scnner\obj\Debug

    .CA....       685  2007-12-28 00:13  MultiThreadingScanner\Scnner\obj\Scnner.csproj.FileListAbsolute.txt

    .C.D...         0  2007-12-29 22:40  MultiThreadingScanner\Scnner\obj

    .CA....       465  2007-10-26 16:31  MultiThreadingScanner\Scnner\Program.cs

    .CA....      1178  2007-10-26 16:31  MultiThreadingScanner\Scnner\Properties\AssemblyInfo.cs

    .CA....      2868  2007-10-26 16:31  MultiThreadingScanner\Scnner\Properties\Resources.Designer.cs

    .CA....      5612  2007-10-26 16:31  MultiThreadingScanner\Scnner\Properties\Resources.resx

    .CA....      1091  2007-10-26 16:31  MultiThreadingScanner\Scnner\Properties\Settings.Designer.cs

    .CA....       249  2007-10-26 16:31  MultiThreadingScanner\Scnner\Properties\Settings.settings

    .C.D...         0  2007-12-29 22:40  MultiThreadingScanner\Scnner\Properties

    .CA....      3219  2007-10-26 16:35  MultiThreadingScanner\Scnner\Scnner.csproj

    .CA....       168  2007-10-26 19:58  MultiThreadingScanner\Scnner\Scnner.csproj.user

    .C.D...         0  2007-12-29 22:40  MultiThreadingScanner\Scnner

    .CA....       907  2007-10-26 16:31  MultiThreadingScanner\Scnner.sln

............此处省略5个文件信息

评论

共有 条评论

相关资源