_)1)@ISS145VH{7)I7CDHTP.png
(M@9@2@~{VX{STI5K$IJ79Q.png
G8QNXEFJ1`K~MX2Q4[M4%FP.png
O058[(D}7(WLHM4~2J{$6PF.png
XV5Z{2IF2EC7C[WF_L}2$TT.png

绕过序列号认证。

function decodeCode(encrypt: string): string {
    const format = (encrypt: string, length: number, offset: number) => {
      const content = ((array, offset) => {
        const max = array.length - offset;
        if (max <= 0) {
          return array;
        }
        const result = new Array(array.length);
        for (let i = 0; i < array.length; i++) {
          if (i < offset) {
            result[i] = array[max + i];
          } else {
            result[i] = array[i - offset];
          }
        }
        return result;
      })(encrypt.split(''), offset).join('');
      const sb: string[] = [];
      let start = 0;
      while (start < content.length) {
        let end = start + length;
        if (end > content.length) {
          end = content.length;
        }
        const item = content.substring(start, end);
        sb.push(item.split('').reverse().join(''));
        start = end;
      }
      return sb.join('');
    };
    const KEY_ENCRYPT =
      'BAFEDIHGLKJONMRQPUTSXWVaZYdcbgfejihmlkponsrqvutyxw10z432765+98/C';
    const index = encrypt.indexOf('=');
    const body = index === -1 ? encrypt : encrypt.substring(0, index);
    const suffix = index === -1 ? '' : encrypt.substring(index);
    const temp = format(body, 12, 3) + suffix;
    const input = temp.replace(/[^A-Za-z0-9\+\/\=]/g, '');
    const KEYS = format(KEY_ENCRYPT, 3, 1) + '=';
    let output = '';
    let chr1: number, chr2: number, chr3: number;
    let enc1: number, enc2: number, enc3: number, enc4: number;
    let i = 0;
    while (i < input.length) {
      enc1 = KEYS.indexOf(input.charAt(i++));
      enc2 = KEYS.indexOf(input.charAt(i++));
      enc3 = KEYS.indexOf(input.charAt(i++));
      enc4 = KEYS.indexOf(input.charAt(i++));
      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;
      output = output + String.fromCharCode(chr1);
      if (enc3 != 64) {
        output = output + String.fromCharCode(chr2);
      }
      if (enc4 != 64) {
        output = output + String.fromCharCode(chr3);
      }
    }
    output = ((utftext) => {
      let string = '';
      let i = 0;
      let c = 0;
      let c2 = 0;
      let c3 = 0;
      while (i < utftext.length) {
        c = utftext.charCodeAt(i);
        if (c < 128) {
          string += String.fromCharCode(c);
          i++;
        } else if (c > 191 && c < 224) {
          c2 = utftext.charCodeAt(i + 1);
          string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
          i += 2;
        } else {
          c2 = utftext.charCodeAt(i + 1);
          c3 = utftext.charCodeAt(i + 2);
          string += String.fromCharCode(
            ((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)
          );
          i += 3;
        }
      }
      return string;
    })(output);
    return output;
  }

标签: none

添加新评论