Search code examples
javascriptgeolocationlocationip-address

How to get address/location of a random person on omegle?


Omegle is a platform to connect with random persons. I want to get the location of each random person I connect with on Omegle.


Solution

  • THIS IS JUST FOR EDUCATION PURPOSE

    1. You need an API that can give the address based on the IP address. Go to https://ipgeolocation.io/, free signup, get the key, and replace in below code at YOURKEY in URL.
    2. Goto https://www.omegle.com/, open developer options, paste the code into the console. You will the address of each person connected.
    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=YOURKEY&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})
            provider: ${json.isp}
            ..................................`;
        
        console.log(output);
    
    })
    );
    };