Facebook 网页协议参数JS分析记录

__dyn 关键点

function a(a, b, c) {
return a.map(function(a) {
d("JSScheduler").deferUserBlockingRunAtCurrentPri_DO_NOT_USE(function() {
	b.apply(c, a)
})
})
}
handleDefine: function(a, b, d, e, g) {
//条件断点1 !(console.log(this.baba +=" "+a+"->"+e+",")==undefined)
//条件断点2 !(console.log(this.baba += e + ",")==undefined)

	e >= 0 && j.set(e),
	define(a, b, function(h, i, j, k, b) {
		h = {
			data: d
		};
		c("replaceTransportMarkers")({
			relativeTo: g
		}, h);
		if (e === -42) {
			i = d != null && typeof d === "object" && d.__throw8367__;
			throw new Error(a + ": " + (typeof i === "string" ? i : ""))
		}
		b.exports = h.data
	}, h | i)
},
b.toCompressedString = function() {
if (this.$1.length === 0)
	return "";
if (this.$2 != null)
	return this.$2;
var a = []
  , b = 1
  , c = this.$1[0] || 0
  , d = c.toString(2);
for (var e = 1; e < this.$1.length; e++) {
	var f = this.$1[e] || 0;
	f === c ? b++ : (a.push(h(b)),
	c = f,
	b = 1)
}
b && a.push(h(b));
return this.$2 = i(d + a.join(""))
}
b.set = function(a) {
	this.$2 != null && !this.$1[a] && (this.$2 = null);
	this.$1[a] = 1;
	return this
}
c.handleWithCustomApplyEach = function(a, b, c) {
	this.$5(b, c, a)
}
//这个函数下条件断点 console.log(e)
handleDefine: function(a, b, d, e, g) {
    e >= 0 && j.set(e),
        define(a, b, function (h, i, j, k, b) {
            h = {
                data: d
            };
            c("replaceTransportMarkers")({
                relativeTo: g
            }, h);
            if (e === -42) {
                i = d != null && typeof d === "object" && d.__throw8367__;
                throw new Error(a + ": " + (typeof i === "string" ? i : ""))
            }
            b.exports = h.data
        }, h | i)
}
//条件断点 a.define[0][0].length>0
__d("ScheduledServerJS", ["JSScheduler", "ScheduledApplyEach", "ServerJS"], function(a, b, c, d, e, f, g) {
    "use strict";
    function a(a, b, e) {
        b != null && new (c("ServerJS"))().handle(b),
        d("JSScheduler").runWithPriority(d("JSScheduler").priorities.unstable_Normal, function() {
            e != null && new (c("ServerJS"))().handle(e),
            new (c("ServerJS"))().handleWithCustomApplyEach(c("ScheduledApplyEach"), a)
        })
    }
    g.handle = a
}

__csr关键点

(b("BootloaderConfig").phdOn ? c.c == 2 : c.c) && b("CSRBitMap").add(h)
handlePayload: function(a, c) {
            for (var d = (d = a.rsrcTags) != null ? d : [], e = Array.isArray(d), f = 0, d = e ? d : d[typeof Symbol === "function" ? Symbol.iterator : "@@iterator"](); ; ) {
                var d, g;
                if (e) {
                    if (f >= d.length)
                        break;
                    g = d[f++]
                } else {
                    f = d.next();
                    if (f.done)
                        break;
                    g = f.value
                }
                g = g;
                X(document.getElementById(g))
            }
            $.setResourceMap((g = a.rsrcMap) != null ? g : {}, a.sotUpgrades, a.consistency.rev, c);
            f = a.csrUpgrade != null ? n(a.csrUpgrade) : [];
            e = f.find(function(a) {
                return !z.has(a)
            });
            f.length && a.consistency.rev !== b("SiteData").client_revision ? b("FBLogger")("bootloader", "csr-mismatch").mustfix("CSR upgrades included on mismatched rev " + a.consistency.rev + " (client rev: " + b("SiteData").client_revision + ", cohort: " + b("SiteData").pkg_cohort + ").") : e != null && D ? b("FBLogger")("bootloader", "missing-csr-upgrade").mustfix("CSR upgrades included unknown rsrcIndex " + e + " (client rev: " + b("SiteData").client_revision + ", cohort: " + b("SiteData").pkg_cohort + ").") : f.forEach(b("CSRBitMap").add);
            a.compMap && $.enableBootload(a.compMap, c)
        },

__csr生成大致执行顺序

//1. 提取 csrUpgrade
handlePayload: function(a, c) {
	for (var d = (d = a.rsrcTags) != null ? d : [], e = Array.isArray(d), f = 0, d = e ? d : d[typeof Symbol === "function" ? Symbol.iterator : "@@iterator"](); ; ) {
		var d, g;
		if (e) {
			if (f >= d.length)
				break;
			g = d[f++]
		} else {
			f = d.next();
			if (f.done)
				break;
			g = f.value
		}
		g = g;
		X(document.getElementById(g))
	}
	$.setResourceMap((g = a.rsrcMap) != null ? g : {}, a.sotUpgrades, a.consistency.rev, c);
	f = a.csrUpgrade != null ? n(a.csrUpgrade) : [];
	e = f.find(function(a) {
		return !z.has(a)
	});
	f.length && a.consistency.rev !== b("SiteData").client_revision ? b("FBLogger")("bootloader", "csr-mismatch").mustfix("CSR upgrades included on mismatched rev " + a.consistency.rev + " (client rev: " + b("SiteData").client_revision + ", cohort: " + b("SiteData").pkg_cohort + ").") : e != null && D ? b("FBLogger")("bootloader", "missing-csr-upgrade").mustfix("CSR upgrades included unknown rsrcIndex " + e + " (client rev: " + b("SiteData").client_revision + ", cohort: " + b("SiteData").pkg_cohort + ").") : f.forEach(b("CSRBitMap").add);
	a.compMap && $.enableBootload(a.compMap, c)
},
//2. 处理非 csrUpgrade,也就是css 中的某个c属性==2
V(a, c, d) {
	y.set(a, c);
	if (c.type === "async" || c.type === "csr")
		return;
	var e = c.p;
	if (e)
		for (var e = n(e), f = Array.isArray(e), g = 0, e = f ? e : e[typeof Symbol === "function" ? Symbol.iterator : "@@iterator"](); ; ) {
			var h;
			if (f) {
				if (g >= e.length)
					break;
				h = e[g++]
			} else {
				g = e.next();
				if (g.done)
					break;
				h = g.value
			}
			h = h;
			if (h === m)
				continue;
			(!z.has(h) || d) && z.set(h, a);
			(b("BootloaderConfig").phdOn ? c.c == 2 : c.c) && b("CSRBitMap").add(h)
		}
}
//3. 上述函数提取到的数值会调用h.set储存起来
__d("CSRBitMap", ["BitMap"], (function(a, b, c, d, e, f, g) {
    var h = new (c("BitMap"))();
    function a(a) {
        h.set(a)
    }
    function b() {
        return h.toCompressedString()
    }
    g.add = a;
    g.toCompressedString = b
}

//4. 最后会调用 h.toCompressedString() 生成密文

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注