I need to send packets with a wifi adapter to another computer without connecting to any network oriented to Windows 7 and above. First of all, ad-hoc (as I understand it) does not meet my needs, because this requires a connection.
I had two ideas:
Create something like a broadcast packet that identifies networks. It can be used on a wireless card.
send a fake but valid packet and which does not need a specific IP / MAC address (for example, they can be broadcast).
What I use: C # with a Win7 computer and a Win7 laptop to test the program. SharpPcap to send packets. Wireshark to check if they are arriving.
I tried the second method:
static void Main(string[] args)
{
WinPcapDeviceList devs = WinPcapDeviceList.Instance;
foreach (WinPcapDevice wdev in devs)
{
System.Console.Write("Device: ");
System.Console.WriteLine(wdev.Description);
foreach (var addr in wdev.Addresses)
System.Console.WriteLine(addr.Addr);
System.Console.WriteLine("--------------");
}
System.Console.Write("Select device: #");
int selected = int.Parse(System.Console.ReadLine());
var dev = devs[selected];
dev.Open();
while (true)
{
byte[] physBroad = new byte[] { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
EthernetPacket etherPacket = new EthernetPacket(
dev.MacAddress,
new PhysicalAddress(physBroad),
EthernetPacketType.IpV4);
IPv4Packet ip4Packet = new IPv4Packet(
new IPAddress(0),
IPAddress.Broadcast);
ip4Packet.Protocol = IPProtocolType.UDP;
etherPacket.PayloadPacket = ip4Packet;
UdpPacket udpPacket = new UdpPacket(
80,
80);
udpPacket.PayloadData = Encoding.UTF8.GetBytes("test packet");
ip4Packet.PayloadPacket = udpPacket;
dev.SendPacket(etherPacket);
}
}
( Wireshark). , .
, IEEE 802.11, , . , AirPcap? , .
:
Edimax Wireless LAN , Mediatek MT763E 802.11bgn Wifi . Wireshark , IEEE-802.11, Ethernet DOCSIS.