Send 802.11 frame

499 views
Skip to first unread message

Brostoni

unread,
Oct 10, 2014, 3:46:11 PM10/10/14
to lib...@googlegroups.com
Hi

I am trying to send 802.11 frames, but I couldn’t manage to see them in other computers (using wireshark).

The following code is based in some of examples.


Both computers have Debian installed.



#include <unistd.h>
#include <cstdlib>
#include <iostream>
#include <string>
#include <tins/tins.h>

using namespace std;
using namespace Tins;




int main(int argc, char** argv) {
    Dot11Beacon beacon;
    beacon.addr1(Dot11::BROADCAST);
    beacon.addr2("00:01:02:03:04:05");
    beacon.addr3(beacon.addr2());
    beacon.ssid("libtins");
    beacon.ds_parameter_set(8);
    beacon.supported_rates({1.0f, 5.5f, 11.0f});
    beacon.rsn_information(RSNInformation::wpa2_psk());
    
    PacketSender sender;
    sender.send(beacon, "wlan0");


   
    return 0;
}


Thank you in advance.

Matias Fontanini

unread,
Oct 10, 2014, 3:48:16 PM10/10/14
to lib...@googlegroups.com
Sending 802.11 frames requires a bit of information about the environment. First of all, is wlan0 in monitor mode? If so, does your interface use RadioTap encapsulation?  Because if it does, then you'll have to add a RadioTap header.
Message has been deleted

Matias Fontanini

unread,
Oct 10, 2014, 4:11:56 PM10/10/14
to lib...@googlegroups.com
Great! It was very likely that the problem was one of those two.

On Friday, October 10, 2014 5:06:15 PM UTC-3, Brostoni wrote:

I added the radioTap encapsulation and it worked.

 

Thank for your (very) fast answer and great library.



    Dot11Beacon beacon;
   beacon.addr1(Dot11::BROADCAST);
   beacon.addr2("64:66:b3:1a:db:29");
   beacon.addr3(beacon.addr2());
   beacon.ssid("test");
   beacon.ds_parameter_set(8);
   beacon.supported_rates({1.0f, 5.5f, 11.0f});
   beacon.rsn_information(RSNInformation::wpa2_psk());
   RadioTap radio = RadioTap() / beacon;
   PacketSender sender;
   sender.send( radio, "wlan0");

Nir Rattner

unread,
Nov 26, 2014, 5:18:06 PM11/26/14
to lib...@googlegroups.com
Hi, I am facing the same issue using a MacBook Pro. Even after including the RadioTap header, no packets appear to be sent according to WireShark on another machine. I recognize the OS and drivers are different, but is there something I'm doing wrong that I can fix?

Matias Fontanini

unread,
Nov 26, 2014, 5:32:15 PM11/26/14
to lib...@googlegroups.com
Is the interface you are trying to use in monitor mode?

Nir Rattner

unread,
Nov 30, 2014, 8:12:14 PM11/30/14
to lib...@googlegroups.com
Originally I tried without monitor mode. Now I tried again both using and not using monitor mode, and neither worked.
Reply all
Reply to author
Forward
0 new messages