=_maxThreads)break;System.ObjectlockThis=newSystem.Object();lock(lockThis){_currentThreads;if(_currentThreads>_maxThreads)_currentThreads=_maxThreads;stringtip=curIp;Threadt=newThread(newParameterizedThreadStart(Run));t.Start(tip);threads.Add(t);curIp=IPUtility.getLastIp(curIp,p.EndIp,1);}}else{break;}}}}protectedvoidRun(objectob){stringip=ob.ToString();SocketGetHeadh=newSocketGetHead();stringret=h.GetHtml(ip,80);if(ret.IndexOf("DVRDVS-Webs")>0){ListViewItemitem=newListViewItem();item.SubItems[0].Text=(listView1.Items.Count1).ToString();ListViewItem.ListViewSubItemlvSubItem=newListViewItem.ListViewSubItem();lvSubItem.Text=ip;item.SubItems.Add(lvSubItem);lvSubItem=newListViewItem.ListViewSubItem();lvSubItem.Text="DVRDVS-Webs";item.SubItems.Add(lvSubItem);listView1.Items.Add(item);}System.ObjectlockThis=newSystem.Object();lock(lockThis){lblCurIp.Text=ip;_currentThreads--;if(_currentThreads<0)_currentThreads=0;}}privatevoidtsmCopy_Click(objectsender,EventArgse){if(listView1.SelectedItems.Count>0){stringip=listView1.SelectedItems[0].SubItems[1].Text;Clipboard.SetText(ip);}}privatevoidtsmExport_Click(objectsender,EventArgse){StreamWriterwriter=newStreamWriter(AppDomain.CurrentDomain.BaseDirectory"\export.txt",true);foreach(ListViewItemiteminlistView1.Items){stringip=item.SubItems[1].Text;writer.WriteLine(ip);writer.Flush();}writer.Flush();writer.Close();MessageBox.Show("导出成功!");}privatevoidForm1_FormClosing(objectsender,FormClosingEventArgse){try{if(mt!=null){mt.Interrupt();mt.Abort();}foreach(Threadtinthreads){t.Interrupt();t.Abort();}if(main!=null){main.Interrupt();main.Abort();}}catch{}Thread.Sleep(5000);}privatevoidbtnStop_Click(objectsender,EventArgse){try{if(mt!=null){mt.Interrupt();mt.Abort();}foreach(Threadtinthreads){t.Interrupt();t.Abort();}if(main!=null){main.Interrupt();main.Abort();}}catch{}btnStart.Enabled=true;}}}-IMDN开发者社群-imdn.cn"> =_maxThreads)break;System.ObjectlockThis=newSystem.Object();lock(lockThis){_currentThreads;if(_currentThreads>_maxThreads)_currentThreads=_maxThreads;stringtip=curIp;Threadt=newThread(newParameterizedThreadStart(Run));t.Start(tip);threads.Add(t);curIp=IPUtility.getLastIp(curIp,p.EndIp,1);}}else{break;}}}}protectedvoidRun(objectob){stringip=ob.ToString();SocketGetHeadh=newSocketGetHead();stringret=h.GetHtml(ip,80);if(ret.IndexOf("DVRDVS-Webs")>0){ListViewItemitem=newListViewItem();item.SubItems[0].Text=(listView1.Items.Count1).ToString();ListViewItem.ListViewSubItemlvSubItem=newListViewItem.ListViewSubItem();lvSubItem.Text=ip;item.SubItems.Add(lvSubItem);lvSubItem=newListViewItem.ListViewSubItem();lvSubItem.Text="DVRDVS-Webs";item.SubItems.Add(lvSubItem);listView1.Items.Add(item);}System.ObjectlockThis=newSystem.Object();lock(lockThis){lblCurIp.Text=ip;_currentThreads--;if(_currentThreads<0)_currentThreads=0;}}privatevoidtsmCopy_Click(objectsender,EventArgse){if(listView1.SelectedItems.Count>0){stringip=listView1.SelectedItems[0].SubItems[1].Text;Clipboard.SetText(ip);}}privatevoidtsmExport_Click(objectsender,EventArgse){StreamWriterwriter=newStreamWriter(AppDomain.CurrentDomain.BaseDirectory"\export.txt",true);foreach(ListViewItemiteminlistView1.Items){stringip=item.SubItems[1].Text;writer.WriteLine(ip);writer.Flush();}writer.Flush();writer.Close();MessageBox.Show("导出成功!");}privatevoidForm1_FormClosing(objectsender,FormClosingEventArgse){try{if(mt!=null){mt.Interrupt();mt.Abort();}foreach(Threadtinthreads){t.Interrupt();t.Abort();}if(main!=null){main.Interrupt();main.Abort();}}catch{}Thread.Sleep(5000);}privatevoidbtnStop_Click(objectsender,EventArgse){try{if(mt!=null){mt.Interrupt();mt.Abort();}foreach(Threadtinthreads){t.Interrupt();t.Abort();}if(main!=null){main.Interrupt();main.Abort();}}catch{}btnStart.Enabled=true;}}} - IMDN开发者社群-imdn.cn">
登录
首页 » C# » c# 扫描IP Http Header

