ursus contionabundo: Bitte. Ich bin übrigens stark entgeistert....

Beitrag lesen

problematische Seite

Hier der getestete "Stand-Alone-Nachbau". Ich halte das übrigens für ein Sicherheitsrisiko, weil es missbraucht werden kann um einem Angreifer Informationen zu liefern.

<html>
<p>Lokale IP: <span id="locIP">Unbekannt</span></p>

<script>
function checkLocal() {
	window.RTCPeerConnection = window.RTCPeerConnection 
	|| window.mozRTCPeerConnection 
	|| window.webkitRTCPeerConnection;   //compatibility for firefox and chrome

	var pc = new RTCPeerConnection( { iceServers: [] } ), noop = function () { };

		pc.createDataChannel("");    //create a bogus data channel
		pc.createOffer(pc.setLocalDescription.bind(pc), noop);    // create offer and set local description

		pc.onicecandidate = function (ice) {  //listen for candidate events
			
			if (!ice || !ice.candidate || !ice.candidate.candidate) {
				return;
			}

			var myIP = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec( ice.candidate.candidate )[1];
            document.getElementById('locIP').innerHTML = myIP;

			pc.onicecandidate = noop;
		};
}
checkLocal();
</script>
</html>

Resultat: