Guest User

BehavioSec Profiling Script

a guest
Sep 28th, 2015
117
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function logout() {
  2.     trainingComplete = "", $.cookie("trainingComplete", ""), $.ajax({
  3.         type: "POST",
  4.         url: bhw_logout_endpoint,
  5.         data: {},
  6.         contentType: "text/plain",
  7.         dataType: "json",
  8.         success: function(e) {
  9.             e.success === !0 ? ($.cookie("behavioId", ""), $.cookie("sessionId", ""), $.cookie("trainingComplete", ""), bw.resetBehavioData(), bw.init(), location.href = "./", checkUI()) : bsAlert(e.message, $("#dLogin"))
  10.         }
  11.     })
  12. }
  13.  
  14. function setMetaTag(e, t) {
  15.     for (var n = document.getElementsByTagName("meta"), a = 0; a < n.length; a++) n[a].getAttribute("name") == e && ("undefined" != typeof n[a].remove ? n[a].remove() : "undefined" != typeof n[a].removeNode && n[a].removeNode());
  16.     var o = document.createElement("meta");
  17.     o.setAttribute("name", e), o.setAttribute("content", t), document.getElementsByTagName("head")[0].appendChild(o)
  18. }
  19.  
  20. function transition(e, t) {
  21.     $(e).fadeOut(300, function() {
  22.         sectionId = t, $(t).fadeIn(300), checkUI()
  23.     })
  24. }
  25.  
  26. function loginCallback() {
  27.     transition("#login", "#transaction");
  28.     setTimeout(function() {
  29.         getProgress(checkUI)
  30.     }, 100)
  31. }
  32.  
  33. function transferCallback() {
  34.     setTimeout(function() {
  35.         getSessionScore()
  36.     }, 500);
  37.     getProgress(checkUI)
  38. }
  39.  
  40. function registerValidate(e) {
  41.     var t = $("#username-register").val(),
  42.         n = $("#password-register").val(),
  43.         a = $("#password-confirm").val(),
  44.         o = !1;
  45.     return t.length < 3 ? bsAlert("Username must be at least 3 characters.", $("#username-register")) : n.length < 3 ? bsAlert("Password must be at least 3 characters.", $("#password-register")) : n != a ? bsAlert("Passwords must match.", $("#password-register")) : o = !0, o
  46. }
  47.  
  48. function getSessionScore() {
  49.     var e = "sessionid=" + encodeURIComponent(sessionid);
  50.     $.ajax({
  51.         type: "POST",
  52.         url: bhw_getreportbyid_endpoint,
  53.         data: e,
  54.         contentType: "text/plain",
  55.         dataType: "json",
  56.         success: function(e) {
  57.             if (e.session) {
  58.                 if (0 === e.data.length) return !1;
  59.                 "Training" === e.policy ? ($("#btnViewInDashboard").hide(), $("#resultMessage").html(" <h4>The transfer has been successfully completed!</h4><p>Your profile is still being trained.</p><p>You have completed <strong>" + e.reportUpdates + " of " + e.trainingLimit + " transactions</strong> needed to complete training.</p>")) : ($("#btnViewInDashboard").show(), $("#resultMessage").html(" <h4>Profile sufficiently trained!</h4><p>To see the details regarding this session and transaction, you can now access the BehavioWeb Dashboard.</p>                          <p>The Dashboard is a view that would be seen by security or antifraud staff.</p>                           <p>Typically a decision to proceed with the transaction or request further authentication from the end user is made in real time based on this score:</p>")), $.cookie("trainingComplete", e.reportUpdates / e.trainingLimit, {
  60.                     expires: .5
  61.                 }), $("#outputTransactionId").html(e.idReport), $("#outputSessionId").html(e.idSession), $("#outputTransactionPolicy").html(e.policy), $("#outputSessionPolicy").html(e.sessionPolicyClassification), $("#outputTransactionScore").html(e.score.toFixed(2)), $("#outputSessionScore").html(e.sessionScore.toFixed(2)), $("#outputTransactionConfidence").html(e.confidence.toFixed(2)), $("#outputSessionConfidence").html(e.sessionConfidence.toFixed(2)), transition("#transaction", "#results")
  62.             } else bsAlert(e.message, $("#panelResults"))
  63.         },
  64.         error: function(e) {
  65.             $("#panelResults").html(e.message)
  66.         }
  67.     })
  68. }
  69.  
  70. function validateTransferFields() {
  71.     var e = !1;
  72.     return "231187023484" != $("#from-account").val().replace(/ /g, "") ? (bsAlert("Please enter source account number", $("#from-account")), $("#from-account").focus(), e = !1) : "231187021262" != $("#to-account").val().replace(/ /g, "") ? (bsAlert("Please enter target account number", $("#to-account")), $("#to-account").focus(), e = !1) : $("#amount").val().length < 1 ? (bsAlert("Please enter an amount", $("#amount")), $("#amount").focus(), e = !1) : $("#date-of-payment").val().length < 8 ? (bsAlert("Please enter date of payment", $("#date-of-payment")), $("#date-of-payment").focus(), e = !1) : e = !0, e
  73. }
  74.  
  75. function validateLoginFields() {
  76.     var e = !1,
  77.         t = $("#username").val(),
  78.         n = $("#password").val();
  79.     return "" === t.replace(/ /g, "") ? (bsAlert("Username must not be empty", $("#username")), $("#username").focus(), e = !1) : "" === n.replace(/ /g, "") ? (bsAlert("Password must not be empty", $("#password")), $("#password").focus(), e = !1) : e = !0, e
  80. }
  81.  
  82. function bsAlert(e, t, n) {
  83.     void 0 === t && (t = $(this)), t.before("error" == n ? '<div class="alert alert-error alert-dismissable" style="margin-top:5px">' + e + "</div>" : '<div class="alert alert-success alert-dismissable" style="margin-top:5px">' + e + "</div>"), window.setTimeout(function() {
  84.         $(".alert").fadeTo(500, 0).slideUp(500, function() {
  85.             $(this).remove()
  86.         })
  87.     }, 5e3)
  88. }
  89.  
  90. function faqToggle(e) {
  91.     $("#ajaxLoader").remove(), $("#faqList").length ? $("#faqList").slideUp(300, function() {
  92.         $("#faqList").remove()
  93.     }) : ($(".btnFAQ").after('<div id="ajaxLoader" style="width:100%; text-align:center"><img align="center" width="54" height="54" src="../images/ajax-loader.gif"></div>'), $.ajax({
  94.         type: "POST",
  95.         url: bhw_faq_endpoint,
  96.         data: {},
  97.         contentType: "text/plain",
  98.         dataType: "json",
  99.         success: function(e) {
  100.             e.success && (faqList = '<ul id="faqList" style="display:none">', $.each(e.posts, function(t, n) {
  101.                 faqList += "<li><h6>" + e.posts[t].post_title + "</h6>", faqList += "<p>" + e.posts[t].post_content + "</p></li>"
  102.             }), faqList += "</ul>", $("#ajaxLoader").remove(), $(".btnFAQ").after(faqList), $("#faqList").slideDown())
  103.         }
  104.     }))
  105. }
  106.  
  107. function passwordRegisterFocus(e) {
  108.     e = $(e), 0 === $("#suggestPw").length && ($("#suggestPw").remove(), $(".important").remove(), suggestedPassword = generatePassword(4) + generatePassword(2, !1, /\d/), e.before('<div id="suggestPw" class="alert alert-error alert-dismissable" style="margin-top:5px">Suggested demo password: <h2>' + suggestedPassword + "</h2></div>"), e.after('<div class="important"><h5>Important!</h5><p>Take care to write down your password.</p></div>'), $("#suggestPw").fadeIn("slow"), $(".important").fadeIn("slow"))
  109. }
  110.  
  111. function register(e) {
  112.     return registerValidate($(this)) ? void $.ajax({
  113.         type: "POST",
  114.         url: bhw_register_endpoint,
  115.         data: {
  116.             options: JSON.stringify({
  117.                 username: $("#username-register").val(),
  118.                 password: $("#password-register").val(),
  119.                 email: $("#password-register").val()
  120.             })
  121.         },
  122.         contentType: "text/plain",
  123.         dataType: "json",
  124.         success: function(e) {
  125.             e.success === !0 ? (transition("#register", "#login"), bsAlert(e.message, $("#btnLogin"))) : bsAlert(e.message, $("#username-register"))
  126.         }
  127.     }) : !1
  128. }
  129.  
  130. function checkUI() {
  131.     $.cookie("sessionId") && "" !== $.cookie("sessionId") ? ($("#lnkLogout").show(), $("#lnkLogin a").html("Logged in as: " + $.cookie("behavioId")), drawProgressBar()) : ($("#lnkLogout").hide(), $("#lnkLogin a").html("Login"), drawProgressBar()), "#transaction" === sectionId && $("#from-account").focus(), ("#login" === sectionId || "" === sectionId) && $("#username").focus()
  132. }
  133.  
  134. function drawProgressBar() {
  135.     $.cookie("sessionId") && $.cookie("behavioId") && $.cookie("trainingComplete") && "" !== $.cookie("trainingComplete") ? (trainingComplete = $.cookie("trainingComplete"), trainingComplete > 1 && "#transaction" === sectionId && ($("#progressBar").remove(), $("#header").after('<div id="progressBar">Training Complete. Profile is sufficiently trained.</div>'), $("#messageContainer").html('<h4>Training phase completed</h4><p>When you have <strong>finished</strong> this transaction you may hand over the keyboard to another user to act as fraudster.</p><img src="../images/icon-hand-over.png" alt="icon-register">')), trainingComplete > 1 && "#results" === sectionId ? ($("#progressBar").remove(), trainingComplete = 1, $("#header").after('<div id="progressBar">Training Complete. Profile is sufficiently trained.</div>'), $("#messageContainer").html('<h4>Training phase completed</h4><p>When you have <strong>finished</strong> this transaction you may hand over the keyboard to another user to act as fraudster.</p><img src="../images/icon-hand-over.png" alt="icon-register">')) : trainingComplete > 1 && "#transaction" === sectionId ? ($("#progressBar").remove(), trainingComplete = 1, $("#header").after('<div id="progressBar">Training Complete. Profile is sufficiently trained.</div>'), $("#messageContainer").html('<h4>Training phase completed</h4><p>When you have <strong>finished</strong> this transaction you may hand over the keyboard to another user to act as fraudster.</p><img src="../images/icon-hand-over.png" alt="icon-register">')) : ("#results" === sectionId || "#transaction" === sectionId && trainingComplete < 1) && ($("#progressBar").remove(), $("#header").after('<div id="progressBar"><div id="progressIndicator"></div>' + 100 * trainingComplete + "%</div>"), $("#progressIndicator").css("width", 100 * trainingComplete - 10 + "%"), setTimeout(function() {
  136.         $("#progressIndicator").css("width", 100 * trainingComplete + "%")
  137.     }, 300))) : $("#progressBar").remove()
  138. }
  139.  
  140. function getProgress(e) {
  141.     var t = $.cookie("sessionId");
  142.     if (!t || "" === t) return $.cookie("trainingComplete", ""), !1;
  143.     var n = "sessionid=" + encodeURIComponent(t);
  144.     $.ajax({
  145.         type: "POST",
  146.         url: bhw_getreportbyid_endpoint,
  147.         data: n,
  148.         contentType: "text/plain",
  149.         dataType: "json",
  150.         success: function(t) {
  151.             if (t.session) {
  152.                 if (0 === t.data.length) return !1;
  153.                 $.cookie("trainingComplete", t.reportUpdates / t.trainingLimit, {
  154.                     expires: .5
  155.                 }), e(), "Training" === t.policy
  156.             } else bsAlert(t.message, $("#panelResults"))
  157.         },
  158.         error: function(e) {
  159.             $("#panelResults").html(e.message)
  160.         }
  161.     })
  162. }
  163.  
  164. function readyState(e) {
  165.     ("interactive" === document.readyState || "complete" === document.readyState) && e()
  166. }
  167.  
  168. function loginValidate(e) {
  169.     if (validateLoginFields()) {
  170.         var t = $("#username").val(),
  171.             n = $("#password").val();
  172.         target = e.target, $.ajax({
  173.             type: "POST",
  174.             crossDomain: !0,
  175.             url: bhw_login_endpoint,
  176.             data: {
  177.                 options: JSON.stringify({
  178.                     username: t,
  179.                     password: n
  180.                 })
  181.             },
  182.             contentType: "text/plain",
  183.             dataType: "json",
  184.             success: function(e) {
  185.                 e.success === !0 ? (sessionid = e.sessionid, userid = t, $.cookie("behavioId", userid, {
  186.                     expires: .5
  187.                 }), $.cookie("sessionId", sessionid, {
  188.                     expires: .5
  189.                 }), sendData("Login", sessionid, userid, "Transfer", loginCallback)) : bsAlert(e.message, $(target))
  190.             }
  191.         })
  192.     }
  193. }
  194.  
  195. function logout() {
  196.     trainingComplete = "", $.cookie("trainingComplete", ""), $.ajax({
  197.         type: "POST",
  198.         url: bhw_logout_endpoint,
  199.         data: {},
  200.         contentType: "text/plain",
  201.         dataType: "json",
  202.         success: function(e) {
  203.             e.success === !0 ? ($.cookie("behavioId", ""), $.cookie("sessionId", ""), $.cookie("trainingComplete", ""), bw.resetBehavioData(), bw.init(), checkUI()) : bsAlert(e.message, $("#dLogin"))
  204.         }
  205.     })
  206. }
  207.  
  208. function transferValidate(e) {
  209.     validateTransferFields() ? (sendData("Transfer", sessionid, userid, "Results", transferCallback), getProgress(checkUI)) : e.preventDefault()
  210. }
  211.  
  212. function showTooltip(e, t) {
  213.     $("#hpTooltip").remove(), $(e.target).append($('<div id="hpTooltip" class="tooltip">' + t + "</div>")), $("#hpTooltip").fadeIn()
  214. }
  215.  
  216. function hideTooltip(e) {
  217.     $("#hpTooltip").remove()
  218. }
  219.  
  220. function sendData(e, t, n, a, o) {
  221.     setMetaTag("bwjourid", t), setMetaTag("bwuuid", n), setMetaTag("bwsessid", t), setMetaTag("bwnotes", e), setMetaTag("bwpageid", a), bw.behavioData != [] && $("#behavioform").trigger("submit"), o();
  222.     setTimeout(function() {
  223.         bw.resetBehavioData(), $("input[type=text]").val(""), $("input[type=password]").val(""), bw.hasSent = !1
  224.     }, 100)
  225. }
  226.  
  227. function keyFilter(e, t) {
  228.     "8" != e.keyCode && (4 == $(t).val().length || "#date-of-payment" === t && 7 == $(t).val().length || "#date-of-payment" !== t && 9 == $(t).val().length || 15 == $(t).val().length) && $(t).val($(t).val() + " ")
  229. }
  230. bhw_base = "http://demo.behaviosec.com:8080", bhw_collector_endpoint = bhw_base + "/BehavioWebAPI/GetAjaxAsync", bhw_login_endpoint = bhw_base + "/BehavioWebDemo/Login", bhw_register_endpoint = bhw_base + "/BehavioWebDemo/Register", bhw_logout_endpoint = bhw_base + "/BehavioWebDemo/Logout", bhw_getreportbyid_endpoint = bhw_base + "/BehavioWebAPI/GetReportById", bhw_soap_endpoint = bhw_base + "/BehavioWeb/BehavioWeb?wsdl", bhw_faq_endpoint = "http://behaviosec.com/faq.php?cat=demos-faq-web", bhw_behavio_hidden_name = "behavio_hidden", $(document).ready(function() {
  231.     $(".closeWindowButton").click(function(e) {
  232.         window.close()
  233.     }), $(".btnFAQ").click(function(e) {
  234.         faqToggle(e)
  235.     }), $("#password-register").focus(function(e) {
  236.         passwordRegisterFocus("#password-register")
  237.     }), $("#btnViewInDashboard").click(function() {
  238.         window.open("../dashboard.php?sessionid=" + encodeURIComponent(sessionid))
  239.     }), $("#btnCreateAccount").click(function() {
  240.         transition("#login", "#register")
  241.     }), $("#btnCancelRegister").click(function() {
  242.         transition("#register", "#login")
  243.     }), $("#btnRegister").click(function(e) {
  244.         register()
  245.     }), $("#btnLogout").click(function() {
  246.         logout()
  247.     }), $("#lnkLogout").click(function() {
  248.         logout()
  249.     }), $("input").bind("cut copy paste", function(e) {
  250.         e.preventDefault()
  251.     }), $("textarea").bind("cut copy paste", function(e) {
  252.         e.preventDefault()
  253.     }), checkUI(), $("#dop-field").html((new Date).addDays(2).toISOString().slice(0, 10).replace(/-/g, " ")), $("#date-of-payment").attr("placeholder", (new Date).addDays(2).toISOString().slice(0, 10).replace(/-/g, " "))
  254. }), Date.prototype.addDays = function(e) {
  255.     var t = (new Date).getTime() + 864e5 * e,
  256.         n = new Date(t);
  257.     return n
  258. };
  259. var Monitor = function() {
  260.     this.init()
  261. };
  262. if (Monitor.prototype = {
  263.         isOpera: !!window.opera || navigator.userAgent.indexOf(" OPR/") >= 0,
  264.         isFirefox: "undefined" != typeof InstallTrigger,
  265.         isSafari: Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") > 0,
  266.         isChrome: !!window.chrome && !this.isOpera,
  267.         isIE9: /(MSIE 9.0)/g.test(navigator.userAgent),
  268.         isIE10: navigator.userAgent.toString().toLowerCase().indexOf("trident/6") > -1,
  269.         isIE11: !window.ActiveXObject && "ActiveXObject" in window,
  270.         isIE: /(MSIE)/g.test(navigator.userAgent),
  271.         isIOS: /(iPad|iPhone|iPod)/g.test(navigator.userAgent),
  272.         navigating: !0,
  273.         collectorEndpoint: bhw_collector_endpoint,
  274.         metaNames: {
  275.             journeyid: "bwjourid",
  276.             userid: "bwuuid",
  277.             sessionid: "bwsessid",
  278.             notes: "bwnotes"
  279.         },
  280.         sendOnLoad: "",
  281.         monitorElementIds: [],
  282.         ignoreFieldIds: [],
  283.         behavioData: [],
  284.         anonMap: [],
  285.         syncTimeout: 2e3,
  286.         startTime: (new Date).getTime(),
  287.         lastViewport: [-1, -1],
  288.         lastTarget: null,
  289.         capture: !0,
  290.         hasSent: !1,
  291.         behavio_hidden: null,
  292.         haveMouse: !1,
  293.         timings: null,
  294.         behavioweb_config: {
  295.             anonymous: {
  296.                 by_name: [],
  297.                 by_id: [],
  298.                 by_type: ["password"]
  299.             }
  300.         },
  301.         init: function() {
  302.             var e = setInterval(function() {
  303.                 "complete" === document.readyState && (bw.resetBehavioData(), bw.startMonitor(), this.initialized = !0, clearInterval(e))
  304.             }, 100)
  305.         },
  306.         createCORSRequest: function(e, t, n) {
  307.             n = !1;
  308.             var a = new XMLHttpRequest;
  309.             return "withCredentials" in a ? (a.open(e, t, n), bw.isIE && !n && (a.timeout = bw.syncTimeout), a.setRequestHeader("Content-Type", "text/plain")) : "undefined" != typeof XDomainRequest ? (a = new XDomainRequest, a.open(e, t, n), n || (a.timeout = bw.syncTimeout)) : a = "undefined" != typeof ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : null, null !== a && "undefined" != typeof a.setRequestHeader && a.setRequestHeader("Content-Type", "text/plain"), a
  310.         },
  311.         prepHttpStr: function(e) {
  312.             var t = "";
  313.             return "" !== e.data.journeyid && "undefined" != typeof e.data.journeyid && (t += "journeyid=" + encodeURIComponent(e.data.journeyid)), "" !== e.data.sessionid && "undefined" != typeof e.data.sessionid && (t += "&sessionid=" + encodeURIComponent(e.data.sessionid)), "" !== e.data.userid && "undefined" != typeof e.data.userid && (t += "&userid=" + encodeURIComponent(e.data.userid)), t += "&notes=" + encodeURIComponent(e.data.notes), "undefined" != typeof e.data.behavioData && (t += "&data=" + encodeURIComponent(JSON.stringify(e.data.behavioData))), t
  314.         },
  315.         ajax: function(e) {
  316.             {
  317.                 var t, n = bw.collectorEndpoint;
  318.                 e.type
  319.             }
  320.             t = e.async, t = bw.isChrome || bw.isOpera ? !0 : bw.isSafari ? !1 : bw.isIE9 || bw.isIE10 || bw.isIE11 ? !1 : bw.navigating ? !1 : !0;
  321.             var a = bw.createCORSRequest("post", n, t);
  322.             bw.httpStr = bw.prepHttpStr(e), bw.isIOS || bw.isIE11 || bw.isIE10 ? a.send(bw.httpStr) : setTimeout(function() {
  323.                 a.send(bw.httpStr)
  324.             }, 0)
  325.         },
  326.         getMeta: function(e) {
  327.             var t, n, a = "";
  328.             if ("undefined" != typeof bw.metaNames[e])
  329.                 for (e = bw.metaNames[e], n = document.getElementsByTagName("meta"), t = 0; t < n.length; t++)(e === n[t].name || e === n[t].getAttribute("property")) && (a = n[t].content), bw.debug === !0 && "" === a && null !== document.getElementById(e) && (a = document.getElementById(e).value);
  330.             return a
  331.         },
  332.         getBehavioData: function() {
  333.             return "object" == typeof this.behavioData ? this.behavioData : !1
  334.         },
  335.         resetBehavioData: function() {
  336.             for (;
  337.                 "object" == typeof this.behavioData.pop(););
  338.             return !0
  339.         },
  340.         submitHandler: function(e) {
  341.             if (bw.hasSent) return !0;
  342.             bw.hasSent = !0, bw.navigating = !1;
  343.             var t = {
  344.                 journeyid: bw.getMeta("journeyid"),
  345.                 sessionid: bw.getMeta("sessionid"),
  346.                 userid: bw.getMeta("userid"),
  347.                 notes: bw.getMeta("notes"),
  348.                 behavioData: bw.getBehavioData()
  349.             };
  350.             if (bw.isIE) {
  351.                 e.preventDefault && e.preventDefault();
  352.                 var n = e.target || e.srcElement;
  353.                 return e.returnValue = !1, setTimeout(function() {
  354.                     n.submit()
  355.                 }, 150), bw.ajax({
  356.                     type: "post",
  357.                     url: bw.collectorEndpoint,
  358.                     async: !0,
  359.                     data: t
  360.                 }), !1
  361.             }
  362.             bw.ajax({
  363.                 type: "post",
  364.                 url: bw.collectorEndpoint,
  365.                 async: !0,
  366.                 data: t
  367.             })
  368.         },
  369.         addKeyEvent: function(e, t, n) {
  370.             var a, o;
  371.             for (a = this.behavioData.length - 1; a >= -1; a--) {
  372.                 if (-1 === a) {
  373.                     null === this.behavioData[0] ? (this.behavioData[0] = [], "a" === t ? this.behavioData[0][0] = "fa" : "n" === t && (this.behavioData[0][0] = "f"), this.behavioData[0][1] = e, this.behavioData[0][2] = [], this.behavioData[0][2][0] = n) : (o = this.behavioData.length, this.behavioData[o] = [], "a" === t ? this.behavioData[o][0] = "fa" : "n" === t && (this.behavioData[o][0] = "f"), this.behavioData[o][1] = e, this.behavioData[o][2] = [], this.behavioData[o][2][0] = n);
  374.                     break
  375.                 }
  376.                 if ("a" === t) {
  377.                     if ("fa" !== this.behavioData[a][0]) continue
  378.                 } else if ("n" === t && "f" !== this.behavioData[a][0]) continue;
  379.                 if (this.behavioData[a][1] === e) {
  380.                     this.behavioData[a][2][this.behavioData[a][2].length] = n;
  381.                     break
  382.                 }
  383.             }
  384.         },
  385.         addEvent: function(e, t) {
  386.             var n, a;
  387.             for (n = this.behavioData.length - 1; n >= -1; n--) {
  388.                 if (-1 === n) {
  389.                     null === this.behavioData[0] ? (this.behavioData[0] = [], this.behavioData[0][0] = "c", this.behavioData[0][1] = [], this.behavioData[0][1][0] = e, this.behavioData[0][2] = window.location.pathname.split("?")[0]) : (a = this.behavioData.length, this.behavioData[a] = [], this.behavioData[a][0] = "c", this.behavioData[a][1] = [], this.behavioData[a][1][0] = e, this.behavioData[a][2] = window.location.pathname.split("?")[0]);
  390.                     break
  391.                 }
  392.                 if ("c" === this.behavioData[n][0]) {
  393.                     this.behavioData[n][1][this.behavioData[n][1].length] = e;
  394.                     break
  395.                 }
  396.             }
  397.         },
  398.         getTimestamp: function() {
  399.             var e = new Date;
  400.             return e.getTime() - this.startTime
  401.         },
  402.         checkTarget: function(e) {
  403.             var t = document.elementFromPoint(e.clientX, e.clientY),
  404.                 n = [];
  405.             null !== t && t !== this.lastTarget && void 0 !== typeof t.parentNode && (n[0] = "t", n[1] = t.nodeName + "#" + t.id + "#" + t.parentNode.nodeName + "#" + t.parentNode.id, n[2] = bw.getTimestamp(), this.lastTarget = t, bw.addEvent(n))
  406.         },
  407.         checkViewport: function() {
  408.             if (this.lastViewport[0] !== document.documentElement.clientWidth || this.lastViewport[1] !== document.documentElement.clientHeight) {
  409.                 var e = [];
  410.                 e[0] = "v", e[1] = document.documentElement.clientWidth, e[2] = document.documentElement.clientHeight, e[3] = bw.getTimestamp(), this.lastViewport[0] = document.documentElement.clientWidth, this.lastViewport[1] = document.documentElement.clientHeight, bw.addEvent(e)
  411.             }
  412.         },
  413.         mouseMoveHandler: function(e) {
  414.             var t = [];
  415.             t[0] = "mm", t[1] = e.clientX, t[2] = e.clientY, t[3] = bw.getTimestamp(), bw.checkTarget(e), bw.checkViewport(), bw.addEvent(t)
  416.         },
  417.         mouseDownHandler: function(e) {
  418.             var t = [];
  419.             t[0] = "md", t[1] = e.clientX, t[2] = e.clientY, t[3] = bw.getTimestamp(), t[4] = e.button, bw.checkTarget(e), bw.checkViewport(), bw.addEvent(t)
  420.         },
  421.         mouseUpHandler: function(e) {
  422.             var t = [];
  423.             t[0] = "mu", t[1] = e.clientX, t[2] = e.clientY, t[3] = bw.getTimestamp(), t[4] = e.button, bw.checkTarget(e), bw.checkViewport(), bw.addEvent(t)
  424.         },
  425.         keyHandler: function(e) {
  426.             var t, n = [],
  427.                 a = e.keyCode,
  428.                 o = a,
  429.                 i = null,
  430.                 s = e.currentTarget ? e.currentTarget : e.srcElement,
  431.                 r = "n",
  432.                 d = 0;
  433.             if (i = s.type + "#" + s.name, null === a && (a = -500, o = -500), "a" !== r) {
  434.                 for (t = 0; t < bw.behavioweb_config.anonymous.by_id.length && "a" !== r; t++) bw.behavioweb_config.anonymous.by_id[t] === s.id && (r = "a");
  435.                 for (t = 0; t < bw.behavioweb_config.anonymous.by_name.length && "a" !== r; t++) bw.behavioweb_config.anonymous.by_name[t] === s.name && (r = "a");
  436.                 for (t = 0; t < bw.behavioweb_config.anonymous.by_type.length && "a" !== r; t++) bw.behavioweb_config.anonymous.by_type[t] === s.type && (r = "a")
  437.             }
  438.             if ("a" === r) {
  439.                 if (9 === a || 13 === a) return;
  440.                 if (document.selection) {
  441.                     s.focus();
  442.                     var c = document.selection.createRange(),
  443.                         l = document.selection.createRange().text.length;
  444.                     c.moveStart("character", -s.value.length), d = c.text.length - l
  445.                 } else(s.selectionStart || 0 === s.selectionStart) && (d = s.selectionStart);
  446.                 8 === a ? "keydown" === e.type ? (void 0 === bw.anonMap[a] && (bw.anonMap[a] = d), n[0] = -1, n[1] = d) : "keyup" === e.type && (n[0] = -2, n[1] = bw.anonMap[a], bw.anonMap[a] = null) : 46 === a ? "keydown" === e.type ? (void 0 === bw.anonMap[a] && (bw.anonMap[a] = d), n[0] = -3, n[1] = d) : "keyup" === e.type && (n[0] = -4, n[1] = bw.anonMap[a], bw.anonMap[a] = null) : "keydown" === e.type ? (void 0 === bw.anonMap[a] && (bw.anonMap[a] = d), n[0] = 0, n[1] = d) : "keyup" === e.type && (n[0] = 1, n[1] = bw.anonMap[a], bw.anonMap[a] = null)
  447.             } else "keyup" === e.type ? (n[0] = 1, n[1] = o) : "keydown" === e.type && (n[0] = 0, n[1] = o);
  448.             n[2] = bw.getTimestamp(), null !== n[1] && bw.addKeyEvent(i, r, n)
  449.         },
  450.         startMonitor: function() {
  451.             var e, t, n, a, o, i = document.getElementsByTagName("form");
  452.             for (e = 0; e < i.length; e++) {
  453.                 for (n = i[e], "undefined" != typeof jQuery ? $("form").submit(bw.submitHandler) : n.addEventListener ? n.addEventListener("submit", bw.submitHandler, !1) : n.attachEvent && n.attachEvent("onsubmit", bw.submitHandler), a = n.getElementsByTagName("textarea"), t = 0; t < a.length; t++) o = a[t], -1 !== this.monitorElementIds.indexOf(o.id) && (o.addEventListener ? (o.addEventListener("keydown", this.keyHandler, !1), o.addEventListener("keyup", this.keyHandler, !1)) : o.attachEvent && (o.attachEvent("onkeydown", this.keyHandler), o.attachEvent("onkeyup", this.keyHandler)));
  454.                 for (a = n.getElementsByTagName("input"), t = 0; t < a.length; t++) o = a[t], -1 !== this.monitorElementIds.indexOf(o.id) && (o.addEventListener ? (o.addEventListener("keydown", this.keyHandler, !1), o.addEventListener("keyup", this.keyHandler, !1)) : o.attachEvent && (o.attachEvent("onkeydown", this.keyHandler), o.attachEvent("onkeyup", this.keyHandler)));
  455.                 for (a = n.getElementsByTagName("select"), t = 0; t < a.length; t++) o = a[t], -1 !== this.monitorElementIds.indexOf(o.id) && (o.addEventListener ? (o.addEventListener("keydown", this.keyHandler, !1), o.addEventListener("keyup", this.keyHandler, !1)) : o.attachEvent && (o.attachEvent("onkeydown", this.keyHandler), o.attachEvent("onkeyup", this.keyHandler)))
  456.             }
  457.             this.haveMouse === !0 && (document.addEventListener ? (document.addEventListener("mousedown", this.mouseDownHandler, !1), document.addEventListener("mouseup", this.mouseUpHandler, !1), document.addEventListener("mousemove", this.mouseMoveHandler, !1)) : document.attachEvent && (document.attachEvent("onmousedown", this.mouseDownHandler), document.attachEvent("onmouseup", this.mouseUpHandler), document.attachEvent("onmousemove", this.mouseMoveHandler)));
  458.             var s = {};
  459.             for (e in s) s[e] = s[e];
  460.             delete s.plugins, delete s.mimeTypes;
  461.             var r = {};
  462.             for (e in r) r[e] = r[e];
  463.             if (this._navigator = s, this._screen = r, this.behavioData[0] = ["m", "n", s], this.behavioData[1] = ["m", "s", r], this.behavioData[2] = ["m", "v", 250], "" !== bw.sendOnLoad && -1 !== window.location.pathname.split("?")[0].indexOf(bw.sendOnLoad)) {
  464.                 var d;
  465.                 d = {
  466.                     journeyid: bw.getMeta("journeyid"),
  467.                     sessionid: bw.getMeta("sessionid"),
  468.                     userid: bw.getMeta("userid"),
  469.                     notes: bw.getMeta("notes")
  470.                 }, bw.ajax({
  471.                     type: "post",
  472.                     url: bw.collectorEndpoint,
  473.                     async: !0,
  474.                     data: d
  475.                 })
  476.             }
  477.         }
  478.     }, document.all && !document.querySelector);
  479. else var bw = new Monitor;
  480. "undefined" == typeof console && (console = {
  481.     log: function() {},
  482.     info: function() {},
  483.     error: function() {},
  484.     warn: function() {}
  485. }), Date.now = Date.now || function() {
  486.     return +new Date
  487. }, Array.prototype.indexOf || (Array.prototype.indexOf = function(e, t) {
  488.     var n, a;
  489.     for (n = t || 0, a = this.length; a > n; n++)
  490.         if (this[n] === e) return n;
  491.     return -1
  492. });
  493. var sessionid, userid, target, sectionId = "#login";
  494. $(document).ready(function() {
  495.     setTimeout(function() {
  496.         bw.monitorElementIds = ["from-account", "to-account", "username", "password", "amount", "date-of-payment"], $("#btnLogin").click(function(e) {
  497.             loginValidate(e)
  498.         }), $("#btnTransfer").click(function(e) {
  499.             transferValidate(e)
  500.         }), $("#lnkLogout").click(function() {
  501.             $("#results").hide(), $("#register").hide(), $("#transaction").hide(), $("#login").hide(), $("#login").fadeIn(300, function() {
  502.                 getProgress(checkUI)
  503.             })
  504.         }), $("#btnNewTransfer").click(function() {
  505.             $.ajax({
  506.                 type: "POST",
  507.                 url: bhw_logout_endpoint,
  508.                 data: {},
  509.                 contentType: "text/plain",
  510.                 dataType: "json",
  511.                 success: function(e) {
  512.                     e.success === !0 ? (bw.resetBehavioData(), $.cookie("behavioId", ""), $.cookie("sessionId", ""), transition("#results", "#login")) : (bsAlert(e.message, $("#dLogin")), transition("#results", "#login"))
  513.                 }
  514.             })
  515.         }), $("#password").keydown(function(e) {
  516.             return 13 === e.keyCode ? (loginValidate(e), !1) : void 0
  517.         }), $("#date-of-payment").keydown(function(e) {
  518.             return 13 === e.keyCode ? (transferValidate(e), !1) : void 0
  519.         }), $("#from-account").keyup(function(e) {
  520.             keyFilter(e, "#from-account")
  521.         }), $("#to-account").keyup(function(e) {
  522.             keyFilter(e, "#to-account")
  523.         }), $("#date-of-payment").keyup(function(e) {
  524.             keyFilter(e, "#date-of-payment")
  525.         }), $("#behavioform").submit(function(e) {
  526.             e.preventDefault()
  527.         }), $(".navbar-item.disabled a").hover(function(e) {
  528.             showTooltip(e, "This is a mock application, navigation disabled.")
  529.         }, function(e) {
  530.             hideTooltip(e)
  531.         })
  532.     }, 10)
  533. });
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×