c# 扫描IP Http Header

于 2014-06-23 发布
0 272
下载积分: 1 下载次数: 0

代码说明:

c# 扫描IP Http Headerusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Threading;using System.IO;namespace HScan{ public partial class Form1 : Form { int _currentThreads = 0; int _maxThreads = 100; Thread main = null; Thread mt = null; List threads = new List(); public Form1() { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; } private void btnStart_Click(object sender, EventArgs e) { btnStart.Enabled = false; if (txtStart.Text.Trim() == "") { MessageBox.Show("起始IP不能为空."); return; } if (txtEnd.Text.Trim() == "") { MessageBox.Show("结束IP不能为空."); return; } int ts = Convert.ToInt32(txtThreads.Text); _maxThreads = ts; string startIp = txtStart.Text; string endIp = txtEnd.Text; TParameter tp=new TParameter(); tp.StartIp=startIp; tp.EndIp=endIp; tp.ThreadCount=ts; main = new Thread(new ParameterizedThreadStart(StartMe)); main.Start(tp); } protected void ThreadManage() { Thread c=null; while (true) { System.Object lockThis = new System.Object(); lock (lockThis) { for (int i = 0; i < threads.Count; i ) { if (threads[i] != null && !threads[i].IsAlive) { c = threads[i]; break; } } if (c != null) { threads.Remove(c); } } } } protected void StartMe(object ob) { mt = new Thread(new ThreadStart(ThreadManage)); mt.Start(); TParameter p = ob as TParameter; string curIp = p.StartIp; while (true) { for (int i = 0; i < _maxThreads; i ) { if (curIp != "") { if (_currentThreads >= _maxThreads) break; System.Object lockThis = new System.Object(); lock (lockThis) { _currentThreads ; if (_currentThreads > _maxThreads) _currentThreads = _maxThreads; string tip = curIp; Thread t = new Thread(new ParameterizedThreadStart(Run)); t.Start(tip); threads.Add(t); curIp = IPUtility.getLastIp(curIp, p.EndIp, 1); } } else { break; } } } } protected void Run(object ob) { string ip = ob.ToString(); SocketGetHead h = new SocketGetHead(); string ret = h.GetHtml(ip, 80); if (ret.IndexOf("DVRDVS-Webs") > 0) { ListViewItem item = new ListViewItem(); item.SubItems[0].Text = (listView1.Items.Count 1).ToString(); ListViewItem.ListViewSubItem lvSubItem = new ListViewItem.ListViewSubItem(); lvSubItem.Text = ip; item.SubItems.Add(lvSubItem); lvSubItem = new ListViewItem.ListViewSubItem(); lvSubItem.Text = "DVRDVS-Webs"; item.SubItems.Add(lvSubItem); listView1.Items.Add(item); } System.Object lockThis = new System.Object(); lock(lockThis) { lblCurIp.Text = ip; _currentThreads--; if (_currentThreads < 0) _currentThreads = 0; } } private void tsmCopy_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { string ip = listView1.SelectedItems[0].SubItems[1].Text; Clipboard.SetText(ip); } } private void tsmExport_Click(object sender, EventArgs e) { StreamWriter writer = new StreamWriter(AppDomain.CurrentDomain.BaseDirectory "\export.txt",true); foreach (ListViewItem item in listView1.Items) { string ip=item.SubItems[1].Text; writer.WriteLine(ip); writer.Flush(); } writer.Flush(); writer.Close(); MessageBox.Show("导出成功!"); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { try { if (mt != null) { mt.Interrupt(); mt.Abort(); } foreach (Thread t in threads) { t.Interrupt(); t.Abort(); } if (main != null) { main.Interrupt(); main.Abort(); } } catch { } Thread.Sleep(5000); } private void btnStop_Click(object sender, EventArgs e) { try { if (mt != null) { mt.Interrupt(); mt.Abort(); } foreach (Thread t in threads) { t.Interrupt(); t.Abort(); } if (main != null) { main.Interrupt(); main.Abort(); } } catch { } btnStart.Enabled = true; } }}

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • DDOSSCOMtermmO
    1.DOS下使用,功能类似于WINDOWS的超级终端 2.支持COM1,COM2 3..支持波特率2400,4800,96600(缺省),19200,38400,57600,115200 4.支持Xmodem文件传输协议,,Asm,Com Port 可直接使用。 ">
    2012-09-15 11:57:07下载
    积分:1
  • mountain_goat-master
    说明:  TCP侧信道攻击,用于实现CVE-2016-5696的漏洞验证(off-path exploit used to do CVE-2016-5696 poc)
    2020-06-19 04:20:01下载
    积分:1
  • INNETER-IC
    网络重传选择协议,可以检查传输信息的正确性。通过接受方的校检,通知发送方重新发送。 ( Network retransmission protocol, you can check the correctness of the transmission of information. By accepting the prosecution s school to notify the sender to resend.)
    2015-10-14 09:19:13下载
    积分:1
  • radmin21
    说明:  务器端基于select I/O模型。为防止程序界面阻塞,有一个子线程用于不断接收socket并select其中的处理。客户端只有一个线程函数,不过其利用率很高,可用于远程目录交换,请求文件大小,创建若干线程来下载文件。文件传输有上传和下载,还有对等传输,这个项目中,传输文件具体指下载。(Client server based on select I/O model. Programming interfaces in order to prevent obstruction, there is a sub-thread for receiving socket and select which treatment. There is only one client thread function, but its utilization very high, can be used for remote directory exchange, request the file size, create a number of threads to download the file. File transfer are uploading and downloading, as well as peer-to-peer transmission, this project, the specific means to transfer files to download.)
    2008-10-20 11:08:26下载
    积分:1
  • Fat-Tree
    基于opnet的胖树多播网络仿真,主要为多播算法的仿真,程序较完善(Opnet fat tree multicast network simulation, primarily for multicast algorithm based simulation program better)
    2021-02-08 15:09:54下载
    积分:1
  • 串口通讯测试工具(源码)
    1软件打开时,自动检测有效COM端口 2 软件打开时,自动复原到上次关闭时的状态 3 不必关闭串口,即可直接进行更改初始化设置内容(串口号、波特率、数据位、停止位、校验位),可按更改后的信息自动将串口重新打开 4 可统计接收字节和发送字节的个数 5 接收数据可按16进制数据和非16进制数据进行整体转换 6 可将接收到数据进行保存 7 可设置自动发送,发送时间可进行实时更改 8可按字符串、16进制字节、文件方式进行发送,字符串和16进制字节可分别进行存储,内容互不干扰 9 按16进制发送时,可自动校验格式,不会输错 10 可清空发送或接收区域的数据
    2020-03-02下载
    积分:1
  • 基于OPNET的无线自组织AODV协议的仿真
    说明:  基于OPNET的无线自组织网络AODV协议的仿真(Simulation of AODV protocol in wireless ad hoc network based on OPNET)
    2020-04-01 23:43:19下载
    积分:1
  • SSgameRun
    :本系统属于小型的局域网监控系统,可以对某一台计算机进行屏幕监控,本系统主要实现以下功能:  系统采用人机交互的方式,界面美观友好。  屏幕信息需要时时显示,网络延时不能大于1秒。  服务器端可以随时运行,只要客户端运行,就能够显示屏幕信息。  系统运行时占用内存不能大于10MB,以免影响系统性能。  客户端运行时需要隐藏显示窗口,起其感觉不到在运行(network monitoring system that can carry out the screen of a computer monitor, the system achieve the following features:  system is the way human-computer interaction, interface, beautiful and friendly.  need to constantly display screen information, the network delay is not greater than 1 second.  server can be run at any time as long as the client runs, will be able to display information.  run-time memory for the system can not be larger than 10MB, so as not to affect system performance.  need to hide the client run-time display window, from its feel in the run.)
    2010-10-13 16:58:55下载
    积分:1
  • socket
    基于socket与数据库的自动贩货机服务器端和客户端的编程(Socket and the database automatically based on trafficking in goods and client-server programming)
    2011-05-16 15:45:31下载
    积分:1
  • 找零钱
    说明:  找零钱问题:有6种面值的货币(100,50,20,10,5,1),给定一个钱的数目x,要求用最少的货币数目表示,相同面值的货币可以多次出现。(Change-finding:There are 6 denomination currencies, given the number of money, express it with the smallest number of currencies.)
    2020-04-26 14:14:21下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载