You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the feature
A feature to prevent WebRTC leaks in Chrome, specifically to secure real/local IP information.
Motivation
For web scraping, preventing WebRTC leaks is essential. Blocking IP leaks through WebRTC helps maintain the scraper’s anonymity, even when using VPNs or proxies, reducing the risk of detection and IP exposure.
Constraints
Ensure that this feature does not interfere with WebRTC functionality in contexts where it’s intentionally enabled.
Maintain minimal impact on browser performance during scraping sessions.
Proposed solution for Chrome
I have tested this one in Chrome in the unblocking project I am working on, and it worked. see the attached screenshot.
constscript=`const inject = () => { if (window.hasRunWebRTCControl) return; window.hasRunWebRTCControl = true; // Override RTCPeerConnection to prevent IP leaks const OriginalRTCPeerConnection = window.RTCPeerConnection; function RTCPeerConnectionModified(config, constraints) { if (config && config.iceServers) config.iceServers = []; return new OriginalRTCPeerConnection(config, constraints); } RTCPeerConnectionModified.prototype = OriginalRTCPeerConnection.prototype; window.RTCPeerConnection = RTCPeerConnectionModified; // Disable getUserMedia for camera/microphone access navigator.mediaDevices.getUserMedia = () => Promise.reject(new Error('getUserMedia is disabled.')); console.log("WebRTC protection injected");};inject();`;// Inject the script at page loadawaitpage.addInitScript(script);
I am not sure if this is the right repository for this particular issue since I see there is already a code for it, but it is not used in any of our crawlers.
Before in default playwright crawler:
After:
The text was updated successfully, but these errors were encountered:
Yes, you can effectively disable WebRTC in the browser by generating a fingerprint with mockWebRTC: true (and injecting it). As far as I remember, the patch creates a Proxy object that catches all function calls and just immediately resolves with undefined (and does this recursively) - something like your patch for navigator.mediaDevices.getUserMedia.
Can you please verify that mockWebRTC works for you? If it broke in some cases, I'm more than happy to switch for your implementation - I always thought the current one was a little bit crude. Cheers!
B4nan
added
the
t-tooling
Issues with this label are in the ownership of the tooling team.
label
Nov 4, 2024
Describe the feature
A feature to prevent WebRTC leaks in Chrome, specifically to secure real/local IP information.
Motivation
For web scraping, preventing WebRTC leaks is essential. Blocking IP leaks through WebRTC helps maintain the scraper’s anonymity, even when using VPNs or proxies, reducing the risk of detection and IP exposure.
Constraints
Proposed solution for Chrome
I have tested this one in Chrome in the unblocking project I am working on, and it worked. see the attached screenshot.
I am not sure if this is the right repository for this particular issue since I see there is already a code for it, but it is not used in any of our crawlers.
Before in default playwright crawler:
After:
The text was updated successfully, but these errors were encountered: