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

Unify test packet payload and allow for manual control #167

Open
sborkows opened this issue Jan 4, 2022 · 1 comment
Open

Unify test packet payload and allow for manual control #167

sborkows opened this issue Jan 4, 2022 · 1 comment

Comments

@sborkows
Copy link
Contributor

sborkows commented Jan 4, 2022

PTF provides a lot of very convenient functions to form test packets (simple_*_packet())

One thing that they do not allow is specifying the actual payload. Not only that, different functions use different payload for whatever reason.

For example, simple_tcp_packet uses:

pkt = pkt / codecs.decode("".join(["%02x" % (x % 256) for x in range(pktlen - len(pkt))]), "hex")

whereas simple_tcpv6_packet uses:

pkt /= "D" * (pktlen - len(pkt))

This makes direct comparisons a little difficult.

Here are two things which can changed:

  • Use the same payload across all functions (if applicable)
  • Add "payload" parameter so that the user can specify it manually
@NexSabre
Copy link
Contributor

NexSabre commented Jan 8, 2022

Good idea 👍 The code of the testutils.py is in many places redundant. In the beginning, we can extract a "payload method", and standardize it.

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

No branches or pull requests

2 participants