Giter VIP home page Giter VIP logo

Comments (3)

dpsi avatar dpsi commented on July 28, 2024 1

I am working on an embedded systems project for school and essentially I want to passively capture the BLE packets. I am really only interested in the metadata, so things like frame headers and MAC addresses. Is btlejack the right tool for this?

from btlejack.

dpsi avatar dpsi commented on July 28, 2024

I managed to sort of hack it to output. Not sure why the output is never passed to CLIAccessAddressSniffer. I don't know much about python either.

I'm not sure where to get the Access Address, so I used a constant of 1 for now.
So I am at least getting some output. Not sure how to get the rest of the data, any suggestions on where to plug into?

diff --git a/btlejack/__init__.py b/btlejack/__init__.py
index 185f21a..bffbe55 100755
--- a/btlejack/__init__.py
+++ b/btlejack/__init__.py
@@ -260,7 +261,7 @@ def main():
 
     if args.scan_aa:
         try:
-            supervisor = CLIAccessAddressSniffer(verbose=args.verbose, devices=args.devices)
+            supervisor = CLIAccessAddressSniffer(verbose=args.verbose, devices=args.devices, output=output)
         except DeviceError as error:
             print('[!] Please connect a compatible Micro:Bit in order to use BtleJack')
             sys.exit(-1)
diff --git a/btlejack/supervisors.py b/btlejack/supervisors.py
index 61b3d3f..f7ba4b5 100755
--- a/btlejack/supervisors.py
+++ b/btlejack/supervisors.py
@@ -99,6 +99,7 @@ class AccessAddressSniffer(Supervisor):
         self.interface.scan_access_addresses()
 
     def on_packet_received(self, packet):
+        self.on_ll_packet(packet)
         """
         Dispatch received packets.
         """
diff --git a/btlejack/ui.py b/btlejack/ui.py
index 1f8820f..d500e7d 100755
--- a/btlejack/ui.py
+++ b/btlejack/ui.py
@@ -346,9 +346,22 @@ class CLIAccessAddressSniffer(AccessAddressSniffer):
 
     def on_ll_packet(self, packet):
         """
-        Called when a BLE LL packet is captured.
+        A BLE LL packet has been captured.
         """
-        pass
+        timestamp = time()
+        ts_sec = int(timestamp)
+        ts_usec = int((timestamp - ts_sec)*1000000)
+        if self.output is not None:
+
+            # Is it a Nordic Tap output format ?
+            if isinstance(self.output, PcapNordicTapWriter) or isinstance(self.output, PcapBlePHDRWriter):
+                self.output.write_packet(ts_sec, ts_usec, 1, packet.data)
+            else:
+                self.output.write_packet(ts_sec, ts_usec, 1, packet.data[10:])
+
+        pkt_hex = ' '.join(['%02x' % c for c in packet.data[10:]])
+        print('LL Data: ' + pkt_hex)
+
 
     def on_verbose(self, packet):
         """

from btlejack.

virtualabs avatar virtualabs commented on July 28, 2024

Oh, I see. There is no capture during access address discovery (-s option), only while following an existing connection (-f or -c options). During the connection discovery process, btlejack does not capture and decode BLE packets but instead only focuses on the first bytes of every packet received.

This is a statistical attack aiming at identifying every access address used by packets sent in the air, and only that. No way it will capture data during this step (and that would be useless as we don't know how to check CRC since CRCInit has not been recovered yet, without mentionning channel hopping and sync as well ...)

from btlejack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.