Spoofing Browser Fingerprint in Selenium?

Sam Green

Junior Member
Joined
Dec 15, 2016
Messages
134
Reaction score
31
Im currently trying to use https://addons.mozilla.org/en-US/firefox/addon/random-agent-spoofer/, a firefox extension, to randomize my fingerprint. By default though a lot of its better spoofing settings like timezone spoofing and setting my user agent to mobile are disabled.

I cant find any way to edit the extension settings from selenium webdriver (python). Does anyone know where extensions save their settings? Or if not a better way of spoofing my browser fingerprint in selenium?
 
Last edited:
I am currently using MultiLoginApp, it appears to be an independent spoofing and proxy app which supports chrome, firefox and many more.
 
Short answer: you cannot edit add-on settings through selenium webdriver.

If you want to automate browser fingerprint management, you need software like Multiloginapp. Here you can get a feeling of its API https://multiloginapp.com/documentation-automation-api/ and here see some automation examples https://github.com/multiloginapp

turns out selenium can actually edit extension settings actually. Extension settings are stored in the about:config menu where firefox stores all its other settings.

in selenium you can edit about:config options including those of the extensions :D
 
turns out selenium can actually edit extension settings actually. Extension settings are stored in the about:config menu where firefox stores all its other settings.

in selenium you can edit about:config options including those of the extensions :D

Sorry for misinforming you then. Frankly didn't know about this possibility.
 
Sorry for misinforming you then. Frankly didn't know about this possibility.

No problem. The information about extension settings being stored there was rather hard to find. And your Multiloginapp suggestion is interesting I'll have to look into that.
 
create a profile where you store the user-agent you want (and other stuff) :

profile = webdriver.FirefoxProfile('/home/user/.mozilla/firefox/n34w7dcm.user/')
profile.set_preference("general.useragent.override","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0")
profile.set_preference("places.history.enabled", False)
profile.set_preference("privacy.clearOnShutdown.offlineApps", True)
profile.set_preference("privacy.clearOnShutdown.passwords", True)
profile.set_preference("privacy.clearOnShutdown.siteSettings", True)
profile.set_preference("privacy.sanitize.sanitizeOnShutdown", True)
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile=profile)
 
It's trustable for sure. I was skeptical at first as to how well it can generate fresh fingerprints and handle all the browser side of things for me. Before I started using them, I was wasting time researching fingerprints and ways sites detect if you are running with selenium (gecko driver / chome driver). They even got their own browser call mimic which is their version of google chrome which helped me A LOT. Feel free to hit me up if you need any help with automating with 3rd party apps.
 
i wrote a universal function to your projects to change random useragent in selenium. Create file useragents.txt and put different useragents in the column. Forum hasn't function to add python code, so i add this code to php quote

PHP:
from random import choice

useragents = open("useragents.txt").read().split("\n")
user_agent = choice(useragents) # choice random useragent from file

def FF_config(USERAGENT):    #update useragent function
    fp = webdriver.FirefoxProfile()
    fp.set_preference("general.useragent.override",USERAGENT) # choice useragent
    fp.set_preference("media.peerconnection.enabled", False) # disable webrtc
    fp.set_preference("plugin.state.flash", 0) # disable flash
    fp.set_preference("general.useragent.locale","en")
    fp.update_preferences() #save settings
    return webdriver.Firefox(firefox_profile=fp)

driver = FF_config(user_agent) # init web driver with random useragent
 
i wrote a universal function to your projects to change random useragent in selenium. Create file useragents.txt and put different useragents in the column. Forum hasn't function to add python code, so i add this code to php quote

PHP:
from random import choice

useragents = open("useragents.txt").read().split("\n")
user_agent = choice(useragents) # choice random useragent from file

def FF_config(USERAGENT):    #update useragent function
    fp = webdriver.FirefoxProfile()
    fp.set_preference("general.useragent.override",USERAGENT) # choice useragent
    fp.set_preference("media.peerconnection.enabled", False) # disable webrtc
    fp.set_preference("plugin.state.flash", 0) # disable flash
    fp.set_preference("general.useragent.locale","en")
    fp.update_preferences() #save settings
    return webdriver.Firefox(firefox_profile=fp)

driver = FF_config(user_agent) # init web driver with random useragent
Thanks for sharing, but also keep in mind that if your file with useragents contains totally random stuff like mix of windows, linux and mobile UAs, then it's not gonna work well because each UA has bunch of other properties that you need to maintain to make it look legit.
 
You can make separate files with different useragents from different operating systems and call the desired user-agent if necessary. It depends on what the task is? Oh, sorry for my language, i'm trying to teach English ))
 
It's trustable for sure. I was skeptical at first as to how well it can generate fresh fingerprints and handle all the browser side of things for me. Before I started using them, I was wasting time researching fingerprints and ways sites detect if you are running with selenium (gecko driver / chome driver). They even got their own browser call mimic which is their version of google chrome which helped me A LOT. Feel free to hit me up if you need any help with automating with 3rd party apps.
Is it able to automate in multilogin?
I am struggling to hide fingerprints on browsers like chrome or firefox.
 
This is useful stuff!

Multilogin costs $450 per month for rest api and cli access

Is it possible to automate a browser with selenium, in such a way that it can't be identified as being selenium driven?
 
This is useful stuff!

Multilogin costs $450 per month for rest api and cli access

Is it possible to automate a browser with selenium, in such a way that it can't be identified as being selenium driven?
My developer did this, I am not able to give you specific hints but what I can say is yes, you can do that with selenium and you don't have to pay 450$ a month for multilogin app.
And btw multilogin canvas noise from what I've seen, is detectable.

Remember that you will have to figure out proper combinations of user agents and all other parameters in order to make to look legit. You cannot change randomly every parameter. You can change fonts, resolution, user agents, webgl and everything else. We avoided only canvas as it was too difficult
 
This is useful stuff!

Multilogin costs $450 per month for rest api and cli access

Is it possible to automate a browser with selenium, in such a way that it can't be identified as being selenium driven?

Yes.

User agent
Webrtc!
Screen size
Fonts
Addon variety
Also some websites use on screen heat mapping so if you can emulate hovering over random links etc it doesn't hurt.

There's a start
 
This SOF thread might be useful too.
Code:
https://stackoverflow.com/questions/33225947/can-a-website-detect-when-you-are-using-selenium-with-chromedriver
Goldmine thread nevertheless. :D
 
This SOF thread might be useful too.
Code:
https://stackoverflow.com/questions/33225947/can-a-website-detect-when-you-are-using-selenium-with-chromedriver
Goldmine thread nevertheless. :D
Thanks so much for showing me this turns out theres extensions for spofing the headers too this is fkn genius
 
Isnt possible to hack the api tho? We only need the url and parameters passed in the request to the webserver
 
Sorry for bringing up this older topic, but its indeed very very interesting. So unf. Multiloginapp is for me no option, bc. of the high monthly price. So im currently looking for a solution how to spoof the following Prints

Audio Printing
Canvas Fingerprint
Web GL Vendor

Can this be done directly in the About config or is it possible to manipulate this in a header? I currently use python. If anybody has another option or a link to read it u would be awesome! As im pretty new to this topic im currently kind of helpless and hopeless
 
Back
Top