Skip to content
New issue

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

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

Already on GitHub? # to your account

Awkward FCfield API #4628

Open
redfast00 opened this issue Jan 3, 2025 · 2 comments
Open

Awkward FCfield API #4628

redfast00 opened this issue Jan 3, 2025 · 2 comments

Comments

@redfast00
Copy link

Brief description

How am I meant to access the to-DS field in a Dot11.FCfield in a Pythonic way? I can access for example the retry field by using fcfield.retry, but of course, fcfield.to-DS is not valid syntax. getattr(fcfield, 'to-DS') and the same with setattr works, but is very ugly. Is there a better way to read/set this bit field?

Scapy version

2.6.1

Python version

3.13.1

Operating system

Linux 6.12.6

Additional environment information

No response

How to reproduce

/

Actual result

No response

Expected result

No response

Related resources

No response

@gpotter2
Copy link
Member

gpotter2 commented Jan 3, 2025

That's a bit crappy, you are right.
I believe that you can do

if 'to-DS' in pkt.FCfield

but we probably should look into renaming this.

@redfast00
Copy link
Author

Good that this will be renamed :) This is not the only 'impossible' field name in the codebase, so maybe it makes sense to check the names at runtime with a regex?

Another issue I have is setting the value, but I'm using setattr in the meantime.

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

No branches or pull requests

2 participants