Skip to content

Instantly share code, notes, and snippets.

@nicoandmee
Last active January 14, 2020 05:35
Show Gist options
  • Select an option

  • Save nicoandmee/218f338dfbda2195909a8fd90baa1581 to your computer and use it in GitHub Desktop.

Select an option

Save nicoandmee/218f338dfbda2195909a8fd90baa1581 to your computer and use it in GitHub Desktop.
cat & mouse w/ amex [bot detection]
var RSA = new function() {
function e() {
function n(e) {
for (var n = null, a = 0; "number" == typeof i[a]; )
a += 1;
i[a] = 0,
this.hasNext = this.hasMoreElements = function() {
return i[a] < r ? !0 : ("number" == typeof i[a] && (i[a] = null),
!1)
}
,
this.next = this.nextElement = function() {
return this.hasNext ? (n = i[a],
t[e][i[a]++]) : null
}
,
this.remove = function() {
"number" == typeof n && (o.remove(t.__indexToKeys[n]),
n = null)
}
}
var t = {
__indexToValue: [],
__indexToKeys: []
}
, i = []
, r = 0
, o = this;
this.get = function(e) {
return "number" == typeof t[e] ? t.__indexToValue[t[e]] : null
}
,
this.put = function(e, n) {
"number" == typeof t[e] ? t.__indexToValue[t[e]] = n : (t[e] = r,
t.__indexToValue[r] = n,
t.__indexToKeys[r++] = e)
}
,
this.remove = function(e) {
var n = t[e];
if ("number" == typeof n) {
var o = 0;
for (delete t[e],
r -= 1,
o = n; r > o; o++)
t.__indexToValue[o] = t.__indexToValue[o + 1],
t[t.__indexToKeys[o] = t.__indexToKeys[o + 1]] = o;
for (o = 0; o < i.length; o++)
i[o] && n < i[o] && (i[o] -= 1)
}
}
,
this.size = function() {
return r
}
,
this.__enumerate = function(e) {
return new n(e)
}
,
e.prototype.elements = function() {
return this.__enumerate("__indexToValue")
}
,
e.prototype.keys = function() {
return this.__enumerate("__indexToKeys")
}
,
e.prototype.clear = function() {
for (var e = this.keys(); e.hasNext(); )
this.remove(e.next())
}
,
e.prototype.toString = function() {
for (var e, n = " =&gt; ", t = "\r\n", i = this.keys(), r = ""; i.hasNext(); )
e = i.next(),
r += e + n + this.get(e) + t;
return r
}
,
e.prototype.contains = function(e) {
for (var n = this.elements(); n.hasNext(); )
if (n.next() == e)
return !0;
return !1
}
,
e.prototype.containsValue = e.prototype.contains,
e.prototype.containsKey = function(e) {
return null !== this.get(e)
}
,
e.prototype.isEmpty = function() {
return 0 === this.size()
}
,
e.prototype.putAll = function(n) {
if (n.constructor == e)
for (var t, i = n.keys(); i.hasNext(); )
t = i.next(),
this.put(t, n.get(t))
}
,
e.prototype.clone = function() {
var n = new e;
return n.putAll(this),
n
}
,
e.prototype.equals = function(e) {
return e == this
}
}
function n(t) {
function r() {}
function o(e) {
return "function" == typeof e
}
var a = this;
a.config = {
recursion_level: 1,
collection_mode: "partial",
functionsToExclude: [],
function_list_size: 1024,
json_script: t ? t : "json2.js"
},
a.emptyDomData = function() {
a.dom_data = {
functions: {
names: [],
excluded: {
size: 0,
count: 0
},
truncated: !1
},
inputs: [],
iFrames: [],
scripts: [],
collection_status: n.NotStarted
}
}
,
a.startInspection = function() {
var e = !1
, t = !0;
try {
a.inspectJSFunctions(),
t = !1
} catch (i) {
e = e || !0
}
try {
a.inspectFrames(),
t = !1
} catch (i) {
e = e || !0
}
try {
a.inspectScripts(),
t = !1
} catch (i) {
e = e || !0
}
try {
a.inspectInputFields(),
t = !1
} catch (i) {
e = e || !0
}
e ? t ? a.dom_data.collection_status = n.Fail : a.dom_data.collection_status = n.Partial : a.dom_data.collection_status = n.Success,
a.handleSizeLimit()
}
,
a.domDataAsJSON = function() {
return _(JSON.stringify(a.dom_data))
}
,
a.recursiveGetAllFunctionNamesUnderElement = function(e, n, t) {
var i, s, u, c = a.config, l = c.recursion_level, d = c.collection_mode;
(void 0 === a.dom_data.functions || void 0 === a.dom_data.functions.names) && (a.dom_data.functions = {
names: [],
excluded: {
size: 0,
count: 0
},
truncated: !1
});
var p = a.dom_data.functions
, f = p.excluded;
for (var g in n)
try {
var v = n[g];
if (i = "" + v,
e.length > 0 ? prefix = e + "." : prefix = "",
s = prefix + g,
o(v))
if (a.functionShouldBeCollected(v, g)) {
var m = p.names;
u = m.length,
m[u] = s
} else
"partial" == d && (f.size += i.length,
f.count++);
l > t + 1 ? a.recursiveGetAllFunctionNamesUnderElement(s, v, t + 1) : p.names.sort()
} catch (h) {
window.console || (window.console = {},
window.console.info = r,
window.console.log = r,
window.console.warn = r,
window.console.error = r),
console && console.log && console.log("error counting functions: " + h.toString())
}
}
;
var s = new e;
a.initFunctionsToExclude = function() {
s && s.clear();
for (var e = a.config.functionsToExclude, n = e.length; n--; )
s.put(e[n], "")
}
,
a.functionShouldBeCollected = function(e, n) {
return "full" == a.config.collection_mode ? !0 : (0 === s.size() && a.initFunctionsToExclude(),
s.containsKey(n) ? !1 : !0)
}
,
a.inspectJSFunctions = function() {
a.dom_data.functions = [],
a.recursiveGetAllFunctionNamesUnderElement("", window, 0)
}
,
a.handleSizeLimit = function() {
var e = a.dom_data
, t = a.config
, i = t.function_list_size
, r = e.functions;
r.names.sort();
var o = JSON.stringify(e);
0 > i && (i = 0);
var s = 0;
if ("full" != t.colllection_mode && o.length > i) {
for (var u = r.names, c = u.toString(), l = o.length - JSON.stringify(u).length + "[]".length, d = !1, p = u.length; !d; )
1e3 == s++ && (d = !0),
lastComma = c.lastIndexOf(","),
lastComma >= 0 && p > 0 && l + lastComma > i ? (c = c.substring(0, lastComma - 1),
p--) : d = !0;
p > 1 ? (r.truncated = !0,
r.names = r.names.slice(0, p - 1),
e.functions.truncated = !0) : (a.emptyDomData(),
e = a.dom_data,
e.collection_status = n.Partial,
e.functions.truncated = !0)
}
}
,
a.inspectFrames = function() {
a.countElements("iframe")
}
,
a.countElements = function(e) {
var n = document.getElementsByTagName(e);
void 0 === a.dom_data.iFrames && (a.dom_data.iFrames = []);
var t = a.dom_data.iFrames
, r = t.length;
for (i = 0; i < n.length; i++)
t[r + i] = "" + n[i].src;
t.sort()
}
,
a.inspectScripts = function() {
var e = document.getElementsByTagName("script");
a.dom_data.scripts = [];
for (var n = 0; n < e.length; n++)
a.dom_data.scripts[n] = e[n].text.length
}
,
a.collectFields = function(e) {
var n = document.getElementsByTagName(e);
void 0 === a.dom_data.inputs && (a.dom_data.inputs = []);
for (var t = a.dom_data.inputs, i = t.length, r = n.length; r--; ) {
var o = n[r]
, s = o.name
, u = o.id;
s && s.length > 0 ? element_name = s : u && u.length > 0 ? element_name = u : element_name = "NO_NAME",
t[i + r] = element_name
}
t.sort()
}
,
a.inspectInputFields = function() {
a.collectFields("input"),
a.collectFields("textarea"),
a.collectFields("select"),
a.collectFields("button")
}
,
loadJSON = function() {
if (!window.JSON) {
var e = document.getElementsByTagName("head")[0]
, n = document.createElement("script");
n.type = "text/javascript",
n.src = a.config.json_script,
e.appendChild(n)
}
}
,
a.emptyDomData(),
loadJSON()
}
function r() {
this.deviceprint_browser = function() {
var e = navigator.userAgent.toLowerCase();
return t = e + E + navigator.appVersion + E + navigator.platform,
t += E + navigator.appMinorVersion + E + navigator.cpuClass + E + navigator.browserLanguage,
t += E + ScriptEngineBuildVersion(),
t
}
,
this.deviceprint_software = function() {
var t = ""
, r = !0;
try {
document.body.addBehavior("#default#clientCaps");
var o, a = n.length;
for (i = 0; i < a; i++) {
o = h(n[i]);
var s = e[i];
o ? r === !0 ? (t += s + w + o,
r = !1) : t += E + s + w + o : (t += "",
r = !1)
}
} catch (u) {}
return t
}
;
var e = ["abk", "wnt", "aol", "arb", "chs", "cht", "dht", "dhj", "dan", "dsh", "heb", "ie5", "icw", "ibe", "iec", "ieh", "iee", "jap", "krn", "lan", "swf", "shw", "msn", "wmp", "obp", "oex", "net", "pan", "thi", "tks", "uni", "vtc", "vnm", "mvm", "vbs", "wfd"]
, n = ["7790769C-0471-11D2-AF11-00C04FA35D02", "89820200-ECBD-11CF-8B85-00AA005B4340", "47F67D00-9E55-11D1-BAEF-00C04FC2D130", "76C19B38-F0C8-11CF-87CC-0020AFEECF20", "76C19B34-F0C8-11CF-87CC-0020AFEECF20", "76C19B33-F0C8-11CF-87CC-0020AFEECF20", "9381D8F2-0288-11D0-9501-00AA00B911A5", "4F216970-C90C-11D1-B5C7-0000F8051515", "283807B5-2C60-11D0-A31D-00AA00B92C03", "44BBA848-CC51-11CF-AAFA-00AA00B6015C", "76C19B36-F0C8-11CF-87CC-0020AFEECF20", "89820200-ECBD-11CF-8B85-00AA005B4383", "5A8D6EE0-3E18-11D0-821E-444553540000", "630B1DA0-B465-11D1-9948-00C04F98BBC9", "08B0E5C0-4FCB-11CF-AAA5-00401C608555", "45EA75A0-A269-11D1-B5BF-0000F8051515", "DE5AED00-A4BF-11D1-9948-00C04F98BBC9", "76C19B30-F0C8-11CF-87CC-0020AFEECF20", "76C19B31-F0C8-11CF-87CC-0020AFEECF20", "76C19B50-F0C8-11CF-87CC-0020AFEECF20", "D27CDB6E-AE6D-11CF-96B8-444553540000", "2A202491-F00D-11CF-87CC-0020AFEECF20", "5945C046-LE7D-LLDL-BC44-00C04FD912BE", "22D6F312-B0F6-11D0-94AB-0080C74C7E95", "3AF36230-A269-11D1-B5BF-0000F8051515", "44BBA840-CC51-11CF-AAFA-00AA00B6015C", "44BBA842-CC51-11CF-AAFA-00AA00B6015B", "76C19B32-F0C8-11CF-87CC-0020AFEECF20", "76C19B35-F0C8-11CF-87CC-0020AFEECF20", "CC2A9BA0-3BDD-11D0-821E-444553540000", "3BF42070-B3B1-11D1-B5C5-0000F8051515", "10072CEC-8CC1-11D1-986E-00A0C955B42F", "76C19B37-F0C8-11CF-87CC-0020AFEECF20", "08B0E5C0-4FCB-11CF-AAA5-00401C608500", "4F645220-306D-11D2-995D-00C04F98BBC9", "73FA19D0-2D75-11D2-995D-00C04F98BBC9"]
}
function o() {}
function a() {}
function s() {
this.startTime = (new Date).getTime()
}
function u() {
return Math.floor(6e4 * Math.random() + 4e3)
}
function c() {
var n = "3.4.0.0_1"
, t = new e;
t.put("npnul32", "def"),
t.put("npqtplugin6", "qt6"),
t.put("npqtplugin5", "qt5"),
t.put("npqtplugin4", "qt4"),
t.put("npqtplugin3", "qt3"),
t.put("npqtplugin2", "qt2"),
t.put("npqtplugin", "qt1"),
t.put("nppdf32", "pdf"),
t.put("NPSWF32", "swf"),
t.put("NPJava11", "j11"),
t.put("NPJava12", "j12"),
t.put("NPJava13", "j13"),
t.put("NPJava32", "j32"),
t.put("NPJava14", "j14"),
t.put("npoji600", "j61"),
t.put("NPJava131_16", "j16"),
t.put("NPOFFICE", "mso"),
t.put("npdsplay", "wpm"),
t.put("npwmsdrm", "drm"),
t.put("npdrmv2", "drn"),
t.put("nprjplug", "rjl"),
t.put("nppl3260", "rpl"),
t.put("nprpjplug", "rpv"),
t.put("npchime", "chm"),
t.put("npCortona", "cor"),
t.put("np32dsw", "dsw"),
t.put("np32asw", "asw"),
this.deviceprint_version = function() {
return n
}
,
this.deviceprint_browser = function() {
var e = navigator.userAgent.toLowerCase()
, n = e + E + navigator.appVersion + E + navigator.platform;
return n
}
,
this.deviceprint_software = function() {
var e = ""
, n = !0
, r = ""
, o = ""
, a = navigator.plugins
, s = navigator.mimeTypes;
if (a.length > 0) {
var u = ""
, c = "Plugins"
, l = a.length;
for (i = 0; i < l; i++)
plugin = a[i],
u = y(plugin.filename, c, "."),
n === !0 ? (o = t.containsKey(u),
o ? (r += t.get(u),
n = !1) : (r = "",
n = !1)) : (o = t.containsKey(u),
r += o ? E + t.get(u) : "");
e = _(r)
} else if (s.length > 0)
for (o = "",
i = 0; i < s.length; i++)
mimeType = s[i],
n === !0 ? (o = t.containsKey(mimeType),
o ? (e += t.get(mimeType) + w + mimeType,
n = !1) : (e += "unknown" + w + mimeType,
n = !1)) : (o = t.containsKey(mimeType),
o ? e += E + t.get(mimeType) + w + mimeType : r += "");
return e
}
,
this.deviceprint_display = function() {
var e = "";
return self.screen && (e += screen.colorDepth + E + screen.width + E + screen.height + E + screen.availHeight),
e
}
,
this.deviceprint_all_software = function() {
var e = ""
, n = !0
, t = navigator.plugins
, r = t.length;
if (r > 0) {
var o = ""
, a = "";
for (i = 0; i < r; i++) {
var s = t[i];
a = s.filename,
a = y(a, "Plugins", "."),
n === !0 ? (o += a,
n = !1) : o += E + a
}
e = _(o)
}
return e
}
,
this.deviceprint_timezone = function() {
var e = (new Date).getTimezoneOffset() / 60 * -1
, n = new Date;
return n.deviceprint_dst() && e--,
e
}
,
Date.prototype.deviceprint_stdTimezoneOffset = function() {
var e = new Date(this.getFullYear(),0,1)
, n = new Date(this.getFullYear(),6,1);
return Math.max(e.getTimezoneOffset(), n.getTimezoneOffset())
}
,
Date.prototype.deviceprint_dst = function() {
return this.getTimezoneOffset() < this.deviceprint_stdTimezoneOffset()
}
,
this.deviceprint_language = function() {
var e, n = navigator.language, t = navigator.browserLanguage, i = navigator.systemLanguage, r = navigator.userLanguage;
return e = "undefined" != typeof n ? "lang" + w + n + E : "undefined" != typeof t ? "lang" + w + t + E : "lang" + w + E,
e += "undefined" != typeof i ? "syslang" + w + i + E : "syslang" + w + E,
e += "undefined" != typeof r ? "userlang" + w + r : "userlang" + w
}
,
this.deviceprint_java = function() {
var e = navigator.javaEnabled() ? 1 : 0;
return e
}
,
this.deviceprint_cookie = function() {
var e = navigator.cookieEnabled ? 1 : 0;
return "undefined" != typeof navigator.cookieEnabled || e || (document.cookie = "testcookie",
e = -1 !== document.cookie.indexOf("testcookie") ? 1 : 0),
e
}
,
this.deviceprint_appName = function() {
var e = navigator.appName;
return "undefined" != typeof e ? e : ""
}
,
this.deviceprint_appCodeName = function() {
var e = navigator.appCodeName;
return "undefined" != typeof e ? e : ""
}
,
this.deviceprint_online = function() {
var e = navigator.onLine;
return "undefined" != typeof e ? e : ""
}
,
this.deviceprint_opsProfile = function() {
var e = navigator.opsProfile;
return "undefined" != typeof e && null !== e ? e : ""
}
,
this.deviceprint_userProfile = function() {
var e = navigator.userProfile;
return "undefined" != typeof e && null !== e ? e : ""
}
,
this.deviceprint_screen_availWidth = function() {
var e = screen.availWidth;
return "undefined" != typeof e ? e : ""
}
,
this.deviceprint_screen_pixelDepth = function() {
var e = screen.pixelDepth;
return "undefined" != typeof e ? e : ""
}
,
this.deviceprint_screen_bufferDepth = function() {
var e = screen.bufferDepth;
return "undefined" != typeof e ? e : ""
}
,
this.deviceprint_screen_deviceXDPI = function() {
var e = screen.deviceXDPI;
return "undefined" != typeof e ? e : ""
}
,
this.deviceprint_screen_deviceYDPI = function() {
var e = screen.deviceYDPI;
return "undefined" != typeof e ? e : ""
}
,
this.deviceprint_screen_logicalXDPI = function() {
var e = screen.logicalXDPI;
return "undefined" != typeof e ? e : ""
}
,
this.deviceprint_screen_logicalYDPI = function() {
var e = screen.logicalYDPI;
return "undefined" != typeof e ? e : ""
}
,
this.deviceprint_screen_fontSmoothingEnabled = function() {
var e = screen.fontSmoothingEnabled;
return "undefined" != typeof e ? e : ""
}
,
this.deviceprint_screen_updateInterval = function() {
var e = screen.updateInterval;
return "undefined" != typeof e ? e : ""
}
,
this.deviceprint_ping_in = function() {
return C && C.internalPingTime ? C.internalPingTime : ""
}
,
this.deviceprint_ping_ex = function() {
return C && C.externalPingTime ? C.externalPingTime : ""
}
}
function l(e) {
var n = encodeURIComponent(e).replace(/\~/g, "%7E").replace(/\!/g, "%21").replace(/\*/g, "%2A").replace(/\(/g, "%28").replace(/\)/g, "%29").replace(/\'/g, "%27").replace(/\-/g, "%2D").replace(/\_/g, "%5F").replace(/\./g, "%2E");
return n
}
function d() {
var e = f();
return l(e)
}
function f() {
F.init();
var e;
switch (F.browser) {
case "Explorer":
e = new r;
break;
case "Firefox":
e = new o;
break;
case "Opera":
e = new a;
break;
default:
e = new c
}
var n = "version=" + e.deviceprint_version() + "&pm_fpua=" + e.deviceprint_browser() + "&pm_fpsc=" + e.deviceprint_display() + "&pm_fpsw=" + e.deviceprint_software() + "&pm_fptz=" + e.deviceprint_timezone() + "&pm_fpln=" + e.deviceprint_language() + "&pm_fpjv=" + e.deviceprint_java() + "&pm_fpco=" + e.deviceprint_cookie();
return n = n + "&pm_fpasw=" + e.deviceprint_all_software(),
n = n + "&pm_fpan=" + e.deviceprint_appName() + "&pm_fpacn=" + e.deviceprint_appCodeName() + "&pm_fpol=" + e.deviceprint_online() + "&pm_fposp=" + e.deviceprint_opsProfile() + "&pm_fpup=" + e.deviceprint_userProfile() + "&pm_fpsaw=" + e.deviceprint_screen_availWidth() + "&pm_fpspd=" + e.deviceprint_screen_pixelDepth() + "&pm_fpsbd=" + e.deviceprint_screen_bufferDepth() + "&pm_fpsdx=" + e.deviceprint_screen_deviceXDPI() + "&pm_fpsdy=" + e.deviceprint_screen_deviceYDPI() + "&pm_fpslx=" + e.deviceprint_screen_logicalXDPI() + "&pm_fpsly=" + e.deviceprint_screen_logicalYDPI() + "&pm_fpsfse=" + e.deviceprint_screen_fontSmoothingEnabled() + "&pm_fpsui=" + e.deviceprint_screen_updateInterval(),
n = n + "&pm_os=" + F.OS + "&pm_brmjv=" + parseInt(F.version, 10) + "&pm_br=" + F.browser,
n = n + "&pm_inpt=" + e.deviceprint_ping_in() + "&pm_expt=" + e.deviceprint_ping_ex()
}
function g() {
var e = this === window ? {} : this;
e.index = function(n) {
return 0 === arguments.length ? e._index : void (e._index = arguments[0])
}
,
e.offset = function(n) {
return 0 === arguments.length ? e._offset : void (e._offset = arguments[0])
}
,
e.type = function(n) {
return 0 === arguments.length ? e._type : void (e._type = arguments[0])
}
,
e.serialize = function() {
var n = ","
, t = "0";
return e.index() + n + e.type() + n + t
}
,
e.toString = function() {
return "UIEvent: [index: " + e.index() + ", type: " + e.type() + ", offset: " + e.offset() + "]"
}
}
function v() {
var e = this === window ? {} : this;
e._eventCount = 0,
e.id = function(n) {
return 0 === arguments.length ? e._id : void (e._id = arguments[0])
}
,
e.index = function(n) {
return 0 === arguments.length ? e._index : void (e._index = arguments[0])
}
,
e.length = function(n) {
return 0 === arguments.length ? e._length : void (e._length = arguments[0])
}
,
e.type = function(n) {
return 0 === arguments.length ? e._type : void (e._type = arguments[0])
}
,
e.incrementEventCount = function() {
e._eventCount++
}
,
e.eventCount = function() {
return e._eventCount
}
,
e.serialize = function() {
var n = ","
, t = e.index();
return e.index() + n + t + n + e.type() + n + e.length()
}
,
e.toString = function() {
return "InteractionElement: [id: " + e.id() + ", index: " + e.index() + ", length: " + e.length() + ", type: " + e.type() + "]"
}
}
function m() {
var n = this === window ? {} : this
, t = new e
, i = new e;
n.get = function(e) {
return t.get(e)
}
,
n.getByIndex = function(e) {
return i.get(e)
}
,
n.containsKey = function(e) {
return t.containsKey(e)
}
,
n.indexByKey = function(e) {
return get(e).index()
}
,
n.size = function() {
return t.size()
}
,
n.put = function(e) {
var n = e.id();
if (!t.containsKey(n)) {
t.put(n, e);
var r = t.size();
e.index(r),
i.put(r, e)
}
}
,
n.toString = function() {
return "[size: " + t.size() + ", names: [" + t + "], indexes: [" + i + "]]"
}
}
function h(e) {
var n = null;
try {
n = document.body.getComponentVersion("{" + e + "}", "ComponentID")
} catch (t) {}
return null !== n ? n : !1
}
function _(e) {
t = "",
e = e.toLowerCase();
for (var n = e.length, i = 0; n > i; i++) {
var r = e.charAt(i);
"\n" != r && "/" != r && "\\" != r ? t += r : "\n" == r && (t += "n")
}
return t
}
function y(e, n, t) {
var i = n
, r = t
, o = e
, a = o.lastIndexOf(i);
a >= 0 && (filenameLen = o.length,
o = o.substring(a + i.length, filenameLen));
var s = o.indexOf(r);
return s >= 0 && (o = o.slice(0, s)),
o
}
n.Success = 0,
n.Fail = 1,
n.Partial = 2,
n.NotStarted = 3,
r.prototype = new c,
o.prototype = new c,
a.prototype = new c,
s.prototype.start = function() {
this.startTime = (new Date).getTime()
}
,
s.prototype.duration = function() {
return (new Date).getTime() - this.startTime
}
;
var C = {};
C.internalIP = "127.0.0.1",
C.externalIP,
C.internalPingTime,
C.externalPingTime,
C.setInternalPingTime = function(e) {
C.internalPingTime = e
}
,
C.setExternalPingTime = function(e) {
C.externalPingTime = e
}
,
C.PROXY_DETECTION_TIMEOUT = 4e3,
C.TIMEOUT_CHECK_FREQUENCY = 1e3,
C.isTimedOut = function(e, n, t) {
n -= C.TIMEOUT_CHECK_FREQUENCY,
0 >= n && (!C.internalPingTime && -1 != String(e).indexOf("internalPingTimeToSet") || !C.externalPingTime && -1 != String(e).indexOf("externalPingTimeToSet")) ? (e.call(this, -1),
t && t.abort()) : (!C.internalPingTime && -1 != String(e).indexOf("internalPingTimeToSet") || !C.externalPingTime && -1 != String(e).indexOf("externalPingTimeToSet")) && setTimeout(function() {
C.isTimedOut(e, n, t)
}, C.TIMEOUT_CHECK_FREQUENCY)
}
,
C.doAjax = function(e, n) {
var t, i, r = document.location.protocol + "//" + e + ":" + u() + "/NonExistentImage" + u() + ".gif";
if ("object" == typeof XDomainRequest) {
t = new window.XDomainRequest,
i = new s;
try {
t.timeout = C.PROXY_DETECTION_TIMEOUT,
t.ontimeout = function() {
n.call(this, -1),
t.abort()
}
,
t.onprogress = function() {
n.call(this, i.duration()),
t.abort()
}
,
t.onerror = function() {
n.call(this, i.duration())
}
,
t.open("GET", r, !0),
t.send()
} catch (o) {
var a = C.PROXY_DETECTION_TIMEOUT - i.duration();
C.doAjaxViaImage(a, n, r)
}
} else {
t = new XMLHttpRequest,
i = new s;
try {
t.onreadystatechange = function() {
4 == t.readyState && n.call(this, i.duration())
}
,
t.timeout = C.PROXY_DETECTION_TIMEOUT,
t.ontimeout = function() {
n.call(this, -1),
t.abort()
}
,
t.open("GET", r, !0),
t.send(),
setTimeout(function() {
C.isTimedOut(n, C.PROXY_DETECTION_TIMEOUT - i.duration(), t)
}, C.TIMEOUT_CHECK_FREQUENCY)
} catch (o) {
var a = C.PROXY_DETECTION_TIMEOUT - i.duration();
C.doAjaxViaImage(a, n, r)
}
}
}
,
C.doAjaxViaImage = function(e, n, t) {
var i = new Image
, r = new s;
i.onerror = function() {
n.call(this, r.duration())
}
,
i.src = t
}
,
C.collect = function() {
C.doAjax(C.externalIP, C.setExternalPingTime),
"object" == typeof XDomainRequest ? C.externalPingTime || forceIE89Synchronicity() : C.doAjax(C.internalIP, C.setInternalPingTime),
(-1 == C.externalPingTime || -1 == C.internalPingTime) && (C.setExternalPingTime(-1),
C.setInternalPingTime(-1))
}
,
forceIE89Synchronicity = function() {
C.externalPingTime ? C.doAjax(C.internalIP, C.setInternalPingTime) : setTimeout(forceIE89Synchronicity, 100)
}
,
C.isValidIPAddress = function(e) {
var n = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
if (n.test(e)) {
var t = e.split(".");
if (0 == parseInt(parseFloat(t[0])))
return !1;
for (var i = 0; i < t.length; i++)
if (parseInt(parseFloat(t[i])) > 255)
return !1;
return !0
}
return !1
}
,
C.initProxyCollection = function() {
C.isValidIPAddress(C.externalIP) && C.isValidIPAddress(C.internalIP) && C.collect()
}
;
var E = "|"
, w = "=";
this.encode_deviceprint = d;
(function() {
function e(e) {
if (T = {
output_size_limit: 1024,
collection_mode: "partial"
},
e)
for (p in e)
if (void 0 !== p._config) {
for (var n = !1, t = A.length - 1; t >= 0; t--)
A[t] != p || (found = !0);
n || (T[p] = e[p])
}
x = !1,
F = r(),
w = {
elements: new m,
events: [],
collection_status: 0,
toString: function() {
return "RecordedData: {elements: " + this.elements + ", events: " + this.events + "}"
}
},
h()
}
function n() {
for (var e = t(), n = 0, i = e.length; i > n; n++)
o(e[n])
}
function t() {
for (var e = [], n = document.getElementsByTagName("input"), t = 0, r = n.length; r > t; t++) {
var o = n[t];
i(o) && e.push(o)
}
return e
}
function i(e) {
if (e.tagName && "input" == e.tagName.toLowerCase()) {
var n = e.getAttribute("type");
if ("text" == n || "checkbox" == n || "checkbox" == n)
return !0
}
return !1
}
function r() {
var e = document.createEvent ? document.createEvent("Event") : document.createEventObject()
, n = e.timeStamp || new Date;
return n = new Date(n),
n.getYear() > 2100 && (n = new Date(n / 1e3)),
n = n.getTime()
}
function o(e) {
var n = null
, t = w.elements
, i = (t.size(),
E(e));
return w.elements.containsKey(i) ? n = t.get(i) : (n = new v,
n.id(i),
n.type(C(e)),
n.length(e.value ? e.value.length : 0),
t.put(n)),
n
}
function a(e) {
var n = e || window.event
, t = o(c(n));
t.incrementEventCount();
var i = new g;
i.index(t.index()),
i.type(_(n));
var r = l(n);
return i.offset(r - F),
w.events.push(i),
!0
}
function s(e) {
var n = e || window.event;
if (u(n)) {
var t = {
target: c(n),
type: "paste"
};
return a(t)
}
return a(n)
}
function u(e) {
if ("keydown" == e.type) {
var n = e.which || e.charCode || e.keyCode
, t = "undefined" != typeof KeyboardEvent && n == KeyboardEvent.DOM_VK_V || 118 == n || 86 == n;
if (t && (e.ctrlKey || e.metaKey))
return !0
}
return !1
}
function c(e) {
return e.target ? e.target : e.srcElement
}
function l(e) {
var n;
return e.timeStamp && 0 !== e.timeStamp ? (n = e.timeStamp,
new Date(n).getYear() > 2100 && (n /= 1e3)) : n = (new Date).getTime(),
n
}
function d(e) {}
function f() {
n();
for (var e = w.elements, t = e.size(); t >= 1; t--) {
var i = e.getByIndex(t)
, r = i.id()
, o = document.getElementById(r);
if (!o) {
var a = document.getElementsByName(r);
a.length > 0 && (o = a[0])
}
o && o.value && i.length(o.value.length)
}
}
function h() {
var e = a
, n = document;
n.addEventListener ? (n.addEventListener("keydown", s, !1),
n.addEventListener("paste", e, !1),
n.addEventListener("focus", e, !0),
n.addEventListener("blur", e, !0)) : n.attachEvent && (n.onkeydown = s,
n.onfocusin = e,
n.onfocusout = e)
}
function _(e) {
return "keydown" == e.type ? g.KeyDown : "submit" == e.type ? g.Submit : "paste" == e.type ? g.Paste : "focus" == e.type || "focusin" == e.type ? g.Focus : "blur" == e.type || "focusout" == e.type ? g.Blur : g.Unknown
}
function y(e) {
return e == g.KeyDown ? "keydown" : e == g.Submit ? "submit" : e == g.Focus ? "focus" : e == g.Blur ? "blur" : e == g.Paste ? "paste" : "unknown"
}
function C(e) {
return e.nodeName + (e.type ? ":" + e.type : "")
}
function E(e) {
return e.id ? e.id : e.name ? e.name : e.nodeName
}
var w = null
, F = null
, x = null
, T = null
, A = ["output_size_limit"];
return e(),
h(),
{
addElement: function(e) {
return o(e)
},
getEventType: function(e) {
return _(e)
},
getEventCode: function(e) {
return y(e)
},
getRecordedData: function() {
return w
},
getElementType: function(e) {
return C(e)
},
getElementId: function(e) {
return E(e)
},
initEventCollection: function(n) {
e(n)
},
getConfig: function() {
return T
},
serialize: function() {
f();
for (var e = this.getRecordedData(), n = e.elements, t = [], i = 0; i < n.length; i++)
t[i] = !1;
var r = e.events
, o = e.collection_status
, a = "partial" == this.getConfig().collection_mode
, s = this.getConfig().output_size_limit
, u = r.length
, c = "@"
, l = ";"
, p = ","
, g = 2 * c.length
, v = "" + F + p + ("" + o)
, m = 1;
g += m,
g += p.length,
g += v.length;
var h = "";
d("serializing elements ");
for (var _ = n.size(); _ > 0; _--) {
var y = n.getByIndex(_)
, C = y.serialize() + l;
if (d("elementsStr.length: " + h.length),
a && g + h.length + C.length > s) {
x = !0;
break
}
0 == y.eventCount() && (d("collecting element without input: " + y),
h = C + h)
}
h.length > 0 && (h = h.substring(0, h.length - 1)),
g += h.length;
var E = "";
for (d("serializing events "); u--; ) {
var w = r[u]
, T = w.index()
, A = w.serialize() + l
, C = n.getByIndex(T).serialize() + l
, S = A.length;
if (t[T] || (S += C.length),
d("eventsStr.length: " + E.length),
a && g + E.length + S > s) {
x = !0;
break
}
d("collecting event: " + w),
t[T] || (h = C + h,
g += C.length,
d("also adding element event: " + C)),
t[T] = !0,
E = A + E
}
E.length > 0 && (E = E.substring(0, E.length - 1));
var b = x ? 1 : 0
, D = h + c + E + c + b + p + v;
return D
}
}
}
)();
g.Unknown = 0,
g.KeyDown = 1,
g.Submit = 2,
g.Focus = 3,
g.Blur = 4,
g.Paste = 5;
var F = {
init: function() {
this.browser = this.searchString(this.dataBrowser) || "an unknown browser",
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version",
this.OS = this.searchString(this.dataOS) || "an unknown OS"
},
searchString: function(e) {
for (var n = e.length, t = 0; n > t; t++) {
var i = e[t]
, r = i.string
, o = i.prop
, a = i.identity;
if (this.versionSearchString = i.versionSearch || a,
r) {
if (-1 !== r.toLowerCase().indexOf(i.subString.toLowerCase()))
return a
} else if (o)
return a
}
},
searchVersion: function(e) {
var n = e.toLowerCase().indexOf(this.versionSearchString.toLowerCase());
if (-1 !== n) {
var t = e.substring(n + this.versionSearchString.length);
return (0 === t.indexOf(" ") || 0 === t.indexOf("/")) && (t = t.substring(1)),
parseFloat(t)
}
},
dataBrowser: [{
string: navigator.userAgent,
subString: "Chrome",
identity: "Chrome"
}, {
string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
}, {
string: navigator.userAgent.toLowerCase(),
subString: "opera",
identity: "Opera",
versionSearch: "version"
}, {
string: navigator.vendor,
subString: "Apple",
identity: "Safari",
versionSearch: "Version"
}, {
string: navigator.userAgent,
subString: "mobile safari",
identity: "Mobile Safari",
versionSearch: "mobile safari"
}, {
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
}, {
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
}, {
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
}, {
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
}, {
string: navigator.userAgent.toLocaleLowerCase(),
subString: "blackberry",
identity: "BlackBerry",
versionSearch: "0/"
}, {
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
}, {
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
}, {
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
}, {
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}],
dataOS: [{
string: navigator.userAgent,
subString: "BlackBerry",
identity: "BlackBerry"
}, {
string: navigator.userAgent.toLowerCase(),
subString: "android",
identity: "Android"
}, {
string: navigator.userAgent,
subString: "Symbian",
identity: "Symbian"
}, {
string: navigator.platform,
subString: "Mac",
identity: "Mac"
}, {
string: navigator.userAgent,
subString: "iPhone",
identity: "iPhone/iPod"
}, {
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}, {
string: navigator.userAgent,
subString: "Windows CE",
identity: "Windows CE"
}, {
string: navigator.platform,
subString: "Win",
identity: "Windows"
}]
}
}
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment