1

Code:

var findIP = new Promise(r => { var w: any = window, a = new (w.RTCPeerConnection || w.mozRTCPeerConnection || w.webkitRTCPeerConnection)({ iceServers: [] }), b = () => { }; a.createDataChannel(""); a.createOffer(c => a.setLocalDescription(c, b, b), b); a.onicecandidate = c => { try { c.candidate.candidate.match(/([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g).forEach(r) } catch (e) { } } })
      findIP.then(function (ip) {
        console.log(ip)
      })

Now this piece of code used to return private IP of the user but now it returns an mDNS .local string.

Use Case: I have an angular app where I need to monitor which client has made what changes and prepare logs accordingly(feature requested by client). Is there any way I can gather private IP without having to ask for camera permission or disabling chrome flag?

Sid Xyz0
  • 11
  • 1
  • 2
    Does this answer your question? [Is it possible to get a user's IP address by decoding the mDNS string received with the help of webRTC?](https://stackoverflow.com/questions/70756416/is-it-possible-to-get-a-users-ip-address-by-decoding-the-mdns-string-received-w) – Philipp Hancke Apr 14 '22 at 06:46

0 Answers0