Pagger - Retekess T119.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <!DOCTYPE html>
  2. <!-- saved from url=(0064)https://meoker.github.io/pagger/retekess-t119/retekess-t119.html -->
  3. <html lang="en" data-theme="light">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <link rel="stylesheet" href="./Pagger - Retekess T119_files/pico.min.css">
  8. <title>Pagger - Retekess T119</title>
  9. <style>
  10. [data-theme="light"],
  11. :root:not([data-theme="dark"]) {
  12. --primary: #757575;
  13. --primary-hover: #616161;
  14. --primary-focus: rgba(117, 117, 117, 0.125);
  15. --primary-inverse: #FFF;
  16. }
  17. :root {
  18. --font-size: 15px;
  19. --spacing: 0.25rem;
  20. --form-element-spacing-vertical: 0.375rem;
  21. }
  22. h1 {
  23. margin-bottom: 0;
  24. }
  25. h3 {
  26. color: #757575;
  27. --typography-spacing-vertical: 0rem;
  28. }
  29. article {
  30. padding-left: 0.75rem;
  31. padding-right: 0.75rem;
  32. margin: 1.75rem 0;
  33. }
  34. article>header,
  35. article>footer {
  36. text-align: center;
  37. margin-left: -0.75rem;
  38. margin-right: -0.75rem;
  39. padding: 0.375rem;
  40. }
  41. .container>header {
  42. text-align: center;
  43. }
  44. .container>footer {
  45. display: flex;
  46. }
  47. .container>footer .title {
  48. flex: 1;
  49. }
  50. .container>footer .github,
  51. .container>footer .home {
  52. margin-left: 10px;
  53. }
  54. .orange-theme {
  55. --primary: #fb8c00;
  56. --primary-hover: #f57c00;
  57. --primary-focus: rgba(251, 140, 0, 0.125);
  58. --primary-inverse: #FFF;
  59. }
  60. .orange-theme h3 {
  61. color: #fb8c00;
  62. }
  63. .orange-theme input:not([type=submit], [type=button], [type=reset], [role=switch], [readonly]):is(:active, :focus) {
  64. --border-color: #fb8c00;
  65. }
  66. .orange-theme input:not([type=submit], [type=button], [type=reset], [type=range], [type=file], [readonly]):focus,
  67. .orange-theme select:focus,
  68. .orange-theme textarea:focus {
  69. --box-shadow: 0 0 0 3px rgba(251, 140, 0, 0.125);
  70. }
  71. .green-theme {
  72. --primary: #7cb342;
  73. --primary-hover: #689f38;
  74. --primary-focus: rgba(124, 179, 66, 0.125);
  75. --primary-inverse: #FFF;
  76. }
  77. .green-theme h3 {
  78. color: #7cb342;
  79. }
  80. .green-theme input:not([type=submit], [type=button], [type=reset], [role=switch], [readonly]):is(:active, :focus) {
  81. --border-color: #7cb342;
  82. }
  83. .green-theme input:not([type=submit], [type=button], [type=reset], [type=range], [type=file], [readonly]):focus,
  84. .green-theme select:focus,
  85. .green-theme textarea:focus {
  86. --box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.125);
  87. }
  88. .blue-theme {
  89. --primary: #039be5;
  90. --primary-hover: #0288d1;
  91. --primary-focus: rgba(3, 155, 229, 0.125);
  92. --primary-inverse: #FFF;
  93. }
  94. .blue-theme h3 {
  95. color: #039be5;
  96. }
  97. .blue-theme input:not([type=submit], [type=button], [type=reset], [role=switch], [readonly]):is(:active, :focus) {
  98. --border-color: #039be5;
  99. }
  100. .blue-theme input:not([type=submit], [type=button], [type=reset], [type=range], [type=file], [readonly]):focus,
  101. .blue-theme select:focus,
  102. .blue-theme textarea:focus {
  103. --box-shadow: 0 0 0 3px rgba(3, 155, 229, 0.125);
  104. }
  105. @media (max-width: 992px) {
  106. .grid .grid {
  107. display: flex;
  108. }
  109. .grid .grid div {
  110. display: flex;
  111. flex-direction: column;
  112. flex: 1;
  113. }
  114. }
  115. </style>
  116. <script>
  117. function decToBin(num, length) {
  118. var res = (num >>> 0).toString(2);
  119. while (res.length < length) {
  120. res = '0' + res;
  121. }
  122. return res;
  123. }
  124. function binToDec(bits) {
  125. return parseInt(bits, 2);
  126. }
  127. function hexToBin(hex) {
  128. return (parseInt(hex, 16).toString(2)).toUpperCase().padStart(24, '0');
  129. }
  130. function binToHex(bits) {
  131. return parseInt(bits, 2).toString(16).toUpperCase().padStart(6, '0');
  132. }
  133. function invert(bits) {
  134. return bits.split('').map(function (b) {
  135. return (1 - b).toString();
  136. }).join('');
  137. }
  138. function reverse(bits) {
  139. return bits.split('').reverse().join('');
  140. }
  141. function encManchester(bits, mode) {
  142. var res = '';
  143. for (var i = 0; i < bits.length; i++) {
  144. var c = bits.charAt(i);
  145. '0' == c ? res += mode ? '10' : '01' : '1' == c ? res += mode ? '01' : '10' : res += 'EE';
  146. }
  147. return res;
  148. }
  149. function decManchester(bits, mode) {
  150. var res = '';
  151. for (var i = 1; i < bits.length; i += 2) {
  152. var c = bits.charAt(i);
  153. var p = bits.charAt(i - 1);
  154. '0' == p && '1' == c ? res += mode ? '1' : '0' : '1' == p && '0' == c ? res += mode ? '0' : '1' : res += 'E';
  155. }
  156. return res;
  157. }
  158. function genKeyData(hex) {
  159. var formatted = hex.replace(/(.{2})/g, '$1 ').trim();
  160. var res = 'Key: ' + formatted + '\n';
  161. return res;
  162. }
  163. function genRawData(zero, one, repeats, bits) {
  164. bits += '0';
  165. var line = 'RAW_Data: -6000';
  166. //alert(bits);
  167. console.log('bitsLen = ' + bits.length);
  168. for (var i = 0; i < bits.length; i++) {
  169. var c = bits.charAt(i);
  170. var p = bits.charAt(i - 1);
  171. var t = c == '0' ? zero : one;
  172. if (i % 2 == 0) {
  173. line += ' ' + t;
  174. } else {
  175. line += ' -' + t;
  176. }
  177. }
  178. line += ' -6000\n';
  179. var res = '';
  180. for (var r = 0; r < repeats; r++) {
  181. res += line;
  182. }
  183. return res;
  184. }
  185. function genKeyFile(keyData) {
  186. var header = 'Filetype: Flipper SubGhz Key File\nVersion: 1\nFrequency: 433920000\nPreset: FuriHalSubGhzPresetOok650Async\nProtocol: Princeton\nBit: 24\n';
  187. var footer = 'TE: 271\n';
  188. return header + keyData + footer;
  189. }
  190. function genRawFile(rawData) {
  191. var header = 'Filetype: Flipper SubGhz RAW File\nVersion: 1\nFrequency: 433920000\nPreset: FuriHalSubGhzPresetOok650Async\nProtocol: RAW\n'
  192. return header + rawData;
  193. }
  194. function calcNumToHex(station, pager, action) {
  195. station = reverse(decToBin(station, 13));
  196. pager = reverse(decToBin(pager, 10));
  197. action = reverse(decToBin(action, 1));
  198. var hex = binToHex(station + pager + action);
  199. return hex;
  200. }
  201. function calcHexToNum() {
  202. var hex = document.getElementById('hex-key-sp').value.toString();
  203. var bin = hexToBin(hex);
  204. var station = binToDec(reverse(bin.substring(0, 13)));
  205. var pager = binToDec(reverse(bin.substring(13, 23)));
  206. var action = binToDec(reverse(bin.substring(23, 24)));
  207. document.getElementById('station-num-kp').value = station;
  208. document.getElementById('pager-num-kp').value = pager;
  209. document.getElementById('action-num-kp').value = action;
  210. document.getElementById('station-num-from-rp').value = station;
  211. document.getElementById('station-num-to-rp').value = station;
  212. document.getElementById('pager-num-from-rp').value = 1;
  213. document.getElementById('pager-num-to-rp').value = 100;
  214. document.getElementById('action-num-rp').value = action;
  215. document.getElementById('station-num-tp').value = station;
  216. }
  217. function downloadKeyFile() {
  218. document.getElementById('key-download').setAttribute('aria-busy', true);
  219. var station = Number(document.getElementById('station-num-kp').value);
  220. var pager = Number(document.getElementById('pager-num-kp').value);
  221. var action = Number(document.getElementById('action-num-kp').value);
  222. var hex = calcNumToHex(station, pager, action).toString().padStart(16, '0');
  223. var keyData = genKeyData(hex);
  224. var file = genKeyFile(keyData);
  225. var hiddenElement = document.createElement('a');
  226. hiddenElement.href = 'data:attachment/text,' + encodeURI(file);
  227. hiddenElement.target = '_blank';
  228. hiddenElement.download = station + '-' + pager + '-' + action + '.sub';
  229. hiddenElement.click();
  230. document.getElementById('key-download').setAttribute('aria-busy', false);
  231. }
  232. function downloadRawFile() {
  233. document.getElementById('raw-download').setAttribute('aria-busy', true);
  234. var stationFrom = Number(document.getElementById('station-num-from-rp').value);
  235. var stationTo = Number(document.getElementById('station-num-to-rp').value);
  236. var pagerFrom = Number(document.getElementById('pager-num-from-rp').value);
  237. var pagerTo = Number(document.getElementById('pager-num-to-rp').value);
  238. var action = Number(document.getElementById('action-num-rp').value);
  239. var rawData = '';
  240. var actionBin = reverse(decToBin(action, 1));
  241. for (var s = stationFrom; s <= stationTo; s++) {
  242. var stationBin = reverse(decToBin(s, 13));
  243. //alert(stationBin);
  244. for (var p = pagerFrom; p <= pagerTo; p++) {
  245. var pagerBin = reverse(decToBin(p, 10));
  246. //console.log('bin stationBin: ' + stationBin);
  247. //console.log('bin stationPager: ' + stationBin + pagerBin);
  248. console.log('bin fullId: ' + stationBin + pagerBin + actionBin);
  249. var bin = encManchester(stationBin + pagerBin + actionBin, 0);
  250. console.log('manchester: ' + bin);
  251. //alert(bin);
  252. var raw26 = genRawData(200, 600, 10, bin);
  253. var raw38 = genRawData(300, 800, 10, bin);
  254. console.log(raw26);
  255. rawData += raw26 + raw38;
  256. }
  257. }
  258. return;
  259. var file = genRawFile(rawData);
  260. var hiddenElement = document.createElement('a');
  261. hiddenElement.href = 'data:attachment/text,' + encodeURI(file);
  262. hiddenElement.target = '_blank';
  263. hiddenElement.download = stationFrom + '_' + stationTo + '-' + pagerFrom + '_' + pagerTo + '-' + action + '.sub';
  264. hiddenElement.click();
  265. document.getElementById('raw-download').setAttribute('aria-busy', false);
  266. }
  267. function downloadTurnOffFile() {
  268. document.getElementById('turnoff-download').setAttribute('aria-busy', true);
  269. var station = Number(document.getElementById('station-num-tp').value);
  270. var pager = Number(1005);
  271. var action = Number(0);
  272. var hex = calcNumToHex(station, pager, action).toString().padStart(16, '0');
  273. var keyData = genKeyData(hex);
  274. var file = genKeyFile(keyData);
  275. var hiddenElement = document.createElement('a');
  276. hiddenElement.href = 'data:attachment/text,' + encodeURI(file);
  277. hiddenElement.target = '_blank';
  278. hiddenElement.download = station + '-turnoff.sub';
  279. hiddenElement.click();
  280. document.getElementById('turnoff-download').setAttribute('aria-busy', false);
  281. }
  282. </script>
  283. </head>
  284. <body>
  285. <main class="container">
  286. <header>
  287. <h1 class="title">RETEKESS T119</h1>
  288. </header>
  289. <article id="signal-pane" class="orange-theme">
  290. <header>
  291. <h3>SIGNAL</h3>
  292. </header>
  293. <div class="grid">
  294. <div></div>
  295. <div>
  296. <label for="hex-key-sp">Hex key:</label>
  297. <input name="hex-key-sp" id="hex-key-sp" placeholder="00AABB" minlength="6" maxlength="6">
  298. </div>
  299. <div></div>
  300. </div>
  301. <div class="grid">
  302. <div></div>
  303. <button onclick="calcHexToNum()">Calculate ↓</button>
  304. <div></div>
  305. </div>
  306. <footer>
  307. Put here the hex key you got from the read.
  308. </footer>
  309. </article>
  310. <article id="key-pane" class="green-theme">
  311. <header>
  312. <h3>KEY FILE</h3>
  313. </header>
  314. <div class="grid">
  315. <div>
  316. <label for="station-num-kp">Station:</label>
  317. <input type="number" name="station-num-kp" id="station-num-kp" min="0" max="8191" placeholder="0 - 8191">
  318. </div>
  319. <div>
  320. <label for="pager-num-kp">Pager:</label>
  321. <input type="number" name="pager-num-kp" id="pager-num-kp" min="0" max="999" placeholder="0 - 999">
  322. </div>
  323. <div>
  324. <label for="action-num-kp">Action:</label>
  325. <input type="number" name="action-num-kp" id="action-num-kp" min="0" max="1" placeholder="0 ring - 1 mute">
  326. </div>
  327. </div>
  328. <div class="grid">
  329. <div></div>
  330. <button id="key-download" onclick="downloadKeyFile()">Download</button>
  331. <div></div>
  332. </div>
  333. <footer>
  334. This single key file will call a single pager.
  335. </footer>
  336. </article>
  337. <article id="raw-pane" class="green-theme">
  338. <header>
  339. <h3>RAW FILE</h3>
  340. </header>
  341. <div class="grid">
  342. <div class="grid">
  343. <div>
  344. <label for="station-num-from-rp">Station (from):</label>
  345. <input type="number" name="station-num-from-rp" id="station-num-from-rp" min="0" max="8191"
  346. placeholder="0 - 8191">
  347. </div>
  348. <div>
  349. <label for="station-num-to-rp">Station (to):</label>
  350. <input type="number" name="station-num-to-rp" id="station-num-to-rp" min="0" max="8191"
  351. placeholder="0 - 8191">
  352. </div>
  353. </div>
  354. <div class="grid">
  355. <div>
  356. <label for="pager-num-from-rp">Pager (from):</label>
  357. <input type="number" name="pager-num-from-rp" id="pager-num-from-rp" min="0" max="999"
  358. placeholder="0 - 999">
  359. </div>
  360. <div>
  361. <label for="pager-num-to-rp">Pager (to):</label>
  362. <input type="number" name="pager-num-to-rp" id="pager-num-to-rp" min="0" max="999" placeholder="0 - 999">
  363. </div>
  364. </div>
  365. <div class="grid">
  366. <div>
  367. <label for="action-num-rp">Action:</label>
  368. <input type="number" name="action-num-rp" id="action-num-rp" min="0" max="1" placeholder="0 ring - 1 mute">
  369. </div>
  370. </div>
  371. </div>
  372. <div class="grid">
  373. <div></div>
  374. <button id="raw-download" onclick="downloadRawFile()" aria-busy="false">Download</button>
  375. <div></div>
  376. </div>
  377. <footer>
  378. This combo raw file will call multiple pagers.
  379. </footer>
  380. </article>
  381. <article id="turnoff-pane" class="green-theme">
  382. <header>
  383. <h3>TURN-OFF FILE</h3>
  384. </header>
  385. <div class="grid">
  386. <div></div>
  387. <div>
  388. <label for="station-num-tp">Station:</label>
  389. <input type="number" name="station-num-tp" id="station-num-tp" min="0" max="8191" placeholder="0 - 8191">
  390. <button id="turnoff-download" onclick="downloadTurnOffFile()">Download</button>
  391. </div>
  392. <div></div>
  393. </div>
  394. <footer>
  395. This special action file will turn off all the pagers of a given station.
  396. </footer>
  397. </article>
  398. <article id="bruteforce-pane" class="blue-theme">
  399. <header>
  400. <h3>BRUTEFORCE FILES</h3>
  401. </header>
  402. <div class="grid">
  403. <div></div>
  404. <button
  405. onclick="window.location.href=&#39;https://github.com/meoker/pagger/tree/main/retekess-t119/bruteforce-t119.zip&#39;">Download</button>
  406. <div></div>
  407. </div>
  408. <footer>
  409. As explained <a href="https://meoker.github.io/pagger/#why-not-a-bruteforcer">here</a> I don't think the
  410. bruteforce is a viable approach... <br>Anyway if you wanted to try it, these are the files to call the first 10
  411. pagers for all stations.
  412. </footer>
  413. </article>
  414. <footer>
  415. <div class="title">Pagger - Flipper Zero Generator</div>
  416. <div class="github"><a href="https://github.com/meoker/pagger">Github</a></div>
  417. <div class="home"><a href="https://meoker.github.io/pagger">Home</a></div>
  418. </footer>
  419. </main>
  420. </body>
  421. </html>