Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commit of the following stuff #55

Open
wants to merge 6 commits into
base: python3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,226 changes: 0 additions & 2,226 deletions RFIDIOt.py.orig

This file was deleted.

2 changes: 2 additions & 0 deletions RFIDIOtconfig.None
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-R READER_NONE -n
# for running code validation tests
73 changes: 72 additions & 1 deletion Run_Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#pylint: disable=import-outside-toplevel

import os
import sys


Expand Down Expand Up @@ -174,6 +175,25 @@ def test_conversion_functions() -> bool:
# ('HexNibbleReverse:', '8844cc55dd33bbff')
# 112233AABBCCDDFF


in_val = '\x01\x0A\x08'
out_val = b'\x80P\x10'
dat = rfi.BitReverse(in_val)
if dat != out_val:
print("BitReverse: str Test Fail")
print(f"\t{dat} != {out_val}")
return_val = False


in_val = b'\x01\x0A\x08'
# out_val = b'\x16\xaf\x86'
dat = rfi.BitReverse(in_val)
if dat != out_val:
print("BitReverse: byte Test Fail")
print(f"\t{dat} != {out_val}")
return_val = False


if return_val:
print("Conversion Functions: Test Pass")

Expand Down Expand Up @@ -286,6 +306,49 @@ def test_get_error_str() -> bool:

return False

def test_crc_functions():

return_val = True

in_val = b"The quick brown fox jumps over the lazy dog"
out_val = 41437
dat = rfi.crc(10, in_val)
if dat != out_val:
print("crc: byte Test Fail")
print(f"\t{dat} != {out_val}")
return_val = False

in_val = "The quick brown fox jumps over the lazy dog"
out_val = 41437
dat = rfi.crc(10, in_val)
if dat != out_val:
print("crc: str Test Fail")
print(f"\t{dat} != {out_val}")
return_val = False


in_val = "The quick brown fox jumps over the lazy dog"
out_val = 64735
dat = rfi.crc16(in_val)
if dat != out_val:
print("crc16: str Test Fail")
print(f"\t{dat} != {out_val}")
return_val = False

in_val = b"The quick brown fox jumps over the lazy dog"
out_val = 64735
dat = rfi.crc16(in_val)
if dat != out_val:
print("crc16: byte Test Fail")
print(f"\t{dat} != {out_val}")
return_val = False

if return_val:
print("crc Functions: Test Pass")

return return_val


def test_rfidiot_lib() -> bool:

test_get_error_str()
Expand All @@ -298,6 +361,10 @@ def test_rfidiot_lib() -> bool:

test_crypto_functions()

print()

test_crc_functions()

def text_aid_lookup() -> bool:
try:
from AID_lookup import AID_Lookup
Expand Down Expand Up @@ -332,7 +399,11 @@ def text_aid_lookup() -> bool:

text_aid_lookup()

sys.argv.append('-n')
# sys.argv.append('-n')
# sys.argv.append('-R')
# sys.argv.append('READER_NONE')
os.environ["RFIDIOtconfig_opts"] = "RFIDIOtconfig.None"

import rfidiot
rfi = rfidiot.card

