有没有javascript大神来挑战一下

湛都南 2018-03-10 07:45:08
JS地址:https://res.cdn.openinstall.io/openinstall.js
谁能把这端JS解析出来。
保证你看两行头晕了。
...全文
626 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
无聊的上午 2018-03-12
  • 打赏
  • 举报
回复
这是js压缩 为了加快执行速度的,节省执行消耗的
无聊的上午 2018-03-12
  • 打赏
  • 举报
回复
请不要发瓜https://tool.lu/js/ 自己把jscopy进去点解压缩
  • 打赏
  • 举报
回复
你直接看懂是不可能的,网上用工具反混肴一下
天际的海浪 2018-03-10
  • 打赏
  • 举报
回复
接上


			function r(e) {
				var t, n, r, i = [],
					a = 0;
				for (t = n = r = 0; a < e.length;) t = e[a], 128 > t ? (i.push(String.fromCharCode(t)), a++) : t > 191 && 224 > t ? (n = e[a + 1], i.push(String.fromCharCode((31 & t) << 6 | 63 & n)), a += 2) : (n = e[a + 1], r = e[a + 2], i.push(String.fromCharCode((15 & t) << 12 | (63 & n) << 6 | 63 & r)), a += 3);
				return i.join("")
			}
			var i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=";
			return [
				function(t) {
					if (!t) return "";
					for (var r = n(t), i = r.length, a = 0; i > a; a++) r[a] = 150 ^ r[a];
					return e(r)
				},
				function(e) {
					if (!e) return "";
					for (var n = t(e), i = 0, a = n.length; a > i; i++) n[i] = 150 ^ n[i];
					return r(n)
				},
				function(t) {
					return t ? e(n(t)) : ""
				},
				function(e) {
					return e ? r(t(e)) : ""
				}
			]
		}(),
		d = u[0],
		s = u[1],
		f = u[2],
		h = u[3],
		p = function() {
			"use strict";

			function n() {
				if (!a) {
					a = !0;
					for (var t = 0; t < i.length; t++) i[t].fn.call(e, i[t].ctx);
					i = []
				}
			}

			function r() {
				"complete" === t.readyState && n()
			}
			var i = [],
				a = !1,
				o = !1;
			return function(c, l) {
				return a ? void c(l) : (i.push({
					fn: c,
					ctx: l
				}), void("complete" === t.readyState || !t.attachEvent && "interactive" === t.readyState ? n() : o || (t.addEventListener ? (t.addEventListener("DOMContentLoaded", n, !1), e.addEventListener("load", n, !1)) : (t.attachEvent("onreadystatechange", r), e.attachEvent("onload", n)), o = !0)))
			}
		}(),
		v = function() {
			function t() {
				s.isReady() || (s.ready(), clearInterval(f), c && c.close())
			}

			function n() {
				t()
			}

			function i(e) {
				for (var t = e.split("."), n = 0, r = 0; r < t.length; r++) n = n << 8 | 255 & parseInt(t[r]);
				return n
			}

			function a(e) {
				for (var n, r, a, o, c = e.split("\r\n"), l = 0; l < c.length; l++) {
					if (n = c[l], r = n.split(" "), 0 == n.indexOf("a=candidate:") && (a = r[7]) && "host" == a && (o = r[4]));
					else if (0 == n.indexOf("a=rtcp:") && (a = r[2]) && "IP4" == a && (o = r[3]));
					else if (0 != n.indexOf("c=") || !(a = r[1]) || "IP4" != a || !(o = r[2])) continue;
					o && !u[o] && /[0-9]{1,3}(\.[0-9]{1,3}){3}/.test(o) && ("0.0.0.0" == o || 0 == o.indexOf("127.") || 3758096384 == (4026531840 & i(o)) || (u[o] = 1, d.push(o)))
				}
				d.length && t()
			}
			var o, c, l, u = {},
				d = [],
				s = new r,
				f = setInterval(function() {
					c && c.localDescription && c.localDescription.sdp && l != c.localDescription.sdp && (l = c.localDescription.sdp, a(l))
				}, 10);
			try {
				(o = e.RTCPeerConnection || e.mozRTCPeerConnection || e.webkitRTCPeerConnection) ? (c = new o({
					iceServers: []
				}, {
					optional: [{
						RtpDataChannels: !0
					}]
				}), c.onicecandidate = function(e) {
					e.candidate && e.candidate.candidate && a("a=" + e.candidate.candidate)
				}, c.createDataChannel("openinstall"), c.createOffer(function(e) {
					try {
						c.setLocalDescription(e, function() {}, n)
					} catch (t) {
						n(t)
					}
				}, n), setTimeout(t, 2e3)) : n("not exists")
			} catch (h) {
				n(h)
			}
			return function(e) {
				s.run(function() {
					e(d.slice(0))
				})
			}
		}(),
		y = e.JSON || {
			parse: function(e) {
				return eval("(" + e + ")")
			},
			stringify: function() {
				var e = Object.prototype.toString,
					t = Array.isArray || function(t) {
						return "[object Array]" === e.call(t)
					},
					n = {
						'"': '\\"',
						"\\": "\\\\",
						"\b": "\\b",
						"\f": "\\f",
						"\n": "\\n",
						"\r": "\\r",
						"	": "\\t"
					},
					r = function(e) {
						return n[e] || "\\u" + (e.charCodeAt(0) + 65536).toString(16).substr(1)
					},
					i = /[\\"\u0000-\u001F\u2028\u2029]/g;
				return function a(n) {
					if (null == n) return "null";
					if ("number" == typeof n) return isFinite(n) ? n.toString() : "null";
					if ("boolean" == typeof n) return n.toString();
					if ("object" == typeof n) {
						if ("function" == typeof n.toJSON) return a(n.toJSON());
						if (t(n)) {
							for (var o = "[", c = 0; c < n.length; c++) o += (c ? ", " : "") + a(n[c]);
							return o + "]"
						}
						if ("[object Object]" === e.call(n)) {
							var l = [];
							for (var u in n) n.hasOwnProperty(u) && l.push(a(u) + ": " + a(n[u]));
							return "{" + l.sort().join(", ") + "}"
						}
					}
					return '"' + n.toString().replace(i, r) + '"'
				}
			}()
		};
	return c.channelRedirect = function(e, t) {
		new c({
			appKey: e,
			channelCode: t,
			_channelRedirect: !0
		}).wakeupOrInstall()
	}, c.parseUrlParams = function() {
		for (var t = (e.location.search || "?").substring(1).replace(/\+/g, "%20"), n = t.split("&"), r = {}, i = 0; i < n.length; i++) {
			var a = n[i].split("="),
				o = decodeURIComponent(a[0] || ""),
				c = decodeURIComponent(a[1] || "");
			o && c && ("undefined" == typeof r[o] ? r[o] = c : "object" == typeof r[o] ? r[o].push(c) : r[o] = [r[o], c])
		}
		return r
	}, c.docReady = p, c.server = "//openinstall.io", c
}(window, document, XMLHttpRequest);
天际的海浪 2018-03-10
  • 打赏
  • 举报
