mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Linux

Reply
 
Thread Tools
Old 2018-09-13, 14:26   #1
SELROC
 

2×2,647 Posts
Default New ethernet sniffer program

I wrote a prototype packet sniffer for ethernet. It runs on Debian 9 as-is.
The program has a packet counter. Warning! it displays packet data in clear ascii.


https://github.com/valeriob01/etherframe


To compile the program just issue
Code:
make
There is an included program called listeth that lists all network interfaces in the system. Compile it with
Code:
make listeth
and run
Code:
./listeth
You will get a list of network interface names. You can then pass the interface name to etherframe with
Code:
./etherframe <interface name>
Without arguments the program defaults to eth0
  Reply With Quote
Old 2018-09-13, 17:13   #2
chalsall
If I May
 
chalsall's Avatar
 
"Chris Halsall"
Sep 2002
Barbados

37·263 Posts
Default

Quote:
Originally Posted by SELROC View Post
I wrote a prototype packet sniffer for ethernet.
How is this any better than tcpdump?

Can the output be fed into Wireshark?
chalsall is offline   Reply With Quote
Old 2018-09-13, 17:26   #3
SELROC
 

29×293 Posts
Default

Quote:
Originally Posted by chalsall View Post
How is this any better than tcpdump?

Can the output be fed into Wireshark?



I am not going to compete with tcpdump. I wrote this for exercise.


The output is a simple printf() so it should go to the standard output.
  Reply With Quote
Old 2018-09-13, 19:04   #4
chalsall
If I May
 
chalsall's Avatar
 
"Chris Halsall"
Sep 2002
Barbados

37·263 Posts
Default

Quote:
Originally Posted by SELROC View Post
I am not going to compete with tcpdump. I wrote this for exercise.
That's fair. And drilling down on your code, I find it quite clean.
chalsall is offline   Reply With Quote
Old 2018-09-14, 06:29   #5
SELROC
 

5,557 Posts
Default

Quote:
Originally Posted by chalsall View Post
That's fair. And drilling down on your code, I find it quite clean.

Thanks. Today I added the possibility to select the promiscuous mode enable/disable.


Code:
./etherframe <interface name> <promiscuous mode>

where promiscuous mode = 0=disabled, 1=enabled


the arguments are both optional.
  Reply With Quote
Old 2018-09-14, 19:33   #6
chalsall
If I May
 
chalsall's Avatar
 
"Chris Halsall"
Sep 2002
Barbados

37·263 Posts
Default

Quote:
Originally Posted by SELROC View Post
the arguments are both optional.
If I may, just drilling down on the premise of your code (being able to detect noise on a link), I'm not sure that your code can accomplish this.

When I try to do this kind of thing from one end, I do flood pinging (ICMP). If I have control of both ends of the connection I use UDP packets. But this only tells me packet loss, it doesn't give me any data with regards to noise nor attenuation, etc. Usually I get this kind of thing via SNMP messages from the devices (but, obviously, only if I have control of them).

Not trying to discourage you, but I'd be very interested if you have figured out a way to collect such data using only "sniffing the wire" at Layer 2.
chalsall is offline   Reply With Quote
Old 2018-09-15, 02:48   #7
SELROC
 

919 Posts
Default

Quote:
Originally Posted by chalsall View Post
If I may, just drilling down on the premise of your code (being able to detect noise on a link), I'm not sure that your code can accomplish this.

When I try to do this kind of thing from one end, I do flood pinging (ICMP). If I have control of both ends of the connection I use UDP packets. But this only tells me packet loss, it doesn't give me any data with regards to noise nor attenuation, etc. Usually I get this kind of thing via SNMP messages from the devices (but, obviously, only if I have control of them).

Not trying to discourage you, but I'd be very interested if you have figured out a way to collect such data using only "sniffing the wire" at Layer 2.

A true test would need a specific lab setup which I don't have. The current program reads packets and if there are incomplete packets, it increments some counter (COP and ROP).


I am aware of the thing.
  Reply With Quote
Old 2018-09-15, 22:06   #8
chalsall
If I May
 
chalsall's Avatar
 
"Chris Halsall"
Sep 2002
Barbados

37·263 Posts
Default

Quote:
Originally Posted by SELROC View Post
I am aware of the thing.
Please define "thing", in this context.

Edit: Not trying to be an *, but the word "thing" can mean many different things in and out of context. Some use it to cover the fact they can't communicate well. I believe you can, so please clarify.

Last fiddled with by chalsall on 2018-09-15 at 22:16
chalsall is offline   Reply With Quote
Old 2018-09-16, 04:19   #9
SELROC
 

413010 Posts
Default

Quote:
Originally Posted by chalsall View Post
Please define "thing", in this context.

Edit: Not trying to be an *, but the word "thing" can mean many different things in and out of context. Some use it to cover the fact they can't communicate well. I believe you can, so please clarify.

The thing comes from outer space :-)


More seriously, the thing is "what you said".

Last fiddled with by SELROC on 2018-09-16 at 04:51
  Reply With Quote
Old 2018-09-17, 08:09   #10
SELROC
 

22·33·23 Posts
Default

Quote:
Originally Posted by SELROC View Post
A true test would need a specific lab setup which I don't have. The current program reads packets and if there are incomplete packets, it increments some counter (COP and ROP).

I studied the problem a bit more. The specific problem is that bad frames are dropped in driver and do not make it to layer 2. This method would require modifying the network driver to make it ignore bad frames and pass them to upper layers.


So I will have to adopt another method, probably based on some data acquisition device.
  Reply With Quote
Old 2018-09-17, 17:08   #11
SELROC
 

6,073 Posts
Default

Quote:
Originally Posted by SELROC View Post
I studied the problem a bit more. The specific problem is that bad frames are dropped in driver and do not make it to layer 2. This method would require modifying the network driver to make it ignore bad frames and pass them to upper layers.

Even worse, the crc checking is sometimes off-loaded to hardware (NIC), in this case the only possible thing to do is modify the NIC bios.
  Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
GPU LLR program jasong GPU Computing 19 2011-08-23 03:32
So you think you can program rogue Lounge 5 2009-10-02 15:02
Program Primeinator Information & Answers 5 2009-07-16 21:42
Program for GPU tribal Information & Answers 5 2009-03-19 20:54
which program? drakkar67 Prime Sierpinski Project 14 2005-11-29 06:25

All times are UTC. The time now is 08:58.


Sat Jul 17 08:58:09 UTC 2021 up 50 days, 6:45, 1 user, load averages: 1.55, 1.54, 1.45

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.