public void Httpstart() { timer1.Start(); string exepath = Environment.CurrentDirectory; if (Directory.Exists(exepath + @"\net\") == false)//如果不存在就创建file文件夹 { Directory.CreateDirectory(exepath + @"\net\"); } if (Directory.Exists(exepath + @"\net\upload\") == false)//如果不存在就创建file文件夹 { Directory.CreateDirectory(exepath + @"\net\upload\"); } m_Sniffer = new SnifferSocket(); m_Sniffer.TcpPacketReceived += new TcpPacketCallback(m_Sniffer_TcpPacketReceived); IPAddress[] addressList = Dns.GetHostAddresses(Dns.GetHostName()); if (addressList.Length != 0) { foreach (IPAddress ip in addressList) { if (ip.ToString().Split('.').Length == 4) { m_Sniffer.Sniff(ip.ToString()); } } } }
private void button1_Click(object sender, EventArgs e) { m_Sniffer = new SnifferSocket(); m_Sniffer.TcpPacketReceived += new TcpPacketCallback(m_Sniffer_TcpPacketReceived); IPAddress[] addressList = Dns.GetHostAddresses(Dns.GetHostName()); if (addressList.Length != 0) { foreach (IPAddress ip in addressList) { if (ip.ToString().Split('.').Length == 4) { m_Sniffer.Sniff(ip.ToString()); } } } this.button1.Text = "已开始抓取URL"; this.button1.Enabled = false; System.Diagnostics.Process.Start("http://www.10010.com"); }
public void Start() { _socket = new SnifferSocket(new IPEndPoint(IPAddress.Parse(_currentInterface), 0)); _socket.OnPackageReceived += _socket_OnPackageReceived; }