CrazeD
Member
+368|6933|Maine
Is it possible to monitor network traffic from a PC on the network? In other words, do you have to have access to the router/switch to do such a thing?

I'm getting a wireless router tomorrow and I want to periodically make sure nobody is leeching off it.
alexb
<3
+590|6200|Kentucky, USA

CrazeD wrote:

Is it possible to monitor network traffic from a PC on the network? In other words, do you have to have access to the router/switch to do such a thing?

I'm getting a wireless router tomorrow and I want to periodically make sure nobody is leeching off it.
...Why not just password protect your network?
Scratch[USA]
Member
+105|6807
Most of the time the router software will tell you how many computers/phones/consoles/etc. are connected to your router.

Last edited by Scratch[USA] (2009-11-17 16:57:48)

jsnipy
...
+3,277|6782|...

convert this into java , enjoy

Code:

private static void sendAsyncPingPacket(string hostToPing)
    {
        try
        {
            int timeout = 5000;
            AutoResetEvent waiter = new AutoResetEvent(false);
            Ping pingPacket = new Ping();
            //ping completion event reaised
            pingPacket.PingCompleted += new PingCompletedEventHandler(PingCompletedCallback);
            string data = "Ping test check";
            byte[] byteBuffer = Encoding.ASCII.GetBytes(data);
            PingOptions pingOptions = new PingOptions(64, true);
            Console.WriteLine("Time to live: {0}", pingOptions.Ttl);
            //Console.WriteLine("Don't fragment: {0}", pingOptions.DontFragment);
            pingPacket.SendAsync(hostToPing, timeout, byteBuffer, pingOptions, waiter);


            //do something useful
            waiter.WaitOne();
            Console.WriteLine("Ping RoundTrip returned, Do something useful here...");
        }
        catch (PingException pe)
        {
            Console.WriteLine("INVALID IP ADDRESS FOUND");
        }
        catch (Exception ex)
        {
            Console.WriteLine("Exceptin " + ex.Message);
        }

    }
    private static void PingCompletedCallback(object sender, PingCompletedEventArgs e)
    {
        try
        {
            if (e.Cancelled)
            {
                Console.WriteLine("Ping canceled.");

                // Let the main thread resume. 
                // UserToken is the AutoResetEvent object that the main thread 
                // is waiting for.
                ((AutoResetEvent)e.UserState).Set();
            }

            // If an error occurred, display the exception to the user.
            if (e.Error != null)
            {
                Console.WriteLine("Ping failed>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ");
                //this will print exception
                //Console.WriteLine (e.Error.ToString ());

                // Let the main thread resume. 
                ((AutoResetEvent)e.UserState).Set();
            }

            PingReply reply = e.Reply;

            DisplayReply(reply);

            // Let the main thread resume.
            ((AutoResetEvent)e.UserState).Set();
        }
        catch (PingException pe)
        {
            Console.WriteLine("INVALID IP ADDRESS");
        }
        catch (Exception ex)
        {
            Console.WriteLine("Exception " + ex.Message);
        }
    }

    public static void DisplayReply (PingReply reply)
    {
        if (reply == null)
            return;

        Console.WriteLine ("ping status: {0}", reply.Status);
        if (reply.Status == IPStatus.Success)
        {
            Console.WriteLine ("Address: {0}", reply.Address.ToString ());
            Console.WriteLine ("RoundTrip time: {0}", reply.RoundtripTime);
            Console.WriteLine ("Time to live: {0}", reply.Options.Ttl);
            //Console.WriteLine ("Don't fragment: {0}", reply.Options.DontFragment);
            Console.WriteLine ("Buffer size: {0}", reply.Buffer.Length);
        }
    }

  private static long ToInt(string addr) 
    {

        return (long)(uint)System.Net.IPAddress.NetworkToHostOrder(
            (int)System.Net.IPAddress.Parse(addr).Address);    
    }

   private static string ToAddr(long address)
    {
        return System.Net.IPAddress.Parse(address.ToString()).ToString();
    }

static int temp = 0;
    private static void scanLiveHosts(string ipFrom, string ipTo)
    {
        long from =  Program.ToInt(ipFrom);
        long to =  Program.ToInt(ipTo);

        long ipLong = Program.ToInt(ipFrom);
        while ( from < to)
        {

            string address = Program.ToAddr(ipLong);
            Program.sendAsyncPingPacket(address);
            ipLong++;
        }

    }
        static void Main(string[] args)
    {
        try
        {
            Program.getDeviceList();
            Program.sendAsyncPingPacket("192.168.3.72");
            Program.scanLiveHosts("192.168.3.1", "192.168.3.41");



        }
        catch (InvalidOperationException ioe)
        {
            Console.WriteLine(ioe.Message);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }

Last edited by jsnipy (2009-11-17 16:58:46)

13urnzz
Banned
+5,830|6757

hax! is that the "js" extension?
Catbox
forgiveness
+505|6976
this is a great free program to analyze wireless network traffic
http://www.wireshark.org/
Love is the answer
max
Vela Incident
+1,652|6827|NYC / Hamburg

alexb wrote:

...Why not just password protect your network?

Last edited by max (2009-11-17 17:15:45)

once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of ' hot  xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour, " 'Tis not possible!", i muttered, " give me back my free hardcore!"..... quoth the server, 404.
Defiance
Member
+438|6931

Scratch[USA] wrote:

Most of the time the router software will tell you how many computers/phones/consoles/etc. are connected to your router.
Indeed, and a properly useful router will give a history of connected MAC addresses, or better yet: only allow access to a user-entered list of MAC addresses.

As max said, first step is to turn on basic security, WPA2-Enterprise, if you can.

Packet sniffing (wireshark) would be difficult because you would have to catch them in the act.

Board footer

Privacy Policy - © 2025 Jeff Minard