SubGhz: add keeloq potocol JCM_Tech (#1939)

* SubGhz: add keeloq potocol  JCM_Tech
* SubGhz: add new metod decoder

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Skorpionm 2022-10-28 18:31:41 +04:00 committed by GitHub
parent 3434305630
commit 9cd0592aaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 117 additions and 48 deletions

View file

@ -1,50 +1,55 @@
Filetype: Flipper SubGhz Keystore File
Version: 0
Encryption: 1
IV: 2A 34 F1 5A AF 6F F5 1A 83 A6 1E DA DE B7 3D F1
06B63DF24AE073A2F2B19C55CA9E8364FBECD26E49C551990153F6513BDE5267
6139C78C74C341EB7474085CF1D047BD6FB005F80A72AF3EF3F89D58EF5DF500
D85F11689020ECA47FBE9C2B67EE41A81E1F06DE2A35AF958965E3ECE29EA701
1AE9073A42FE0E439544FE6945F6B33CF15A7A4A279020B5E0B3BE33FD189A7E
E161F007854BB33E0056FA09A2E2DEE66789B5C87C8D6D3DE2C8C1BD2B48983EB9D1C5697CA6E95996918F7C47B761B0
59AE4644DCB3D720C38B5115F230DA58E7BE0A697907F6174BB05AB7886ACDB1
634DF0BCC185C4C1F7E1B1594B4438D051ABAE092433078963063B51D961D08C
1EBEBCB49E498B9BE977D53EC21B9A546155B627737BD0AA832D496035729346
4DFA93E639197772D57E8ACE04512CEFC045B8CC965C175A25ED525B630CBB63
C2D5235D1014A319B249EAE8A5EE350F18D5AB8A498EF222704BD4EB1435F388
F66D1937160E1392197F463A52E87FCE938A92070892113443C348D7553327A5715CF615CE2F2C96284F47759E043419
841D29E7CBE040188E2283BFBA9F26EF2F65CCB085B56C3515E8C46C3F20BD75BAA963550869435FDAF509CEEE66A2C4
7D87E24487D307635E7A17B989B8547EE11F3BF3468D055F0B44633B631BA42C
B4916043973501B95A82B329196D6EBA69FBBC3AF8FD914583104E0E18CE82F6
E4649F9C2A5465D2EA6F3E9724DD06CD6962FE2BAEB14F1453C14D1559232AE1
96E15D890DF7FD348441F5E429A875754C6BF0520A787F8E9D8C5415674783CC
CB52005EDED47B57F795BC92FB0522EAB18D23EE028B8D10ED57828C250EB285BFEC6E4A4BE8DABCE0D57ECAA20D90C3
8E5A50C7D5C374445E88752301D20F0B3D6E4988B61D90FD63779B0EDEF9C60D
49D6CB276A0E5FF134A38062503F01351F44CD6455708B50B5F07D03FC477C33
CB45B56613DF208E79E4E10A6510F07DC1AA49210C7B94E8BBAECD2C35EC6ABC99FB10FD7C96DD6BB6A6685E9FAD93FB
0743F3CC51200F763C242F1956B4D775C092ADF1A5C19ACAE96EB60C2990CF214F8FEA8FC6749286F6BDAB67657C479A
E5608B28A058787D64A145F0362DEFD98CAE0B5A0F22C6DA7C6D278C7B5F95E3
D4C113D43E7FB6D2EFA9E87471AA76A61B26872607B4AF5B87F9D72113835CE6
2DC502800BFD21B76126390CA64A08C5432A2254E822F214CDE1EA11430084C5
CA22C73010B0F1CB8009601BE2AF0B3674D83D5880E4A26C2A3FF0EA0A098CEA
E53B2B102FDB000E9BB747F957156976E5A0C0E3898AA844C13AE8A9CEE7013B
95CF1A46FFC252BE92919531C92BF6A3AA1B16C170DF4461EC54BE07A55C2387
2EC7E24090F6DFFF6F2F2D8874D2F36AA769995F31F29FBE3B0EA6A16C3EE833
C1145B1D9AC70761EA902B86455C1BE1BB1153552A1F7327411DECABE538827B
18D596CADD2EE544200A58716C7A4690B658E58CC2B97334740F70894A6C90FA
6A2F8859DFF01E13AC6C5300AD4A2218810FC91A6FB64A560E99FE6C99226AD2
48D2EB5A08E35AF89A3B7A1CFDEE829FC0C2DDD2E965F4E3D043B0B14CB7825E
91039325D53CDD0236D1CD13047973A013C14B45A32DE0784A73BFABCEAFBCD1
51B4EAC87C4DC49B007F40D38B8166C388A1AF25E8D2FF6598E8EDE8726E6E14AD88443114D2A0F5E7721E304F3870DA
3A179DDF65B9868CD84C7C04931F40D5D204C97B20DCBF1A70C241E59BFD7F14
AF538FD16104DCAF03F4DDF05026D6741898DFC247E48A8F72E652DDF2DFD289
E67F16AEC9D84B6C06F77B806CA6FBC7618BFBECD0D7A04EC3AE1D1DD06BEC5B
FA4D9F8920EBF2F4293C6D4E99083AA4A71A9DDFFDB07EEBDC552DACEC4DA24A
5BF23E630AC81E2CD533803E225BCB3C481B8D650A9858CF2B5219BAE1CDA01A
17B57E8C1032481E69247EA9A0C9EA41F6C0EA9B3F11170CA69C0842423F0455
96EA848B8527A647DC9DACDB16C5D92B0081EB1CD77B99B47F56C2E249190BD3BE4306333F37487133DD3AD8E57F3092
B0E9411274D799BE5989D52E74E00DE310CCA2BD47D7A8FA554D66BB04CD787A
D0D28476E3D8832975653D93F545C35278EC1F0B7AD70CA2F36EB476CC207937
933195E37014619F997B73F5CF4C0110865A822CA8CB0ED1D977D49A1B06A37F
E790CAC2A26452BF941A9E1BABF0A85598EA1CC8F8CFED637C9B40D5E027B518
49C1F179ABA5BD4F2C45257A33701730E9CC4728677EFF07808ABE31D3CE6FD5C805F43EA5ABB7261B220C82F0794092
IV: AA FF DE 54 A1 BB F1 21 83 46 FE 2A 1E B7 3D 33
95B8CD65BBAC95EACE67CA94F679B82877A921396D461ECB479722F8A369454A
61065C41297B9FF8F8168814F49A03D1FE7B4CB79DFFCBBF0402AAA6A2211E84
A1557AC139188FF105D1081A4B688C5CA440FB5DA7F40901B541120AD08A544F
AF0A6056D7F0D97DAD6C16C4E63204E4B3B1C5A20AC82B983B516F4F718EE29F
6861BFAE46A1AADB1DB2D6DFAA7E39D21D5B3E46A41BD50F4F2828879EB328EF0A406F2B9C79A031AB361257E6D69756
0DDB3DAC53678541981CC46C22CED245CBA314C9BBE1BA9383B8505B75AC5E40
99AB5D9404934F2D257ED04D9F8CCEE06D00F38157B121AFD63101E4E5C08268
5114A6C42B342C7D933A76F9052FF963C2047E85EA524497C21B4C35C38EF6E7
88CA2A1907D94B972FF93DBB9B88CB576F3E1BB0FE8F85A5B2CCA7D44B00374D
349C4153FE7CA8AE044E9F75F77D9694304474CE3F127CF968662B5F78A7F421
62AA02E20CA7E691EFC0B55CA41C9BDF889FB23868289284241CD31AA1A0E499AE2A770B6B5AB3170CDCCDB8A246D36C
97901B5EB76228ADF8E5073F1BAB1502878DEFF1C4EBF12A43D105556CB7E80F947A8BD7831666BD838C57CDF64A6F3F
B05959D210B500943A93BDFAF783D9DB215FC84503B152EAFBCFB5B6237E3888
B393DE4489BCAFD5DB80592A12E329E18913E185D2042580048029A8C4C3A257
B4B30492A5F0C3C763E2F43C02D1451A5B9CFB468CFE62BE85B1F56FF49DAB9A
CE5D57C0EE3D717FC717EB725970A9F25D211546EE7AC5C237950CEA323D85D4
4E9028944813FD40A17AF6DF5A97E76179B48EE79265BBD38B07E3A270587A813DADB51B3367479AC5644F754B5613F8
3B3C3000B9D1361711ECE3DB77C90A059576F738CB167679DA36DD3D128B27A1
997023148148DE7B9CBA47D3FD48DEF73AA1715FF4BC1E7A1DBA6D52A0DCB2C0
C8428D18E69FB92486434FCE470F1FF37D40507F27D824679C132A70D516530367277F02DDB5C464D03450FF6B425A24
3701200DF5DA7235971FD95844056E74C7D61A8EB12A8772E04F52037C63D50B6229A7F905F3E6F84C565FCC7632870C
BB392A464CDC0D5D923AA9EF8ECC3C6F020D0AD82165462DF0DE7C5025AAAAAC
999C82209B30638506E5D708471676D2CBB4A432E5AF86ABD61179111EDAE636
FDE2A452A6B47261338117EC20FC57731DA492562ECD21BBC61F098A5442CF20
D923BABB5C4DFB48E3F763898B2796C7830D3EE9A91DF904AC2223A0F4736507
0987DDAC695DD5E4607048DF1D4EF96599E17ED52F41785E676AA048AB7213FE
26CB3E6CFA10338A8DDD99BFF6957C53DEF435CB0FF977B71B5164ADFE11292A
097908FD07A0A093CA80E6FF59524707C1A11169D0CB6F8E4967D8DAA725FE7A
8C629E70A5CC6FCB039DFA1A6AC58CB7B7E92C85BDA66266AB49E6B1285FC7A6
39A2052350CD446EDC1B9AD0C2DD51C78B2E5F3A76AAD0EC200F74B40ACD4AC5
A1685CF8C4A5401F2CA0C8172CB5B4B5726C61CE68A72AE834B0A472CEB2F3DE
1F5ED5793DB381D1B501BA8A4DF3E74FB11FC1A922DDC8AE62E5BA8934C37EA8
D80EF661BF36E2F6C179E253CE5BC3732684ACBC7C65E526A628442A2EBF8FAA
7785BF721F21E19A8CFBFBBB56BD76B96A4E8EF9F8A2344009B14AB385909598F834A5533B648DA7D62BD6D4314A43A5
C8F6F943DE615B5827569B283577344C0455B3279C73634FC4E0E9A8088DF633
FB4F4C786FC51BBDA679A212B4A05EF120AC62F7EBFFE8263BD50A4D9BC9C6E0
16EEC35CF69BA86DB3BE999CDF9B39F5736F3727B2AA2C5AB9141A48F176D831
AD1AD6DE813E7710DA3AF546D4F9EA085831E6B3FA17B64F1B8765F48134EA54
345D743BC35B4A8614632ADD11E809C0D1E6C78F9469256B9A738DA0B648B2B8
7C876CECAC839EBB4609C3996966C3EC454F51C8ABCC51097E405370C4B6F086
0F857C031FD3047607647148C534F969567F207FF1691D8D06DCDF4C2514695D
EC0630EDC82241C1952F49B6B1B0C1A954A7DDD6BDB1326ACC54AD449D1BF985
286EF9F7FD0D09F2604CCE867C52144CD0C4773A3D8183066C61B8BF9860AE7C
EA55424097A08722A66966E3177E09DE91AC65175E5C68CB47B6153E6585DF85
D54FCDF9EA4BD1FE4F316DB6D5CE4A2675F2D0144772865EDC781FBA7DFD23E4
7A2F5C5CA9F97FE9527BAA760E64B930C407A27DE036476737E6BDD9422F4056A5F1F414F12F0982109FD7C30E8CC1CB
06BAD9B4EEEEB1BCF8C97672D271534FE84D772282EE9642698788D3842D7641
101C1B2DBD963E23777294C22E553D145D5B40838F91355CA86D571A0CEFF68F
1B148C2B502B3E0A5BD40858E019C513DD4CCAF2A114CBB29C59BFB018079285
8DF4D07EC20FF873EA989ACEF4AF96E9787FE6E0F71965858B4186C3AF302A31
2317DC8C098CD60F3467B3644A19CCE887339708820CD37F6F5277D6648F837512F70CE90E23D7339CDDE002BD8D83DB

View file

@ -529,6 +529,24 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
return 1;
}
break;
case KEELOQ_LEARNING_MAGIC_SERIAL_TYPE_2:
man = subghz_protocol_keeloq_common_magic_serial_type2_learning(
fix, manufacture_code->key);
decrypt = subghz_protocol_keeloq_common_decrypt(hop, man);
if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) {
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
return 1;
}
break;
case KEELOQ_LEARNING_MAGIC_SERIAL_TYPE_3:
man = subghz_protocol_keeloq_common_magic_serial_type3_learning(
fix, manufacture_code->key);
decrypt = subghz_protocol_keeloq_common_decrypt(hop, man);
if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) {
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
return 1;
}
break;
case KEELOQ_LEARNING_UNKNOWN:
// Simple Learning
decrypt = subghz_protocol_keeloq_common_decrypt(hop, manufacture_code->key);

