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

Str*EnumField parses into bytes, not str #4556

Open
douniwan5788 opened this issue Oct 5, 2024 · 0 comments
Open

Str*EnumField parses into bytes, not str #4556

douniwan5788 opened this issue Oct 5, 2024 · 0 comments
Labels

Comments

@douniwan5788
Copy link

douniwan5788 commented Oct 5, 2024

Brief description

The ref_id field of scapy.layers.ntp.NTPHeader utilizes a dict with str keys, leading to an enum mismatch

Scapy version

2.6.0

Python version

all

Operating system

all

Additional environment information

No response

How to reproduce

from scapy.layers.ntp import NTPHeader

NTPHeader(
    bytes.fromhex("1a010af0000000000000001547505300c50204e639372a38c50204eceed33c52c50204ebd63b7952c50204ebd63d1cc1")
).show2()

Actual result

###[ NTPHeader ]###
  leap      = no warning
  version   = 3
  mode      = symmetric passive
  stratum   = 1
  poll      = 10
  precision = -16
  delay     = 0
  dispersion= 0.0003204
  ref_id    = b'GPS'
  ref       = Mon, 27 Sep 2004 03:17:58 +0000
  orig      = Mon, 27 Sep 2004 03:18:04 +0000
  recv      = Mon, 27 Sep 2004 03:18:03 +0000
  sent      = Mon, 27 Sep 2004 03:18:03 +0000

Expected result

###[ NTPHeader ]###
  leap      = no warning
  version   = 3
  mode      = symmetric passive
  stratum   = 1
  poll      = 10
  precision = -16
  delay     = 0
  dispersion= 0.0003204
  ref_id    = b'GPS' (Global Position System)
  ref       = Mon, 27 Sep 2004 03:17:58 +0000
  orig      = Mon, 27 Sep 2004 03:18:04 +0000
  recv      = Mon, 27 Sep 2004 03:18:03 +0000
  sent      = Mon, 27 Sep 2004 03:18:03 +0000

Related resources

No response

@gpotter2 gpotter2 added the bug label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants