Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1 рік тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. module['exports'] = {
  2. 'numberToHexString': numberToHexString,
  3. 'hexStringToBufferArray': hexStringToBufferArray,
  4. 'bufferArrayToHexString': bufferArrayToHexString,
  5. 'makeTLV': makeTLV,
  6. 'resolveTLV': resolveTLV,
  7. 'makeA3SendData': makeA3SendData,
  8. 'makeA8SendData': makeA8SendData,
  9. 'makeA5SendData': makeA5SendData
  10. };
  11. const frameLen = (0x3d540 ^ 0x3d5d6) * (0x9c688 ^ 0x9c68a);
  12. const sendLen = (0x88300 ^ 0x88314) * (0x21722 ^ 0x21720);
  13. const ST = '33';
  14. const preProto = '0a0012';
  15. const endProto = '1800';
  16. const bMagic = 'fe';
  17. const bVer = '01';
  18. const bCmdId = '7531';
  19. var SEQ = 0xbe59a ^ 0xbe599;
  20. function makeFrame(_0x35bc96) {
  21. let _0x268129 = parseInt(_0x35bc96['length'] / frameLen);
  22. let _0xacf032 = _0x35bc96['length'] % frameLen;
  23. let _0x42ec4d = new Array();
  24. for (let _0x198e24 = 0x87337 ^ 0x87337; _0x198e24 < _0x268129; _0x198e24++) {
  25. _0x42ec4d['push'](_0x35bc96['slice'](_0x198e24 * frameLen, (_0x198e24 + (0x19940 ^ 0x19941)) * frameLen));
  26. }
  27. if (_0xacf032 > (0x4a2e1 ^ 0x4a2e1)) {
  28. _0x42ec4d['push'](_0x35bc96['slice'](-_0xacf032));
  29. }
  30. let _0x9b32c4 = new Array();
  31. for (let _0x245523 = 0x67993 ^ 0x67993; _0x245523 < _0x42ec4d['length']; _0x245523++) {
  32. let _0x428823 = _0x42ec4d[_0x245523];
  33. let _0x207300 = numberToHexString(_0x245523 + (0xb00ff ^ 0xb00fe), 0x1, !![]);
  34. let _0x46166a = '';
  35. if (_0x245523 == (0x65203 ^ 0x65203)) {
  36. _0x46166a = numberToHexString(0x80 + _0x42ec4d['length'] - 0x1, 0x9f2cd ^ 0x9f2cc, !![]);
  37. } else {
  38. _0x46166a = numberToHexString(_0x42ec4d['length'] - _0x245523 - 0x1, 0x1, !![]);
  39. }
  40. let _0x157c71 = numberToHexString(parseInt(_0x428823['length'] / 0x2), 0x1, !![]);
  41. let _0xb3f3ea = ST + _0x207300 + _0x46166a + _0x157c71 + _0x428823;
  42. let _0x1d5160 = 0x0;
  43. for (let _0x3c4255 = 0x1; _0x3c4255 < parseInt(_0xb3f3ea['length'] / 0x2); _0x3c4255++) {
  44. let _0x6674ef = parseInt(_0xb3f3ea['slice'](_0x3c4255 * 0x2, (_0x3c4255 + (0x33575 ^ 0x33574)) * 0x2),
  45. 0xbd490 ^ 0xbd480);
  46. _0x1d5160 = _0x1d5160 ^ _0x6674ef;
  47. }
  48. _0xb3f3ea += numberToHexString(_0x1d5160, 0x1, !![]);
  49. _0x9b32c4['push'](_0xb3f3ea);
  50. }
  51. let _0x5f5d88 = new Array();
  52. for (let _0x3a0ec9 = 0x1cc00 ^ 0x1cc00; _0x3a0ec9 < _0x9b32c4['length']; _0x3a0ec9++) {
  53. let _0x1f3035 = _0x9b32c4[_0x3a0ec9];
  54. let _0x31b2a9 = numberToHexString(parseInt(_0x1f3035['length'] / (0x67658 ^ 0x6765a)), 0x43833 ^ 0x43832, !![]);
  55. let _0xb64a0c = preProto + _0x31b2a9 + _0x1f3035 + endProto;
  56. _0x5f5d88['push'](_0xb64a0c);
  57. }
  58. let _0x1e82ae = new Array();
  59. for (let _0x543968 = 0xbcc79 ^ 0xbcc79; _0x543968 < _0x5f5d88['length']; _0x543968++) {
  60. let _0x59ccdb = _0x5f5d88[_0x543968];
  61. let _0x1bb73b = numberToHexString(parseInt(_0x59ccdb['length'] / 0x2) + 0x8, 0x88553 ^ 0x88551, !![]);
  62. let _0x3d488f = numberToHexString(SEQ, 0x932b2 ^ 0x932b0, !![]);
  63. let _0x2fb921 = bMagic + bVer + _0x1bb73b + bCmdId + _0x3d488f + _0x59ccdb;
  64. _0x1e82ae['push'](_0x2fb921);
  65. }
  66. SEQ++;
  67. if (SEQ > (0x27c85 ^ 0x27c8a)) {
  68. SEQ = 0xd79d2 ^ 0xd79d3;
  69. }
  70. let _0x28fe81 = new Array();
  71. for (let _0x35a7da = 0xe59b4 ^ 0xe59b4; _0x35a7da < _0x1e82ae['length']; _0x35a7da++) {
  72. let _0x434969 = _0x1e82ae[_0x35a7da];
  73. let _0x162390 = parseInt(_0x434969['length'] / sendLen);
  74. let _0x199870 = _0x434969['length'] % sendLen;
  75. for (let _0x4a5a02 = 0x0; _0x4a5a02 < _0x162390; _0x4a5a02++) {
  76. let _0x15127c = _0x434969['slice'](_0x4a5a02 * sendLen, (_0x4a5a02 + (0x86b7e ^ 0x86b7f)) * sendLen);
  77. _0x28fe81['push'](hexStringToBufferArray(_0x15127c));
  78. }
  79. if (_0x199870 > 0x0) {
  80. let _0x3bc1c1 = _0x434969['slice'](-_0x199870);
  81. _0x28fe81['push'](hexStringToBufferArray(_0x3bc1c1));
  82. }
  83. }
  84. return _0x28fe81;
  85. }
  86. function makeA3SendData(_0xbfc508, _0x7891ad) {
  87. let _0x44971d = 'a3' + _0xbfc508;
  88. let _0x2651a0 = numberToHexString(parseInt(_0x7891ad['length'] / (0xe1b32 ^ 0xe1b30)), 0x2, ![]);
  89. _0x44971d += _0x2651a0;
  90. _0x44971d += _0x7891ad;
  91. return makeFrame(_0x44971d);
  92. }
  93. function makeA8SendData(_0xf08694, _0x7583ca) {
  94. let _0x429168 = 'a8' + _0xf08694;
  95. let _0x12e5be = numberToHexString(parseInt(_0x7583ca['length'] / 0x2), 0x2, ![]);
  96. _0x429168 += _0x12e5be;
  97. _0x429168 += _0x7583ca;
  98. return makeFrame(_0x429168);
  99. }
  100. function numberToHexString(_0xc38d55, _0x43704c, _0x35fbdc) {
  101. let _0x3fd1cd = _0xc38d55['toString'](0xa903a ^ 0xa902a);
  102. for (let _0x43c509 = _0x3fd1cd['length']; _0x43c509 < _0x43704c * 0x2; _0x43c509++) {
  103. _0x3fd1cd = '0' + _0x3fd1cd;
  104. }
  105. if (_0x3fd1cd['length'] > _0x43704c * 0x2) {
  106. _0x3fd1cd = _0x3fd1cd['substring'](_0x3fd1cd['length'] - _0x43704c * (0x56258 ^ 0x5625a));
  107. }
  108. if (_0x35fbdc == ![]) {
  109. let _0x1eadfc = '';
  110. for (let _0x1560e5 = _0x3fd1cd['length'] - 0x2; _0x1560e5 >= 0x0; _0x1560e5 -= 0x4a7b0 ^ 0x4a7b2) {
  111. _0x1eadfc = _0x1eadfc + _0x3fd1cd['substring'](_0x1560e5, _0x1560e5 + 0x2);
  112. }
  113. _0x3fd1cd = _0x1eadfc;
  114. }
  115. return _0x3fd1cd;
  116. }
  117. function hexStringToBufferArray(_0x34cce2) {
  118. let _0x498a85 = new Uint8Array(_0x34cce2['match'](/[0-9a-f]{2}/gi)['map'](function(_0x40572e) {
  119. return parseInt(_0x40572e, 0xa40de ^ 0xa40ce);
  120. }));
  121. return _0x498a85['buffer'];
  122. }
  123. function bufferArrayToHexString(_0x180899) {
  124. let _0x2ce7ed = Array['prototype']['map']['call'](new Uint8Array(_0x180899), _0x5ee1a1 => ('00' + _0x5ee1a1[
  125. 'toString'](0xb3099 ^ 0xb3089))['slice'](-0x2))['join']('');
  126. return _0x2ce7ed;
  127. }
  128. function makeTLV(_0x457cbe) {
  129. let _0x20719f = '';
  130. for (let _0x273d52 = 0x0; _0x273d52 < _0x457cbe['length']; _0x273d52++) {
  131. _0x20719f += (_0x273d52 + (0x4a99f ^ 0x4a99e))['toString'](0x10)['padStart'](0xbde89 ^ 0xbde8b, '0') + (
  132. _0x457cbe[_0x273d52]['length'] / 0x2)['toString'](0x10)['padStart'](0x2, '0') + _0x457cbe[_0x273d52];
  133. }
  134. return '80' + (_0x20719f['length'] / (0x740e5 ^ 0x740e7))['toString'](0x10)['padStart'](0x2, '0') + _0x20719f;
  135. }
  136. function resolveTLV(_0x56da10) {
  137. let _0x40fe65 = new Array();
  138. let _0x30a0a3 = parseInt(_0x56da10['substring'](0x206b6 ^ 0x206b4, 0x4), 0xddd22 ^ 0xddd32);
  139. let _0x2a1587 = 0x4;
  140. if (_0x30a0a3 > 0x80) {
  141. _0x2a1587 = _0x2a1587 + (_0x30a0a3 - (0xc1f20 ^ 0xc1fa0)) * 0x2;
  142. }
  143. let _0x5e64a1 = 0x33dd2 ^ 0x33dd3;
  144. while (_0x2a1587 < _0x56da10['length']) {
  145. let _0x1bad89 = parseInt(_0x56da10['substring'](_0x2a1587, _0x2a1587 + 0x2), 0x10);
  146. _0x2a1587 += 0x2;
  147. let _0x24cc76 = parseInt(_0x56da10['substring'](_0x2a1587, _0x2a1587 + (0x8331e ^ 0x8331c)), 0x10);
  148. _0x2a1587 += 0x2;
  149. let _0x3197e6 = _0x56da10['substring'](_0x2a1587, _0x2a1587 + _0x24cc76 * 0x2);
  150. _0x40fe65['push'](_0x3197e6);
  151. _0x2a1587 += _0x24cc76 * 0x2;
  152. }
  153. return _0x40fe65;
  154. }
  155. function makeA5SendData(_0x168749) {
  156. let _0x3a8eb6 = 'a5';
  157. let _0x1100cb = Number(parseInt(_0x168749['length'] / 0x2))['toString'](0x10)['padStart'](0x2, '0');
  158. _0x3a8eb6 += _0x1100cb;
  159. _0x3a8eb6 += _0x168749;
  160. return makeFrame(_0x3a8eb6);
  161. }