View file

@ -94,6 +94,34 @@ inline uint64_t
inline uint64_t
subghz_protocol_keeloq_common_magic_serial_type1_learning(uint32_t data, uint64_t man) {
return man | ((uint64_t)data << 40) |
return (man & 0xFFFFFFFF) | ((uint64_t)data << 40) |
((uint64_t)(((data & 0xff) + ((data >> 8) & 0xFF)) & 0xFF) << 32);
}
/** Magic_serial_type2 Learning
* @param data - btn+serial number (32bit)
* @param man - magic man (64bit)
* @return manufacture for this serial number (64bit)
*/
inline uint64_t
subghz_protocol_keeloq_common_magic_serial_type2_learning(uint32_t data, uint64_t man) {
uint8_t* p = (uint8_t*)&data;
uint8_t* m = (uint8_t*)&man;
m[7] = p[0];
m[6] = p[1];
m[5] = p[2];
m[4] = p[3];
return man;
}
/** Magic_serial_type3 Learning
* @param data - serial number (24bit)
* @param man - magic man (64bit)
* @return manufacture for this serial number (64bit)
*/
inline uint64_t
subghz_protocol_keeloq_common_magic_serial_type3_learning(uint32_t data, uint64_t man) {
return (man & 0xFFFFFFFFFF000000) | (data & 0xFFFFFF);
}

