mfontanini / libtins

High-level, multiplatform C++ network packet sniffing and crafting library.
http://libtins.github.io/
BSD 2-Clause "Simplified" License
1.91k stars 377 forks source link

Unable to set capability_information on a Dot11ProbeResponse #128

Closed derekpanderson closed 8 years ago

derekpanderson commented 8 years ago

I need to set the values for capability_information on an 802.11 probe response. The functions seem to be present for a Dot11ManagementFrame. Is there a way to set the parameters like ess short preamble and so on? Currently they are all set to 0 when I send out a Dot11ProbeResponse using a PacketSender to send the traffic. screenshot_021616_024714_pm

mfontanini commented 8 years ago

I think if you do this, it should work:

Dot11ProbeResponse response;
Dot11ProbeResponse::capability_information& capability = response.capabilities();
capability.short_preamble(true);
capability.ess(true);
// ....
derekpanderson commented 8 years ago

Awesome that worked perfectly.

One other thing I ran into(Let me know if it should be a new issue) In src/dot11/dot11_mgmt.cpp if a probe request is sent from a client without a SSID set you return the string "BROADCAST". But BROADCAST can be a valid SSID name, e.g like my neighbour had set. I changed it to return "" to mimic what scapy returns.

mfontanini commented 8 years ago

Hmmm I wonder why it wasn't that way in the first place. Is there no other case that you know of where the SSID can be a present and have length 0?

mfontanini commented 8 years ago

Actually, that shouldn't matter. If the SSID has length 0, then it should be an empty string. I'll push a fix for this later today. Thanks!

derekpanderson commented 8 years ago

I have seen some clients send out a ' ' in the ssid field when probing. In that case scapy returnes a ' '.

mfontanini commented 8 years ago

Okay I just pushed a fix. If you find any other issues, please let me know

derekpanderson commented 8 years ago

Seems to work fine. Thanks for the fast response!