3 Replies Latest reply on Jun 25, 2015 11:47 AM by gdmill55

    Advertising packet sniffer with Intel Edison?

    haxor

      Hello,

       

      in a company I am currently working on an application which will involve several Bluetooth 4 devices working as beacons. No connection or bonding, just sending advertisment packets. I would love to use Edison as a receiver because of the integrated WiFi capabiilty. Is there any example of Edison as a BT 4.0 packet sniffer? I have been experimenting with BlueZ and Noble + its NodeJS examples.

       

      My custom beacons are based on nRF51422. I managed to discover those beacons and even show the full advertisment data, as shown here (Manufacturer data):

       

      peripheral discovered (f99c27f94f63):                                                                                                                                                             Name:                                                                                                                                                                                             undefined                                                                                                                                                                                 Services:

      []  

      Manufacturer data:

      "590002150212233445566778899aabbccddeeff0ababcdcdc3"



      However, this shows just once as the discover event was used. The MAJOR and MINOR two-byte fields ("ababcdcd" hexadecimal sequence in the Manufacturer data) of advertisment packets will get updated quite frequently and the beacon transmits this advertisment packet every 625 ms.


      So the Intel Edison is capable of reading these advertisment packets as shown above. I wonder if there is a possibility to make a simple "packet sniffer" which would continuously receive these packets and store them. The  Is there any event in Noble which I had overlooked and works like that? Or which functions of BlueZ or any other application should I choose to do this task?


      Thank you for your help.

      Best,

      Marek.

        • 1. Re: Advertising packet sniffer with Intel Edison?
          CMata_Intel

          Hi haxor

           

          I think you should be able to do this using Bluez and libpcap, you can upgrade it using this website;

           

          Take a look at these documents too:

                 Programming with pcap

                 the-tcpdump-group/libpcap · GitHub

           

          I haven't tried something like this before so let me know if this is useful for you.

           

          Regards;

          CMata

          • 2. Re: Advertising packet sniffer with Intel Edison?
            haxor

            Hello CMata,

             

            thank you for your prompt reply. Thanks for the tip with pcap, looks very interesting and I will try to implement it in future.

             

            I was experimenting with hcitool a little bit and I think I am on the right way. Now I am running the hcitool in background like this with an output to /dev/null:

             

            hcitool lescan --duplicates  1>/dev/null 2>&1

             

            And then, hcidump -raw and I get the raw advertisment packet data like this:

             

            > 04 3E 2A 02 01 03 01 63 4F F9 27 9C F9 1E 02 01 04 1A FF 59

              00 02 15 03 13 23 34 45 56 67 78 89 9A AB BC CD DE EF F0 AB

              AB CD CD C3 DB

            > 04 3E 2A 02 01 03 01 63 4F F9 27 9C F9 1E 02 01 04 1A FF 59

              00 02 15 03 13 23 34 45 56 67 78 89 9A AB BC CD DE EF F0 AB

              AB CD CD C3 DB

            > 04 3E 2A 02 01 03 01 63 4F F9 27 9C F9 1E 02 01 04 1A FF 59

              00 02 15 03 13 23 34 45 56 67 78 89 9A AB BC CD DE EF F0 AB

              AB CD CD C3 DA

            > 04 3E 2A 02 01 03 01 63 4F F9 27 9C F9 1E 02 01 04 1A FF 59

              00 02 15 03 13 23 34 45 56 67 78 89 9A AB BC CD DE EF F0 AB

              AB CD CD C3 DA

            > 04 3E 2A 02 01 03 01 63 4F F9 27 9C F9 1E 02 01 04 1A FF 59

              00 02 15 03 13 23 34 45 56 67 78 89 9A AB BC CD DE EF F0 AB

              AB CD CD C3 DA

             

            The 128bit UUIDs of all beacons will be known to the Edison and the control byte of 3 payload bytes of MAJOR and MINOR data in advertisment packet will be somehow "salted" using the UUID so there will be a very little chance of conflict with other devices.

            Now, I will try to implement gathering this data with a NodeJS or Python script. This should be quite easy task.

             

            I will leave another Edison unit running this setup for 12 hours to see if this solution is stable or not. We require this application to run for at least 14 days without hang.

            Quite tricky after all, I do with various microcontrollers for a good 8 years and now, with almost zero experience with Linux, I have those problems with quite easy task using Intel Edison. Completely different worlds :-).

            • 3. Re: Advertising packet sniffer with Intel Edison?
              gdmill55

              Haxor,

               

              If you want your Edison to continuously search for advertisement packets (i.e. more than once) using the noble library, you will have to change

               

              noble.startScanning();

              to

              noble.startScanning([], true);          //those are two brackets facing each other [ ] but without a space of course

               

              In your script so that duplicate scanning is enabled.

              1 of 1 people found this helpful