0

I took over managing a WordPress website build by someone else that we don't have contact with. The custom theme they are using appears to have been built on with a code generator (parser?) of some type. In order to reverse engineer this, I'm trying to figure out what kind of tool they used to create the site, as I can't easily update or make changes to said code.

Below is a section of a javascript file that is heavily used on the site. Any ideas of what they used to create code like this (and hopefully how I can edit it).

!(function (e) {
function t(t) {
    for (var s, n, o = t[0], l = t[1], u = t[2], p = 0, d = []; p < o.length; p++) (n = o[p]), Object.prototype.hasOwnProperty.call(r, n) && r[n] && d.push(r[n][0]), (r[n] = 0);
    for (s in l) Object.prototype.hasOwnProperty.call(l, s) && (e[s] = l[s]);
    for (c && c(t); d.length; ) d.shift()();
    return a.push.apply(a, u || []), i();
}
function i() {
    for (var e, t = 0; t < a.length; t++) {
        for (var i = a[t], s = !0, o = 1; o < i.length; o++) {
            var l = i[o];
            0 !== r[l] && (s = !1);
        }
        s && (a.splice(t--, 1), (e = n((n.s = i[0]))));
    }
    return e;
}
var s = {},
    r = { 0: 0 },
    a = [];
function n(t) {
    if (s[t]) return s[t].exports;
    var i = (s[t] = { i: t, l: !1, exports: {} });
    return e[t].call(i.exports, i, i.exports, n), (i.l = !0), i.exports;
}
  • wp sites should be maintained through the admin layout. This code is created with a bundler and messing with it won't help you at all.. also you can't tell which bundler they used because the output is pretty much the same in all imo – kmp Oct 13 '21 at 22:57
  • So, you want to the code? Check [this Q&A](https://reverseengineering.stackexchange.com/questions/4561/how-to-deobfuscate-an-obfuscated-javascript-file-like-this) on the Reverse Engineering StackExchange site to see if it helps. How many lines are in the code? Just this? Hundreds? Thousands? In my limited experience, bundled source files are pretty large and would take a lot of highly-focused work to reverse (but not an impossible task). Safe to assume the un-bundled source is not available? – phentnil Oct 13 '21 at 23:06
  • FYI, the tool that produces the code you are seeing is called a "minifier" - code that parses scripts and replaces identifier names for local variables and arguments with shorter,e.g. single letter, identifiers to reduce the size of scripts during transmission. Tool to reverse the process are often called "deobfuscators". [This closed question](https://stackoverflow.com/q/1387810/5217142) may provide you with some ideas. However, adapting a similar but currently available theme may be more productive. – traktor Oct 14 '21 at 01:02
  • Note the closed question linked does not have a link to [maximize](https://www.npmjs.com/package/maximize) ( potentially useful iff you have a [source map](https://stackoverflow.com/q/29463252/5217142) of changes made during minification). – traktor Oct 14 '21 at 01:21
  • Thank you all for the insight! This makes sense and ultimately helps me make a decision about what I need to do to move this forward. – Aaron GL Podbelski Oct 14 '21 at 19:51

0 Answers0