Expand Down
Binary file not shown.
80 changes: 80 additions & 0 deletions Test_data/Mf1k_4b-FF-keys.mct
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
+Sector: 0
0123456700080400FFFFFFFFFFFFFFFF
00000000000000000000000000000000
00000000000000000000000000000000
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 1
11111111111111111111111111111111
11111111111111111111111111111111
11111111111111111111111111111111
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 2
22222222222222222222222222222222
22222222222222222222222222222222
22222222222222222222222222222222
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 3
33333333333333333333333333333333
33333333333333333333333333333333
33333333333333333333333333333333
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 4
44444444444444444444444444444444
44444444444444444444444444444444
44444444444444444444444444444444
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 5
55555555555555555555555555555555
55555555555555555555555555555555
55555555555555555555555555555555
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 6
66666666666666666666666666666666
66666666666666666666666666666666
66666666666666666666666666666666
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 7
77777777777777777777777777777777
77777777777777777777777777777777
77777777777777777777777777777777
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 8
88888888888888888888888888888888
88888888888888888888888888888888
88888888888888888888888888888888
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 9
99999999999999999999999999999999
99999999999999999999999999999999
99999999999999999999999999999999
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 10
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 11
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 12
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 13
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 14
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 15
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
77 changes: 77 additions & 0 deletions Test_data/Mf1k_4b-FF-keys.nfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
Filetype: Flipper NFC device
Version: 4
# Device type can be ISO14443-3A, ISO14443-3B, ISO14443-4A, ISO14443-4B, ISO15693-3, FeliCa, NTAG/Ultralight, Mifare Classic, Mifare Plus, Mifare DESFire, SLIX, ST25TB, EMV
Device type: Mifare Classic
# UID is common for all formats
UID: 01 23 45 67
# ISO14443-3A specific data
ATQA: 00 04
SAK: 08
# Mifare Classic specific data
Mifare Classic type: 1K
Data format version: 2
# Mifare Classic blocks, '??' means unknown data
Block 0: 01 23 45 67 00 08 04 00 FF FF FF FF FF FF FF FF
Block 1: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 2: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Block 3: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 4: 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
Block 5: 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
Block 6: 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
Block 7: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 8: 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22
Block 9: 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22
Block 10: 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22
Block 11: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 12: 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
Block 13: 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
Block 14: 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
Block 15: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 16: 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44
Block 17: 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44
Block 18: 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44
Block 19: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 20: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55
Block 21: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55
Block 22: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55
Block 23: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 24: 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66
Block 25: 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66
Block 26: 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66
Block 27: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 28: 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77
Block 29: 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77
Block 30: 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77
Block 31: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 32: 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
Block 33: 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
Block 34: 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
Block 35: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 36: 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99
Block 37: 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99
Block 38: 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99
Block 39: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 40: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
Block 41: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
Block 42: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
Block 43: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 44: BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB
Block 45: BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB
Block 46: BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB BB
Block 47: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 48: CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC
Block 49: CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC
Block 50: CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC
Block 51: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 52: DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD
Block 53: DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD
Block 54: DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD
Block 55: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 56: EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE
Block 57: EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE
Block 58: EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE
Block 59: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Block 60: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
Block 61: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
Block 62: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
Block 63: FF FF FF FF FF FF FF 07 80 69 FF FF FF FF FF FF
Binary file added Test_data/Mf1k_4b-Mixed-Pi.bin
Binary file not shown.
80 changes: 80 additions & 0 deletions Test_data/Mf1k_4b-Mixed-Pi.mct
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
+Sector: 0
314159260F080400FFFFFFFFFFFFFFFF
00000000000000000000000000000000
00000000000000000000000000000000
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 1
11111111111111111111111111111111
11111111111111111111111111111111
11111111111111111111111111111111
A0A1A2A3A4A5FF078069111111111111
+Sector: 2
22222222222222222222222222222222
22222222222222222222222222222222
22222222222222222222222222222222
222222222222FF078069B0B1B2B3B4B5
+Sector: 3
33333333333333333333333333333333
33333333333333333333333333333333
33333333333333333333333333333333
ABCDEF012345FF078069543210FEDCBA
+Sector: 4
44444444444444444444444444444444
44444444444444444444444444444444
44444444444444444444444444444444
4D3A99C351DDFF078069444444444444
+Sector: 5
55555555555555555555555555555555
55555555555555555555555555555555
55555555555555555555555555555555
555555555555FF0780691A982C7E459A
+Sector: 6
66666666666666666666666666666666
66666666666666666666666666666666
66666666666666666666666666666666
D3F7D3F7D3F7FF078069666666666666
+Sector: 7
77777777777777777777777777777777
77777777777777777777777777777777
77777777777777777777777777777777
AABBCCDDEEFFFF078069777777777777
+Sector: 8
88888888888888888888888888888888
88888888888888888888888888888888
88888888888888888888888888888888
888888888888FF078069A0A1A2A3A4A5
+Sector: 9
99999999999999999999999999999999
99999999999999999999999999999999
99999999999999999999999999999999
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 10
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 11
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 12
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 13
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 14
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
FFFFFFFFFFFFFF078069FFFFFFFFFFFF
+Sector: 15
31415926535897932384626433832795
02884197169399375105820974944592
30781640628620899862803482534211
314159265358FF078069853562951413
Loading