Search code examples
c#packet-snifferssniffer

Sniffer c# (outwar)


With this code, I only cant sniff local traffic (inward) how to can I do for sniff all traffic (outward)

Socket _socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
_socket.Bind(new IPEndPoint(bindTo, 0));
_socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.HeaderIncluded, true);                           //option to true


byte[] byTrue = new byte[4] { 1, 0, 0, 0 };
byte[] byOut = new byte[4];

_socket.IOControl(IOControlCode.ReceiveAll, byTrue, byOut);

Solution

  • Windows firewall effect ... all code its ok!

    Set local lan

    Set this option