Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
fingerprint-generator
Advanced tools
NodeJs package for generating realistic browser fingerprints and matching headers.
Run the npm install fingerprint-generator
command. No further setup is needed afterwards.
To use the generator, you need to create an instance of the FingerprintGenerator
class which is exported from this package. Constructor of this class accepts a HeaderGeneratorOptions
object, which can be used to globally specify what kind of fingerprint and headers you are looking for:
const FingerprintGenerator = require('fingerprint-generator');
let fingerprintGenerator = new FingerprintGenerator({
browsers: [
{name: "firefox", minVersion: 80},
{name: "chrome", minVersion: 87},
"safari"
],
devices: [
"desktop"
],
operatingSystems: [
"windows"
]
});
You can then get the fingerprint and headers using the getFingerprint
method, either with no argument, or with another HeaderGeneratorOptions
object, this time specifying the options only for this call (overwriting the global options when in conflict) and using the global options specified beforehands for the unspecified options:
let { fingerprint, headers } = fingerprintGenerator.getFingerprint({
operatingSystems: [
"linux"
],
locales: ["en-US", "en"]
});
This method always generates a random realistic fingerprint and a matching set of headers, excluding the request dependant headers, which need to be filled in afterwards. Since the generation is randomized, multiple calls to this method with the same parameters can generate multiple different outputs.
Fingerprint that might be generated for the usage example above:
{
"userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0",
"cookiesEnabled": true,
"timezone": "Europe/Prague",
"timezoneOffset": -60,
"audioCodecs": {
"ogg": "probably",
"mp3": "maybe",
"wav": "probably",
"m4a": "maybe",
"aac": "maybe"
},
"videoCodecs": {
"ogg": "probably",
"h264": "probably",
"webm": "probably"
},
"videoCard": [
"Intel Open Source Technology Center",
"Mesa DRI Intel(R) HD Graphics 4600 (HSW GT2)"
],
"productSub": "20100101",
"hardwareConcurrency": 8,
"multimediaDevices": {
"speakers": 0,
"micros": 0,
"webcams": 0
},
"platform": "Linux x86_64",
"pluginsSupport": true,
"screenResolution": [ 1920, 1080 ],
"availableScreenResolution": [ 1920, 1080 ],
"colorDepth": 24,
"touchSupport": {
"maxTouchPoints": 0,
"touchEvent": false,
"touchStart": false
},
"languages": [ "en-US", "en" ]
}
And the matching headers:
{
"user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0",
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"accept-language": "en-US,en;q=0.9",
"accept-encoding": "gzip, deflate, br",
"upgrade-insecure-requests": "1",
"te": "trailers"
}
All public classes, methods and their parameters can be inspected in this API reference.
Fingerprint generator - randomly generates realistic browser fingerprints
new FingerprintGenerator(options)
Param | Type | Description |
---|---|---|
options | HeaderGeneratorOptions | default header generation options used unless overridden |
fingerprintGenerator.getFingerprint(options, requestDependentHeaders)
Generates a fingerprint and a matching set of ordered headers using a combination of the default options specified in the constructor and their possible overrides provided here.
Param | Type | Description |
---|---|---|
options | HeaderGeneratorOptions | specifies options that should be overridden for this one call |
requestDependentHeaders | Object | specifies known values of headers dependent on the particular request |
BrowserSpecification
Param | Type | Description |
---|---|---|
name | string | One of chrome , firefox and safari . |
minVersion | number | Minimal version of browser used. |
maxVersion | number | Maximal version of browser used. |
httpVersion | string | Http version to be used to generate headers (the headers differ depending on the version). Either 1 or 2. If none specified the httpVersion specified in HeaderGeneratorOptions is used. |
HeaderGeneratorOptions
Param | Type | Description |
---|---|---|
browsers | Array.<(BrowserSpecification|string)> | List of BrowserSpecifications to generate the headers for, or one of chrome , firefox and safari . |
operatingSystems | Array.<string> | List of operating systems to generate the headers for. The options are windows , macos , linux , android and ios . |
devices | Array.<string> | List of devices to generate the headers for. Options are desktop and mobile . |
locales | Array.<string> | List of at most 10 languages to include in the Accept-Language request header in the language format accepted by that header, for example en , en-US or de . |
httpVersion | string | Http version to be used to generate headers (the headers differ depending on the version). Can be either 1 or 2. Default value is 2. |
FAQs
NodeJS package for generating realistic browser fingerprints.
The npm package fingerprint-generator receives a total of 19,494 weekly downloads. As such, fingerprint-generator popularity was classified as popular.
We found that fingerprint-generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.