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

Problen referencing a field in the HTTP headers #7

Closed
omribentov opened this issue Jul 23, 2014 · 2 comments
Closed

Problen referencing a field in the HTTP headers #7

omribentov opened this issue Jul 23, 2014 · 2 comments

Comments

@omribentov
Copy link

Hi,

I'm trying to user scapy_http, but I have a problem of referncing fields that have a "-" in them.

So doing something like pkt[HTTPRequest].Host is OK, but pkt[HTTPRequest].User-Agent is not.

I saw that in Steeve Barbeau's original code he used different lists for the fields_rfc(e.g. User-Agent) and the fields_desc(UserAgent), thus allowing to reference the user agent by pkt[HTTPRequest].UserAgent.

Is there a way to do something like this ???

Tnx,

Omri

@invernizzi
Copy link
Owner

Hi Omri,
I've decided to go for 'User-Agent' (because I expect it to be written that way :) ). This choice does have this drawback, but it's easily fixed like so:

print pkt[HTTPRequest].fields['User-Agent']

prints out

'Wget/1.13.4 (linux-gnu)'

@omribentov
Copy link
Author

Thanks, I didn't know the syntax.

On Wed, Jul 23, 2014 at 1:14 PM, Luca Invernizzi notifications@github.com
wrote:

Hi Omri,
I've decided to go for 'User-Agent' (because I expect it to be written
that way :) ). This choice does have this drawback, but it's easily fixed
like so:

print pkt[HTTPRequest].fields['User-Agent']

prints out

'Wget/1.13.4 (linux-gnu)'


Reply to this email directly or view it on GitHub
#7 (comment).

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