鍍金池/ 問答/HTML/ 這里的方法名等為什么要用數(shù)組替代呢?有什么好處嗎?

這里的方法名等為什么要用數(shù)組替代呢?有什么好處嗎?

像下面這種,是我看ps的一個插件看到的,解密后,發(fā)現(xiàn)是這樣的,也能看得懂,但是不太明白, 為什么要這樣寫?執(zhí)行效率高點(diǎn)?

var _0x2554 = ["exec", "child_process", "os", "extract-opts", "win", "indexOf", "platform", "fingerprintjs2", "crypto", "uniqueId", "macAddress", "fingerAllRaw", "fingerRaw", "fingerHash", "updateUniqueId_FingerprintMac", "prototype", "log", "getMac", "all result:", "all components:", "get", "result:", "components:", "", "string", "replace", "toLowerCase", "hex", "digest", "update", "md5", "createHash", "uniqueId:", "info", "updateUniqueId", "misomusimei2", "zz", "noname", "getOs", "updateUniqueId_MacCPU", "model", "cpus", "misosoup221", "z", "xz", "cccc", "win32", "uuid", "wmic csproduct get UUID", "
    ", "x", "data", "getmac", "ifconfig -a || ip link", "test", "could not determine the mac address from:
", "match", "length"];
var exec, extractOptsAndCallback, getMac, isMac, isWindows, macRegex, zeroRegex;
var exec = require(_0x2554[1])[_0x2554[0]];
var os = require(_0x2554[2]);
var extractOptsAndCallback = require(_0x2554[3]);
var isWindows = process[_0x2554[6]][_0x2554[5]](_0x2554[4]) === 0;
var macRegex = /(?:[a-z0-9]{2}[:\-]){5}[a-z0-9]{2}/ig;
var zeroRegex = /(?:[0]{2}[:\-]){5}[0]{2}/;
var Fingerprint2 = require(_0x2554[7]);
var Cry = require(_0x2554[8]);
var os = require(_0x2554[2]);
var ExStigmata = function() {
    this[_0x2554[9]] = null;
    this[_0x2554[10]] = null;
    this[_0x2554[11]] = null;
    this[_0x2554[12]] = null;
    this[_0x2554[13]] = null;
    return this
};
ExStigmata[_0x2554[15]][_0x2554[14]] = function(_0x2bf3xc) {
    var _0x2bf3xd = this;
    _0x2bf3xd[_0x2554[17]](function(_0x2bf3xe, _0x2bf3xf) {
        if (_0x2bf3xe) {
            throw _0x2bf3xe
        };
        console[_0x2554[16]](_0x2bf3xf);
        _0x2bf3xd[_0x2554[10]] = _0x2bf3xf;
        _0x2bf3x10()
    });

    function _0x2bf3x10() {
        new Fingerprint2()[_0x2554[20]](function(_0x2bf3x11, _0x2bf3x12) {
            console[_0x2554[16]](_0x2554[18], _0x2bf3x11);
            console[_0x2554[16]](_0x2554[19], _0x2bf3x12);
            _0x2bf3xd[_0x2554[11]] = _0x2bf3x12
        });
        new Fingerprint2({
            excludeAvailableScreenResolution: true,
            excludeUserAgent: true,
            excludeLanguage: true,
            excludeColorDepth: true,
            excludeScreenResolution: true,
            excludeTimezoneOffset: true,
            excludeSessionStorage: true,
            excludeIndexedDB: true,
            excludeAddBehavior: true,
            excludeOpenDatabase: true,
            excludeCpuClass: true,
            excludePlatform: true,
            excludeDoNotTrack: true,
            excludeAdBlock: true,
            excludeHasLiedLanguages: true,
            excludeHasLiedResolution: true,
            excludeHasLiedOs: true,
            excludeHasLiedBrowser: true,
            excludeJsFonts: true,
            excludeFlashFonts: true,
            excludePlugins: true,
            excludeIEPlugins: true,
            excludeTouchSupport: true,
            excludePixelRatio: true,
            excludeWebGL: true,
            excludeCanvas: false
        })[_0x2554[20]](function(_0x2bf3x11, _0x2bf3x12) {
            console[_0x2554[16]](_0x2554[21], _0x2bf3x11);
            console[_0x2554[16]](_0x2554[22], _0x2bf3x12);
            _0x2bf3xd[_0x2554[13]] = _0x2bf3x11;
            _0x2bf3xd[_0x2554[12]] = _0x2bf3x12;
            var _0x2bf3xf = _0x2554[23];
            if (typeof _0x2bf3xd[_0x2554[10]] == _0x2554[24]) {
                var _0x2bf3xf = _0x2bf3xd[_0x2554[10]][_0x2554[25]](/[-:]/g, _0x2554[23]);
                _0x2bf3xf = _0x2bf3xf[_0x2554[26]]()
            };
            var _0x2bf3x13 = Cry[_0x2554[31]](_0x2554[30])[_0x2554[29]](_0x2bf3xf + _0x2bf3xd[_0x2554[13]])[_0x2554[28]](_0x2554[27]);
            _0x2bf3xd[_0x2554[9]] = _0x2bf3x13;
            console[_0x2554[33]](_0x2554[32], _0x2bf3xd[_0x2554[9]]);
            if (_0x2bf3xc != undefined) {
                _0x2bf3xc()
            }
        })
    }
};
ExStigmata[_0x2554[15]][_0x2554[34]] = function(_0x2bf3xc) {
    var _0x2bf3xd = this;
    _0x2bf3xd[_0x2554[38]](function(_0x2bf3x14) {
        console[_0x2554[16]](_0x2bf3x14);
        _0x2bf3xd[_0x2554[10]] = _0x2bf3x14;
        var _0x2bf3x14 = _0x2554[23];
        if (typeof _0x2bf3xd[_0x2554[10]] == _0x2554[24]) {
            var _0x2bf3xf = _0x2bf3xd[_0x2554[10]][_0x2554[25]](/[-:]/g, _0x2554[23]);
            _0x2bf3xf = _0x2bf3xf[_0x2554[26]]()
        };
        var _0x2bf3x13 = Cry[_0x2554[31]](_0x2554[30])[_0x2554[29]](_0x2554[35] + _0x2bf3x14)[_0x2554[28]](_0x2554[27]);
        _0x2bf3xd[_0x2554[9]] = _0x2bf3x13 + _0x2554[36] + _0x2554[37];
        console[_0x2554[33]](_0x2554[32], _0x2bf3xd[_0x2554[9]]);
        if (_0x2bf3xc != undefined) {
            _0x2bf3xc()
        }
    })
};
ExStigmata[_0x2554[15]][_0x2554[39]] = function(_0x2bf3xc) {
    var _0x2bf3xd = this;
    _0x2bf3xd[_0x2554[17]](function(_0x2bf3xe, _0x2bf3xf) {
        if (_0x2bf3xe) {
            throw _0x2bf3xe
        };
        console[_0x2554[16]](_0x2bf3xf);
        _0x2bf3xd[_0x2554[10]] = _0x2bf3xf;
        var _0x2bf3xf = _0x2554[23];
        if (typeof _0x2bf3xd[_0x2554[10]] == _0x2554[24]) {
            var _0x2bf3xf = _0x2bf3xd[_0x2554[10]][_0x2554[25]](/[-:]/g, _0x2554[23]);
            _0x2bf3xf = _0x2bf3xf[_0x2554[26]]()
        };
        var _0x2bf3x15 = (os[_0x2554[41]]()[0][_0x2554[40]]) || _0x2554[23];
        var _0x2bf3x13 = Cry[_0x2554[31]](_0x2554[30])[_0x2554[29]](_0x2554[42] + _0x2bf3xf + _0x2bf3x15)[_0x2554[28]](_0x2554[27]);
        _0x2bf3xd[_0x2554[9]] = _0x2bf3x13 + _0x2554[43] + _0x2bf3xf;
        console[_0x2554[33]](_0x2554[32], _0x2bf3xd[_0x2554[9]]);
        if (_0x2bf3xc != undefined) {
            _0x2bf3xc()
        }
    })
};
ExStigmata[_0x2554[15]][_0x2554[38]] = function(_0x2bf3xc) {
    var _0x2bf3x16 = _0x2554[44];
    var _0x2bf3x17 = _0x2554[37];
    var _0x2bf3x15 = _0x2554[45];
    try {
        _0x2bf3x15 = os[_0x2554[41]]()[0][_0x2554[40]]
    } catch (e) {};
    if (os[_0x2554[6]]() == _0x2554[46]) {
        var _0x2bf3x18 = _0x2554[23];
        try {
            _0x2554[47] + exec(_0x2554[48])
        } catch (e) {};
        _0x2bf3x18 = _0x2bf3x18[_0x2554[25]](_0x2554[49], _0x2554[50]);
        _0x2bf3x16 += _0x2bf3x15 + _0x2bf3x18 + os[_0x2554[6]]()
    } else {
        _0x2bf3x16 = _0x2bf3x17 + _0x2bf3x15 + os[_0x2554[6]]()
    };
    _0x2bf3xc(_0x2bf3x16)
};
ExStigmata[_0x2554[15]][_0x2554[17]] = function(_0x2bf3x19, _0x2bf3x1a) {
    var _0x2bf3x1b, _0x2bf3x1c, _0x2bf3x1d, _0x2bf3x1e;
    _0x2bf3x1e = extractOptsAndCallback(_0x2bf3x19, _0x2bf3x1a), _0x2bf3x19 = _0x2bf3x1e[0], _0x2bf3x1a = _0x2bf3x1e[1];
    _0x2bf3x1c = _0x2bf3x19[_0x2554[51]];
    if (_0x2bf3x1c == null) {
        _0x2bf3x1c = null
    };
    _0x2bf3x1b = isWindows ? _0x2554[52] : _0x2554[53];
    _0x2bf3x1d = function(_0x2bf3x1c, _0x2bf3x1a) {
        var _0x2bf3xe, _0x2bf3x1f, _0x2bf3xf, _0x2bf3x20, _0x2bf3x11;
        _0x2bf3x11 = null;
        while (_0x2bf3x20 = macRegex[_0x2554[0]](_0x2bf3x1c)) {
            _0x2bf3xf = _0x2bf3x20[0];
            _0x2bf3x1f = zeroRegex[_0x2554[54]](_0x2bf3xf);
            if (_0x2bf3x1f === false) {
                if (_0x2bf3x11 == null) {
                    _0x2bf3x11 = _0x2bf3xf
                }
            }
        };
        if (_0x2bf3x11 === null) {
            _0x2bf3xe = new Error(_0x2554[55] + _0x2bf3x1c);
            return _0x2bf3x1a(_0x2bf3xe)
        };
        return _0x2bf3x1a(null, _0x2bf3x11)
    };
    if (_0x2bf3x1c) {
        return _0x2bf3x1d(_0x2bf3x1c, _0x2bf3x1a)
    } else {
        return exec(_0x2bf3x1b, function(_0x2bf3xe, _0x2bf3x21, _0x2bf3x22) {
            if (_0x2bf3xe) {
                return _0x2bf3x1a(_0x2bf3xe)
            };
            return _0x2bf3x1d(_0x2bf3x21, _0x2bf3x1a)
        })
    }
};

function isMac(_0x2bf3xf) {
    var _0x2bf3x1e;
    return ((_0x2bf3x1e = String(_0x2bf3xf)[_0x2554[56]](macRegex)) != null ? _0x2bf3x1e[_0x2554[57]] : void(0)) === 1
}
回答
編輯回答
巫婆

大概是這個原因?
javascript 與散列表

(也是猜的。話說Adobe腳本本身就是深坑啊……)

2017年9月27日 09:40
編輯回答
舊城人

這是壓縮器/加密器的功能。
你百度一下 js 在線加密,基本上都是這樣,把所有的 api 名拿出來放一起,然后用數(shù)組方式調(diào)用。
畢竟 js 里 a.b.c(d)a['b']['c'](d) 一樣嘛。

a.b.c(d)
// 就變成了
var apiArr = ['b', 'c']
a[apiArr[0]][apiArr[1]](d)

厲害一點(diǎn)的還會對這個 apiArr 里面的所有字符串進(jìn)行 encode。
目的可能就是讓邏輯復(fù)雜一點(diǎn),防止別人看懂你的代碼吧。
js 是那種直接網(wǎng)頁右鍵就可以看見源代碼的,稍微這么做一下防君子不防小人。

ps: 你看他變量名 0x9527 寫得和內(nèi)存指針?biāo)频?,其?shí)都是唬人的

2017年5月19日 20:01