Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can PcapPlusPlus support custom resolution to a specific protocol type based on the port number? Rather than according to the default RFC port definition. #671

Open
angelyouyou opened this issue Jun 19, 2021 · 3 comments

Comments

@angelyouyou
Copy link

In many cases, the protocol can customize or specify the port number instead of using the fixed allocation on the RFC. After I read the code of the TCP and UDP layer of PcapPlusPlus, I found that PcapPlusPlus is always recognized based on the default port number on the RFC. This is not flexible enough and scalability is not strong in many application scenarios. Do we have plans to add this kind of custom parsing in the future? If a custom parsing method is specified in the configuration file, the custom method will be used first, otherwise The default RFC-based port is still used for resolution.

@seladb
Copy link
Owner

seladb commented Jun 19, 2021

yes, this request has been discussed before here: #644. Right now it's not supported but if you want you're more than welcome to implement this feature. We can discuss what's the best way to do it.

@angelyouyou
Copy link
Author

angelyouyou commented Jun 19, 2021

yes, this request has been discussed before here: #644. Right now it's not supported but if you want you're more than welcome to implement this feature. We can discuss what's the best way to do it.

I think we can add a configuration file to re-define the protocol recognization.Like the wireshark, it can specify the port of the protocol to recognize.
It is not difficult to implement, but very useful in many cases.I'd like to implement it.

Which directory or file can I add the configuration file and parse json file?

@seladb
Copy link
Owner

seladb commented Jun 22, 2021

This can be a good addition to this project. This is just for configuring ports, is that correct?
I think we can let the user choose the location of the file. It can be in json format as you mentioned.
Please note that this will require a change in the existing layers to be able to read the data from the file as well, for example:

You basically need to:

  • Read the file if exists and load it to some class in memory - we can probably keep a map between the protocol type and the custom ports
  • Modify each layer to look at this map and return all the relevant ports - both the default ones and the ports in this map

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants