User Tools

Site Tools

diy:user-agent-spoofing

This is an old revision of the document!


User Agent Spoofing

When a browser or bot requests a webpage, it sends a User-Agent HTTP header containing a string of text that describes the client. So, if you are using Firefox on Windows to browse the web, it is sending this string of text to every website you visit, where it is visible by the server and any embedded third-party scripts like banner advertising:

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0

Example Strings

If you need valid User-Agent strings to use in your spoofing adventures, consider some of these resources:

  • WhatIsMyBrowser.com has a pretty comprehensive set of pages covering a wide variety of user agents.

Application Specific Instructions

How to spoof your user agent depends on the type of software you are using:

Web Browsers

Firefox

Brave

Chrome

Safari

Edge

Terminal Utilities

cURL

By default, curl sends a User-Agent string in the format curl/X.Y.Z, where X.Y.Z represents the version of curl installed on your system. For example, curl/8.4.0. There are several ways you can pass custom User-Agent strings:

-a

Use the -a flag to directly set the User-Agent:

$ curl -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0" https://example.com

You can make up an entirely custom User-Agent as well. Be forewarned however that it works better if you set one that lets you blend in with the crowd:

$ curl --user-agent "MyCustomAgent/1.0" https://example.com
--user-agent

Use the –user-agent flag, which works the same way as -a:

$ curl --user-agent "MyCustomAgent/1.0" https://example.com
-H

Since the User-Agent is passed as an HTTP header, you can also change the User-Agent by using t -H flag, which lets you manipulate headers:

$ curl -H "User-Agent: MyCustomAgent/1.0" https://example.com

Newsboat

To spoof the User-Agent in Newsboat, add the following line to your .config/newsboat/config file:

user-agent "MyCustomAgent/1.0"

wget

By default, Wget sends a User-Agent string in the format Wget/X.Y.Z, where X.Y.Z represents the installed version of Wget. For example, if you have Wget version 1.21.4, the default User-Agent would be Wget/1.21.4.

To set a custom User-Agent, use the -u or –user-agent flags:

$ wget --user-agent="MyCustomAgent/1.0" https://example.com

For more information on how to use wget, read the Wget article.

diy/user-agent-spoofing.1757516392.txt.gz · Last modified: (external edit)

Find this page online at: https://bestpoint.institute/diy/user-agent-spoofing