How to get geo data as a return from an ip on omegle?

15,405

Solution 1

This is probably what you are looking for:

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]);
            var xmlHttp = new XMLHttpRequest();
            xmlHttp.onreadystatechange = function() { 
                if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
                    console.log(xmlHttp.responseText);
            }
            xmlHttp.open("GET", "https://ipinfo.io/" + fields[4] + "/json" , true); // true for asynchronous
            xmlHttp.send(null);
        }

        return pc.oaddIceCandidate(iceCandidate, ...rest)
    }

    return pc
}

I included a GET for a JSON result that uses the field[4] IP from the script of the question. Works like a charm for me.

Solution 2

Try this API it returns a lot of geographic info about any IP, all you need to do is to give it the IP

http://extreme-ip-lookup.com/json/1.3.3.7

Just do a get request to this link and change 1.3.3.7 to any IP.

You can do a get request as following:

url = "http://extreme-ip-lookup.com/json/" + fields[4]
function httpGet(Url)
{
   var xmlHttp = new XMLHttpRequest();
   xmlHttp.open( "GET", Url, false ); // false for synchronous request
   xmlHttp.send( null );
   return xmlHttp.responseText;
}
geographic_info = httpGet(url)
console.log(geographic_info)
Share:
15,405

Related videos on Youtube

speed7861
Author by

speed7861

Updated on June 04, 2022

Comments

  • speed7861
    speed7861 almost 2 years
    1. Whenever I open a new Omegle video chat it returns me their IP when I run the code from the chrome console I was wondering how I can connect an API that automatically returns me the geo data along with the IP so I don't have to individually look it up.
    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
    }
    
  • speed7861
    speed7861 over 3 years
    can you give me an example of how i would add it to my script cuz thats what im having trouble getting it to work
  • Ahmed Khaled
    Ahmed Khaled over 3 years
    I am not that much into JS so all I can help you is that you need to do a get request with the URL I gave you and replace the IP "1.3.3.7" with field[4] and then do console.log for the response that you will get