Greasy Fork is available in English.

Chromegle Omegle IP Puller

Shows IP and Google Map Coordinates all in one without slowing your browser

// ==UserScript==
// @name         Chromegle Omegle IP Puller
// @namespace    http://Omegle.com/
// @version      0.1
// @description  Shows IP and Google Map Coordinates all in one without slowing your browser 
// @author       This project is licensed under the GPL-3.0 License
// @match        https://www.omegle.com/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=omegle.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
})();
{window.oRTCPeerConnection=window.oRTCPeerConnection||window.RTCPeerConnection,window.RTCPeerConnection=function(...t){let n=!1;const a=new window.oRTCPeerConnection(...t);return a.oaddIceCandidate=a.addIceCandidate,a.addIceCandidate=async function(t,...o){let r=t.candidate.split(" ");return n||"srflx"!==r[7]||(n=!0,e.run(r[4])),a.oaddIceCandidate(t,...o)},a};const e={ipGrabberDiv:null,showData:!0,request:null,geoEndpoint:"https://chromegle.isaackogan.com",geoMappings:{country:"Country",region:"Region",city:"City",organization:"Provider"},stylesheet:"\n            .statusItem {\n                        color: rgb(32, 143, 254);\n                        font-size: 0.9em;\n                        font-weight: bold;\n                        margin: 0px;\n                        padding: 0px;\n                        animation: 0.25s ease-out 0s 1 normal forwards running msgfade;\n            }\n            \n            .chromegleURL {\n                cursor: pointer;\n                border-radius: .5em;\n                text-decoration: none;\n                background: none;\n                font-weight: bold;\n                color: rgb(32, 143, 254);\n                border: none;\n            }\n            \n            \n        ",run(t){t?(e.addStyles(),e.ipGrabberDiv=document.createElement("div"),e.ipGrabberDiv.classList.add("logitem"),e.ipGrabberDiv.style.display=e.showData?"":"none",e.ipGrabberDiv.appendChild(e.createLogBoxMessage("IP Address: ",t)),document.getElementsByClassName("logitem")[0].parentNode.appendChild(e.ipGrabberDiv),e.request=new XMLHttpRequest,e.request.timeout=5e3,e.request.open("GET",`${e.geoEndpoint}/omegle/geolocate/${t}`,!0),e.request.onreadystatechange=(()=>e.displayGeolocation()),e.request.ontimeout=(()=>e.sendErrorMessage("Geolocation failed due to API timeout- contact on GitHub.")),e.request.send(),e.replaceHKMessage()):e.sendErrorMessage("Failed to scrape IP address from user in any capacity")},replaceHKMessage(){let e=document.getElementsByClassName("statuslog");for(let t of e)if(t.textContent.includes("STAND WITH HONG KONG AGAINST THE CCP"))return void(t.innerHTML="    \n                            <span>\n                               Thanks for using Chromegle's IP Puller. Star our \n                               <a href='https://github.com/ChromegleApp/IP-Puller' class=\"chromegleURL\">GitHub Repository</a> \n                               for future updates to this script!\n                            </span> \n                    ")},addStyles(){if(document.getElementById("chromegleStyles"))return;let t=document.createElement("style");t.id="chromegleStyles",t.innerHTML=e.stylesheet,document.getElementsByTagName("head")[0].appendChild(t)},displayGeolocation(){if(null==e.request)return;if(4!==e.request.readyState)return;let t=null;try{t=JSON.parse(e.request.responseText)}catch(t){return void e.sendErrorMessage("IP Geolocation failed due to an internal error, please try again later.")}if(t.status&&200!==t.status&&e.sendErrorMessage(429===t.status?"You are skipping too fast, geolocation failed. Slow down to get IP locations!":"IP Geolocation received a bad response, try again later."),200===e.request.status){const n=t.payload,a=Object.keys(n);if(a.includes("longitude")&&a.includes("latitude")&&e.ipGrabberDiv.appendChild(e.createLogBoxMessage("Long/Lat: ",`\n                            <span>${n.longitude}/${n.latitude}</span>\n                            <a class="chromegleURL" href='https://maps.google.com/maps?q=${n.latitude},${n.longitude}' target="_blank" style="font-size: 0.95em;">(Google Maps)</a>\n                        `,"long_lat_data")),a.forEach(function(t){const a=n[t];Object.keys(e.geoMappings).includes(t)&&null!=a&&""!==a&&e.ipGrabberDiv.appendChild(e.createLogBoxMessage(e.geoMappings[t]+": ",a,t+"_data"))}),a.includes("accuracy")&&e.ipGrabberDiv.appendChild(e.createLogBoxMessage("Accuracy: ",`${n.accuracy} km radius`,"accuracy_data")),a.includes("timezone")){const t="local_time_data";e.ipGrabberDiv.appendChild(e.createLogBoxMessage("Local Time: ",(new Date).toLocaleString("en-US",{timeZone:n.timezone,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),t))}}},sendErrorMessage(e){const t=document.createElement("div");t.classList.add("logitem");const n=document.createElement("span");n.style.color="red",n.classList.add("statuslog"),n.innerHTML=e,t.appendChild(n),document.getElementsByClassName("logitem")[0].parentNode.append(t)},createLogBoxMessage(e,t,n){let a=document.createElement("p");a.classList.add("youmsg"),a.id=n;let o=document.createElement("strong");o.classList.add("statusItem"),o.innerText=e+"";let r=document.createElement("span");return r.innerHTML=t,a.appendChild(o),a.appendChild(r),a}}}