回复
这代码只是被压缩混淆成一行了。用代码格式化工具格式化一下就能看了,不过代码中函数名和变量名混淆之后是无法还原的

OpenInstall = function(e, t, n) {
	function r() {
		this.arr = [], this.run = function(e) {
			this.arr ? this.arr[this.arr.length] = e : e()
		}, this.isReady = function() {
			return null == this.arr
		}, this.ready = function() {
			if (null != this.arr)
				for (var e = 0; e < this.arr.length; e++) this.arr[e]();
			this.arr = null
		}
	}

	function i(e) {
		var t = [];
		for (var n in e) {
			var r = e[n];
			if ("[object Array]" == Object.prototype.toString.call(r))
				for (var i = 0; i < r.length; i++) null != r[i] && "undefined" != typeof r[i] && t.push(encodeURIComponent(n) + "=" + encodeURIComponent(r[i]));
			else null != r && "undefined" != typeof r && t.push(encodeURIComponent(n) + "=" + encodeURIComponent(r))
		}
		return t.join("&")
	}

	function a(e) {
		var t = new n,
			r = e.data,
			i = e.url,
			a = e.method;
		i = i.indexOf("?") > -1 ? i + "&v=" + l : i + "?v=" + l, r && "string" != typeof r && (r = y.stringify(r)), "POST" != a && r && (i = i + (i.indexOf("?") > -1 ? "&" : "?") + r, r = null), t.onreadystatechange = function() {
			if (t.readyState == ("number" == typeof n.DONE ? n.DONE : 4)) {
				if (200 == t.status) {
					var r = t.response || t.responseText || {};
					e.success && e.success("string" == typeof r ? y.parse(r) : r)
				} else e.error && e.error(t, t.statusText);
				e.complete && e.complete(t)
			}
		}, t.open(a, i, !0), t.ontimeout = function() {
			e.error && e.error(t, t.statusText)
		}, t.timeout = e.timeout || 0, t.setRequestHeader && t.setRequestHeader("Content-Type", "application/json;charset=utf-8"), t.withCredentials = (e.xhrFields || {}).withCredentials, t.send(r)
	}

	function o() {
		var e = t.createElement("canvas");
		if (e && "function" == typeof e.getContext)
			for (var n = ["webgl", "webgl2", "experimental-webgl2", "experimental-webgl"], r = 0; r < n.length; r++) {
				var i = n[r],
					a = e.getContext(i);
				if (a) {
					var o = {};
					o.context = i, o.version = a.getParameter(a.VERSION), o.vendor = a.getParameter(a.VENDOR), o.sl_version = a.getParameter(a.SHADING_LANGUAGE_VERSION), o.max_texture_size = a.getParameter(a.MAX_TEXTURE_SIZE);
					var c = a.getExtension("WEBGL_debug_renderer_info");
					return c && (o.vendor = a.getParameter(c.UNMASKED_VENDOR_WEBGL), o.renderer = a.getParameter(c.UNMASKED_RENDERER_WEBGL)), o
				}
			}
		return {}
	}

	function c(n, l) {
		function u(e, n) {
			var r, i, a = "android" == R.platform && "qq" == R.brower;
			a = !1, a ? (r = "hidden", i = "qbrowserVisibilityChange") : "undefined" != typeof t.hidden ? (r = "hidden", i = "visibilitychange") : "undefined" != typeof t.msHidden ? (r = "msHidden", i = "msvisibilitychange") : "undefined" != typeof t.webkitHidden && (r = "webkitHidden", i = "webkitvisibilitychange");
			var o = function(e) {
					return a && e && "undefined" != typeof e.hidden ? e.hidden : t[r]
				},
				c = setTimeout(function() {
					null == c || o() || (e(), c = null)
				}, n);
			i && t.addEventListener(i, function(e) {
				null != c && o(e) && (clearTimeout(c), c = null)
			}, !1)
		}

		function y(e, t, n, r) {
			"function" == typeof n && u(n, r), L[e](t)
		}

		function m(e) {
			var n = t.createElement("div");
			return n.innerHTML = e, n = n.children[0], n.onclick = function() {
				t.body.removeChild(n)
			}, n
		}

		function g(n, r, i) {
			var a = "ex",
				o = "ecC",
				c = "ommand",
				l = "co",
				u = "py",
				d = a + o + c,
				s = l + u;
			if ("function" != typeof t[d]) return !1;
			var p = t.createElement("div");
			p.innerHTML = n;
			for (var v = [], y = 0; y < p.children.length; y++) v[y] = p.children[y];
			for (var m, g, b = !1, C = r ? r + ((new Date).getTime() + 1e3 * (i || 1)) + "-" : null, y = 0; y < v.length; y++) try {
				if (m = v[y], t.body.appendChild(m), "SELECT" === m.nodeName) m.focus();
				else if ("INPUT" === m.nodeName || "TEXTAREA" === m.nodeName) {
					C && (m.value = f(h(m.value) + C));
					var E = m.hasAttribute("readonly");
					E || m.setAttribute("readonly", ""), m.select(), m.setSelectionRange(0, m.value.length), E || m.removeAttribute("readonly")
				} else {
					m.hasAttribute("contenteditable") && m.focus(), C && m.setAttribute("class", C), g = e.getSelection();
					var w = t.createRange();
					w.selectNode(m), g.removeAllRanges(), g.addRange(w)
				}
				b = t[d](s), t.body.removeChild(m)
			} catch (R) {
				t.body.removeChild(m), b = !1
			}
			return g && g.removeAllRanges(), b
		}

		function b() {
			return R.apkUrl && "function" == typeof n.apkDownloadHandler ? void n.apkDownloadHandler(R.apkUrl) : void(R.fallbackUrl ? (A && u(function() {
				t.body.appendChild(A)
			}, 400), L[R.fallbackMethod](R.fallbackUrl)) : A && t.body.appendChild(A))
		}

		function C(e, t, n) {
			p(function() {
				D.run(function() {
					var r = t ? b : null;
					if (n = n || {}, t && R.soi && (e = !0), R.pb && t && g(s(R.pb), s(R.ypp), parseInt(s(R.yps) || "0")), R.schemaUrl && e) {
						var i = n.timeout || R.wt;
						y(R.schemaMethod, R.schemaUrl, r, i)
					} else r && r()
				})
			})
		}

		function E(e, t) {
			P && (clearTimeout(P), P = null);
			var n = c.server + "/bind/" + I + "?" + i(e);
			a({
				url: n,
				method: "POST",
				xhrFields: {
					withCredentials: !0
				},
				data: t,
				success: function(n) {
					R = w(n || {}), n.shadow && (A = m(n.shadow)), D.ready(), R.ttl && (P = setTimeout(function() {
						E(e, t)
					}, 1e3 * R.ttl))
				}
			})
		}

		function w(e) {
			var t = {
				sm: "schemaMethod",
				st: "schemaTimeout",
				fm: "fallbackMethod",
				au: "apkUrl",
				acl: "allowClickLog",
				p: "pb"
			};
			for (var n in e) {
				var r = t[n];
				r && (e[r] = e[n], delete e[n])
			}
			return e
		}
		n = n || {};
		var R, A, O, x, S, k, T = n.channelCode || c.parseUrlParams().channelCode;
		T && T.constructor == Array && (T = T[T.length - 1]);
		var I = n.appKey,
			D = new r,
			N = this;
		if (!I) return void alert("appKey not specified");
		"function" == typeof n.onready && D.run(function() {
			n.onready.call(N)
		}), n.buttonId && D.run(function() {
			for (var e = n.buttonId.split(" "), r = 0; r < e.length; r++) {
				var i = t.getElementById(e[r]);
				i && i.addEventListener("click", function() {
					N.wakeupOrInstall()
				})
			}
		});
		try {
			O = e.screen.width || "", x = e.screen.height || "", k = e.devicePixelRatio || "", S = o()
		} catch (U) {}
		var P, L = {
			frm: function(e) {
				var n = t.createElement("iframe");
				n.style.display = "none", n.style.visibility = "hidden", n.src = e, t.body.appendChild(n)
			},
			loc: function(t) {
				e.location = t
			},
			hrf: function(e) {
				var n = t.createElement("a");
				n.style.display = "none", n.href = e, t.body.appendChild(n), n.click()
			},
			inhrf: function(e) {
				var n = t.createElement("script");
				n.setAttribute("type", "text/javascript"), n.innerHTML = '(function(){var a = document.createElement("a");a.style.display = "none";a.href = "' + e.replace(/"/g, '\\"') + '";document.body.appendChild(a);a.click();})()', t.body.appendChild(n)
			},
			open: function(t) {
				e.open(t)
			}
		};
		this.wakeupOrInstall = function(e) {
			C(!1, !0, e)
		}, this.schemeWakeup = function(e) {
			C(!0, !1, e)
		}, this.install = this.wakeupOrInstall, v(function(t) {
			for (var r = 0, t = t || [], i = t.length; i > r; r++) t[r] = d(t[r] || "");
			var a = {
				channelCode: T,
				sw: d("" + (O || 0)),
				sh: d("" + (x || 0)),
				sp: k,
				gv: d(S.version || ""),
				gr: d(S.renderer || ""),
				li: t,
				c: n._channelRedirect ? 1 : 0,
				apk: n.apkFileName,
				pw: n.preferWakeup ? 1 : 0,
				rf: d(e.location.href),
				t: (new Date).getTime()
			};
			E(a, l)
		})
	}
	var l = 2,
		u = function() {
			function e(e) {
				var t, n, r, a, o = -1,
					c = e.length,
					l = [0, 0, 0, 0];
				for (t = []; ++o < c;) n = e[o], r = e[++o], l[0] = n >> 2, l[1] = (3 & n) << 4 | (r || 0) >> 4, o >= c ? l[2] = l[3] = 64 : (a = e[++o], l[2] = (15 & r) << 2 | (a || 0) >> 6, l[3] = o >= c ? 64 : 63 & a), t.push(i.charAt(l[0]), i.charAt(l[1]), i.charAt(l[2]), i.charAt(l[3]));
				return t.join("")
			}

			function t(e) {
				for (var t, n, r, a, o, c, l, u = [], d = 0; d < e.length;) a = i.indexOf(e.charAt(d++)), o = i.indexOf(e.charAt(d++)), c = i.indexOf(e.charAt(d++)), l = i.indexOf(e.charAt(d++)), t = a << 2 | o >> 4, n = (15 & o) << 4 | c >> 2, r = (3 & c) << 6 | l, u.push(t), 64 != c && u.push(n), 64 != l && u.push(r);
				return u
			}

			function n(e) {
				var t, n = -1,
					r = e.length,
					i = [];
				if (/^[\x00-\x7f]*$/.test(e))
					for (; ++n < r;) i.push(e.charCodeAt(n));
				else
					for (; ++n < r;) t = e.charCodeAt(n), 128 > t ? i.push(t) : 2048 > t ? i.push(t >> 6 | 192, 63 & t | 128) : i.push(t >> 12 | 224, t >> 6 & 63 | 128, 63 & t | 128);
				return i
			}

87,990

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