Skip to content

HackRF issue Sniffing ZigBee #36

Description

@alphafox02

On 22.04 Ubuntu w/ Mirage and latest hackRF firmware as of this date, I see the following when trying to run ZigBee Sniff on a known transmitting channel

Exception in thread Thread-14 (run):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/src/mirage_extension/mirage/libs/common/sdr/demodulators.py", line 152, in run
    self.generateOutput(demodulatedBlock,iqBlock)
  File "/usr/src/mirage_extension/mirage/libs/common/sdr/demodulators.py", line 65, in generateOutput
    demodulatedData,iqSamples = d.decode(demodulatedData, iqSamples)
  File "/usr/src/mirage_extension/mirage/libs/zigbee_utils/decoders.py", line 41, in decode
    newIqSamples = iqSamples[:self.samplesBefore+self.samplesPerSymbol*(len(demodulatedData[:endOfFrame]))+self.samplesPerSymbol+self.samplesAfter]
UnboundLocalError: local variable 'endOfFrame' referenced before assignment

After making this change to decoders.py I no longer the the error, but I'm not sure if this is a correct way to fix the issue. It does not seem like I'm getting the results that I do get when sniffing zigbee with the hackrf and gr-802.15.4. I modified the loop to iterate with a step size of 31 instead of 32

for i in range(0, len(demodulatedData), 31):
    value, hamming = checkBestMatch(demodulatedData[i:i+31])
    if hamming > self.hammingThresold:
        endOfFrame = i-1
        break
    else:
        zigbeeFrame += value

newIqSamples = iqSamples[:self.samplesBefore + self.samplesPerSymbol * len(demodulatedData[:endOfFrame+1]) + self.samplesPerSymbol + self.samplesAfter]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions