riverloopsec / killerbee

IEEE 802.15.4/ZigBee Security Research Toolkit
http://www.riverloopsecurity.com
Other
742 stars 215 forks source link

zbassocflood TypeError: sequence item 0: expected a bytes-like object, str found #259

Closed southzyzy closed 2 years ago

southzyzy commented 2 years ago

I have tired to perform zbassocflood on the Api-Mote v4 Beta and encounter the following error by following the -h example provided.

image

I narrow down the issue to which the input of the PANID is converted to bytes from line 129-132:

image

This causes an issue at line 153, where it is trying to combine all the items in the list to bytes-like object: assocreqinj = b''.join(assocreqp)

My Python version is currently Python 3.8.10.

southzyzy commented 2 years ago

Manage to find a solve this issue:

  1. The first issue is that the list contains certain < strs > and < bytes >, which result in the failure of the script. The workaround is first: Adding the str() to convert the dstpanid to a string first. image
  2. Then remove the b when joining the packet contents together: image
  3. The script is now able to run normally: image

Note: In an event where the kb.inject() fails, the error is implying that a str is pass into the list(bytearray()) and that its encoding must be specified. This requires you to add the encoding type, which in my case that worked for me, is to add encoding='utf-8' into the dev_apimote.py file, line 184:

image