How can i Deobfuscate a piece hex-obfuscated of javascript code?

151 views Asked by At

I found this javascript code somewhere on github (i forgot), and it is obfuscated. I cannot contact the owner of the code. is there any way of deobfuscating this code?

#!/usr/bin/env node

function a0y() {
    const gX = ['\x31\x36\x32\x6a\x58\x6f\x43\x69\x54', '\x32\x38\x37\x38\x33\x32\x38\x4d\x6b\x46\x78\x48\x4c', '\x31\x30\x32\x39\x30\x36\x48\x69\x62\x45\x69\x4c', '\x31\x37\x39\x32\x37\x36\x32\x62\x6e\x4f\x6d\x49\x54', '\x31\x30\x39\x35\x37\x33\x30\x6c\x67\x64\x4c\x77\x42', '\x31\x30\x35\x32\x32\x35\x63\x74\x77\x48\x53\x6d', '\x37\x33\x30\x59\x49\x79\x66\x4e\x42', '\x32\x35\x31\x30\x38\x34\x30\x6e\x50\x7a\x7a\x4e\x53', '\x31\x37\x31\x38\x37\x33\x31\x33\x46\x69\x42\x7a\x4f\x49', '\ud83d\udee1\ufe0f', '\x32\x38\x58\x52\x41\x62\x46\x4e', '\x33\x67\x46\x63\x71\x51\x67'];
    a0y = function() {
        return gX;
    };
    return a0y();
}
const a0gs = a0N;
(function(K, g) {
    const gz = a0N,
        y = K();
    while (!![]) {
        try {
            const N = parseInt(gz(0x94)) / (0x4 * -0x925 + -0x17c0 + -0x3c55 * -0x1) + parseInt(gz(0x93)) / (0x249c + -0x869 + 0x1 * -0x1c31) * (-parseInt(gz(0x8f)) / (0xa52 + 0xcc9 + 0x1 * -0x1718)) + -parseInt(gz(0x97)) / (-0x1 * 0x454 + -0x16a9 + 0xdf * 0x1f) + parseInt(gz(0x95)) / (0x5 * 0x6fd + 0x20c3 + -0x43af) * (parseInt(gz(0x90)) / (0x2560 + -0x83 * 0x49 + -0x1 * -0x1)) + parseInt(gz(0x8e)) / (0x3 * 0x761 + -0x19 * 0x16f + 0xdbb) * (parseInt(gz(0x91)) / (0x13e3 + -0x4 * -0x72 + -0x15a3)) + parseInt(gz(0x92)) / (0x185 * 0x7 + 0x72b + 0x11c5 * -0x1) * (parseInt(gz(0x96)) / (-0x10 * 0x1d5 + -0x13 * 0x11e + 0x6 * 0x86e)) + -parseInt(gz(0x8c)) / (0x764 + 0xa * 0x9d + -0xd7b);
            if (N === g) break;
            else y['push'](y['shift']());
        } catch (T) {
            y['push'](y['shift']());
        }
    }
}(a0y, -0xca067 + -0x1 * 0x131c02 + 0x2cb97a));
const a0k = (function() {
    const K = {
        '\x6f\x69\x61\x78\x45': function(N, T) {
            return N === T;
        },
        '\x43\x6d\x4d\x4f\x71': '\x42\x56' + '\x6d\x65' + '\x42',
        '\x63\x52\x5a\x73\x5a': function(N, T) {
            return N === T;
        },
        '\x73\x76\x54\x58\x72': '\x47\x50' + '\x44\x6b' + '\x62',
        '\x42\x4b\x51\x59\x47': function(y, N) {
            return y(N);
        },
        '\x4c\x63\x55\x49\x7a': function(N, T) {
            return N === T;
        },
        '\x50\x45\x59\x66\x50': '\x46\x63' + '\x4c\x4f' + '\x63'
    };
    let g = !![];
    return function(y, N) {
        const T = {
            '\x6c\x79\x7a\x42\x54': function(q, m) {
                return q(m);
            },
            '\x41\x57\x74\x53\x4c': function(q, m) {
                return K['\x42\x4b' + '\x51\x59' + '\x47'](q, m);
            }
        };
        if (K['\x4c\x63' + '\x55\x49' + '\x7a'](K['\x50\x45' + '\x59\x66' + '\x50'], K['\x50\x45' + '\x59\x66' + '\x50'])) {
            const q = g ? function() {
                if (K['\x6f\x69' + '\x61\x78' + '\x45'](K['\x43\x6d' + '\x4d\x4f' + '\x71'], K['\x43\x6d' + '\x4d\x4f' + '\x71'])) {
                    if (N) {
                        if (K['\x63\x52' + '\x5a\x73' + '\x5a'](K['\x73\x76' + '\x54\x58' + '\x72'], K['\x73\x76' + '\x54\x58' + '\x72'])) {
                            const m = N['\x61\x70' + '\x70\x6c' + '\x79'](y, arguments);
                            return N = null, m;
                        } else g = '';
                    }
                } else T['\x6c\x79' + '\x7a\x42' + '\x54'](y, '\x50\x72' + '\x6f\x78' + '\x79\x3a' + '\x20' + N + ('\x20\x66' + '\x61\x69' + '\x6c\x65' + '\x64\x21'));
            } : function() {};
            return g = ![], q;
        } else !m ? (d['\x73\x74' + '\x64\x6f' + '\x75\x74']['\x63\x6c' + '\x65\x61' + '\x72\x4c' + '\x69\x6e' + '\x65'](-0x5 * -0x12 + -0x31 * 0xc7 + 0x25bd), b['\x73\x74' + '\x64\x6f' + '\x75\x74']['\x63\x75' + '\x72\x73' + '\x6f\x72' + '\x54\x6f'](-0x43 * 0x86 + 0x97b + 0x1997), u['\x73\x74' + '\x64\x6f' + '\x75\x74']['\x77\x72' + '\x69\x74' + '\x65'](x + ('\x20\x5a' + '\x65\x66' + '\x6f\x79' + '\x20\x69' + '\x73\x20' + '\x61\x63' + '\x63\x65' + '\x73\x73' + '\x69\x62' + '\x6c\x65' + '\x21\x20' + '\x3a\x29'))) : T['\x41\x57' + '\x74\x53' + '\x4c'](j, '\x5a\x65' + '\x66\x6f' + '\x79\x20' + '\x69\x73' + '\x20\x61' + '\x63\x63' + '\x65\x73' + '\x73\x69' + '\x62\x6c' + '\x65\x21' + '\x20\x3a' + '\x29');
    };
}());
(function() {
    const K = {
        '\x74\x43\x42\x48\x48': function(g, y) {
            return g(y);
        },
        '\x66\x52\x65\x69\x69': function(g, N) {
            return g === N;
        },
        '\x43\x49\x75\x43\x67': '\x67\x56' + '\x6f\x42' + '\x44',
        '\x57\x53\x68\x50\x47': '\x59\x57' + '\x6b\x6b' + '\x59',
        '\x67\x6c\x53\x73\x6a': '\x66\x75' + '\x6e\x63' + '\x74\x69' + '\x6f\x6e' + '\x20\x2a' + '\x5c\x28' + '\x20\x2a' + '\x5c\x29',
        '\x4b\x45\x4c\x66\x7a': '\x5c\x2b' + '\x5c\x2b' + '\x20\x2a' + '\x28\x3f' + '\x3a\x5b' + '\x61\x2d' + '\x7a\x41' + '\x2d\x5a' + '\x5f\x24' + '\x5d\x5b' + '\x30\x2d' + '\x39\x61' + '\x2d\x7a' + '\x41\x2d' + '\x5a\x5f' + '\x24\x5d' + '\x2a\x29',
        '\x4c\x6b\x68\x47\x4f': function(g, y) {
            return g(y);
        },
        '\x48\x43\x76\x54\x69': function(g, N) {
            return g + N;
        },
        '\x4e\x77\x5a\x58\x67': '\x63\x68' + '\x61\x69' + '\x6e',
        '\x58\x61\x69\x74\x64': function(g, N) {
            return g + N;
        },
        '\x64\x4f\x6f\x76\x41': '\x69\x6e' + '\x70\x75' + '\x74',
        '\x6a\x62\x4a\x6d\x42': function(g, N) {
            return g !== N;
        },
        '\x49\x75\x6a\x6c\x56': '\x6a\x55' + '\x4c\x62' + '\x4b',
        '\x46\x58\x70\x70\x71': '\x4e\x4a' + '\x66\x63' + '\x4b',
        '\x4a\x76\x6a\x68\x52': function(g, y) {
            return g(y);
        },
        '\x77\x6e\x4f\x75\x4f': function(g) {
            return g();
        },
        '\x72\x42\x57\x45\x4b': function(g, y, N) {
            return g(y, N);
        }
    };
    K['\x72\x42' + '\x57\x45' + '\x4b'](a0k, this, function() {
        const g = {
            '\x53\x46\x4d\x71\x65': function(y, N) {
                return K['\x74\x43' + '\x42\x48' + '\x48'](y, N);
            }
        };
        if (K['\x66\x52' + '\x65\x69' + '\x69'](K['\x43\x49' + '\x75\x43' + '\x67'], K['\x57\x53' + '\x68\x50' + '\x47'])) y['\x73\x74' + '\x64\x6f' + '\x75\x74']['\x6d\x6f' + '\x76\x65' + '\x43\x75' + '\x72\x73' + '\x6f\x72'](-0x3 * 0x6a3 + 0xc91 + 0x758, -(-0x1 * -0xb3f + -0x10b + -0x1e * 0x57)), N['\x73\x74' + '\x64\x6f' + '\x75\x74']['\x63\x6c' + '\x65\x61' + '\x72\x53' + '\x63\x72' + '\x65\x65' + '\x6e\x44' + '\x6f\x77' + '\x6e']();
        else {
            const N = new RegExp(K['\x67\x6c' + '\x53\x73' + '\x6a']),
                T = new RegExp(K['\x4b\x45' + '\x4c\x66' + '\x7a'], '\x69'),
                q = K['\x4c\x6b' + '\x68\x47' + '\x4f'](a0gj, '\x69\x6e' + '\x69\x74');
            !N['\x74\x65' + '\x73\x74'](K['\x48\x43' + '\x76\x54' + '\x69'](q, K['\x4e\x77' + '\x5a\x58' + '\x67'])) || !T['\x74\x65' + '\x73\x74'](K['\x58\x61' + '\x69\x74' + '\x64'](q, K['\x64\x4f' + '\x6f\x76' + '\x41'])) ? K['\x6a\x62' + '\x4a\x6d' + '\x42'](K['\x49\x75' + '\x6a\x6c' + '\x56'], K['\x46\x58' + '\x70\x70' + '\x71']) ? K['\x4a\x76' + '\x6a\x68' + '\x52'](q, '\x30') : K['\x74\x43' + '\x42\x48' + '\x48'](g, '\x43\x6f' + '\x6f\x6b' + '\x69\x65' + '\x73\x20' + '\x69\x6e' + '\x6a\x65' + '\x63\x74' + '\x65\x64' + '\x21') : K['\x66\x52' + '\x65\x69' + '\x69']('\x59\x77' + '\x6e\x64' + '\x48', '\x59\x77' + '\x6e\x64' + '\x48') ? K['\x77\x6e' + '\x4f\x75' + '\x4f'](a0gj) : g['\x53\x46' + '\x4d\x71' + '\x65'](y, '\x43\x61' + '\x70\x74' + '\x63\x68' + '\x61\x20' + '\x72\x65' + '\x73\x6f' + '\x6c\x76' + '\x65\x64' + '\x21\x20' + '\x28' + N + '\x29');
        }
    })();
}());
import a0E from '\x6f\x73';
import a0a from '\x69\x6e\x71\x75\x69\x72\x65\x72';


.....there are still more to the code

I tried beautifier.io and other alternatives but still cant find a solution. Can anyone guide me the URL or any method to make it readable?

0

There are 0 answers