secdev / scapy

Scapy: the Python-based interactive packet manipulation program & library.
https://scapy.net
GNU General Public License v2.0
10.78k stars 2.03k forks source link

Graph Library and Algorithms #2504

Closed polybassa closed 4 years ago

polybassa commented 4 years ago

Hi, I'm currently working on a scanner for ECUs and entire vehicles with Scapy. I need to build a graph and apply a Dijkstra algorithm on it, to get some shortest pathes.

On my current working branch, I've added some random implementation to my code https://github.com/polybassa/scapy-1/blob/ffc1f3d570d30ae2055bdcd3d56d6728bf49c2c5/scapy/contrib/automotive/enumerator.py#L17-L76 .

What would be the proper way for Scapy to use a graph and algorithms for it? Should I search for a existing library, should I add this code to my files, where I use it, or should I add this code to a file like scapy/utils.py?

Thanks for your help!

guedou commented 4 years ago

I am OK to integrate the code as it is, in enumerator.py. networkx is a good Python module to perform graph analysis but it might be to heavy for you needs.

If you could add some unit tests for your Graph object, that will be awesome.