
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
random-useragent
Advanced tools
Get a random user agent (with an optional filter to select from a specific set of user agents).
Install the module with: npm install random-useragent
const randomUseragent = require('random-useragent');
randomUseragent.getRandom(); // gets a random user agent string
Get a random user agent string (optionally using a filter).
Example Result:
'Mozilla/5.0 (Windows NT 6.2; rv:20.0) Gecko/20121202 Firefox/20.0'
Get a random user agent's parsed data (optionally using a filter).
Example Result:
{
"folder": "/Browsers - Windows/Legacy Browsers",
"description": "Firefox 20.0 (Win 8 32)",
"userAgent": "Mozilla/5.0 (Windows NT 6.2; rv:20.0) Gecko/20121202 Firefox/20.0",
"appCodename": "",
"appName": "",
"appVersion": "",
"platform": "",
"vendor": "",
"vendorSub": "",
"browserName": "Firefox",
"browserMajor": "20",
"browserVersion": "20.0",
"deviceModel": "",
"deviceType": "",
"deviceVendor": "",
"engineName": "Gecko",
"engineVersion": "20.0",
"osName": "Windows",
"osVersion": "8",
"cpuArchitecture": ""
}
Get an array of all the user agent strings (optionally using a filter).
Get an array of all the parsed user agent data (optionally using a filter).
Get a random user agent string:
randomUseragent.getRandom();
Get a random Firefox user agent string:
randomUseragent.getRandom(function (ua) {
return ua.browserName === 'Firefox';
});
Get a random user agent with a version >= 20:
randomUseragent.getRandom(function (ua) {
return parseFloat(ua.browserVersion) >= 20;
});
The collection of user agents is pulled from the large, regularly updated xml file provided by the author of User Agent Switcher, which is located here:
Copyright (c) 2014 skratchdot
Licensed under the MIT license.
0.5.0 (2020-09-03)
Closed issues:
Merged pull requests:
FAQs
Get a random useragent (with an optional filter)
The npm package random-useragent receives a total of 24,846 weekly downloads. As such, random-useragent popularity was classified as popular.
We found that random-useragent demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.