Fixing readme for Python3 and adding requirements

This commit is contained in:
Sébastien Dudek 2023-03-10 01:40:37 +01:00
parent 50e12c4b8d
commit 8fba4bba40
3 changed files with 4 additions and 1 deletions

View File

@ -103,7 +103,7 @@ As an example, to check if the key `000102030405060708090A0B0C0D0E0F` is used to
>>> pkt = LoRa(binascii.unhexlify(p))
>>> pkt
<LoRa Preamble=0x0 PHDR=0x0 PHDR_CRC=0x0 MType=Join-request RFU=0 Major=0 Join_Request_Field=[<Join_Request AppEUI='lovecafe' DevEUI='meeetoo' DevNonce=26985 |>] MIC=0x53024c49 |>
>>> checkMIC(binascii.unhexlify(key), str(pkt))
>>> checkMIC(binascii.unhexlify(key), bytes(pkt))
True
```

View File

@ -63,6 +63,7 @@ def checkMIC(key, hexpkt, direction=1):
except Exception:
mic = binascii.hexlify(mic)
cmic = bytes(getPHY_CMAC(key, hexpkt), 'utf-8')
print (repr(mic), repr(cmic))
return (mic == cmic)
# TODO: more helpers

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
pycryptodome
scapy