View file

@ -22,6 +22,8 @@
#define KEELOQ_LEARNING_SECURE 3u
#define KEELOQ_LEARNING_MAGIC_XOR_TYPE_1 4u
#define KEELOQ_LEARNING_MAGIC_SERIAL_TYPE_1 5u
#define KEELOQ_LEARNING_MAGIC_SERIAL_TYPE_2 6u
#define KEELOQ_LEARNING_MAGIC_SERIAL_TYPE_3 7u
/**
* Simple Learning Encrypt
@ -72,3 +74,19 @@ uint64_t subghz_protocol_keeloq_common_magic_xor_type1_learning(uint32_t data, u
*/
uint64_t subghz_protocol_keeloq_common_magic_serial_type1_learning(uint32_t data, uint64_t man);
/** Magic_serial_type2 Learning
* @param data - btn+serial number (32bit)
* @param man - magic man (64bit)
* @return manufacture for this serial number (64bit)
*/
uint64_t subghz_protocol_keeloq_common_magic_serial_type2_learning(uint32_t data, uint64_t man);
/** Magic_serial_type3 Learning
* @param data - btn+serial number (32bit)
* @param man - magic man (64bit)
* @return manufacture for this serial number (64bit)
*/
uint64_t subghz_protocol_keeloq_common_magic_serial_type3_learning(uint32_t data, uint64_t man);