Socket
Socket
Sign inDemoInstall

fpcollect

Package Overview
Dependencies
41
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.2.0

18

dist/fpcollect.js

@@ -93,2 +93,3 @@ var fpCollect =

nightmareJS: false,
selenium: false,
webDriver: false,

@@ -102,3 +103,5 @@ errorsGenerated: false,

iframeChrome: false,
debugTool: false
debugTool: false,
battery: false,
deviceMemory: false
};

@@ -267,6 +270,9 @@

phantomJS: function phantomJS() {
return 'callPhantom' in window || '_phantom' in window || 'phantom' in window || 'WebPage' in window;
return ['callPhantom' in window, '_phantom' in window, 'phantom' in window];
},
selenium: function selenium() {
return ['webdriver' in window, '_Selenium_IDE_Recorder' in window, 'callSelenium' in window, '_selenium' in window, '__webdriver_script_fn' in document, '__driver_evaluate' in document, '__webdriver_evaluate' in document, '__selenium_evaluate' in document, '__fxdriver_evaluate' in document, '__driver_unwrapped' in document, '__webdriver_unwrapped' in document, '__selenium_unwrapped' in document, '__fxdriver_unwrapped' in document, '__webdriver_script_func' in document, document.documentElement.getAttribute("selenium") !== null, document.documentElement.getAttribute("webdriver") !== null, document.documentElement.getAttribute("driver") !== null];
},
webDriver: function webDriver() {
return 'webdriver' in window || 'true' === document.getElementsByTagName('html')[0].getAttribute('webdriver') || 'webdriver' in navigator;
return 'webdriver' in navigator;
},

@@ -367,2 +373,8 @@ errorsGenerated: function errorsGenerated() {

return cpt > 1;
},
battery: function battery() {
return 'getBattery' in window.navigator;
},
deviceMemory: function deviceMemory() {
return navigator.deviceMemory || 0;
}

@@ -369,0 +381,0 @@ };

2

package.json
{
"name": "fpcollect",
"version": "0.1.0",
"version": "0.2.0",
"description": "Fingerprinting script of Fingerprint-Scanner",

@@ -5,0 +5,0 @@ "main": "dist/fpcollect.js",

@@ -1,5 +0,53 @@

## Fp-Collect
# Fp-Collect
[![Build Status](https://travis-ci.org/antoinevastel/fp-collect.svg?branch=master)](https://travis-ci.org/antoinevastel/fp-collect)
Fingerprinting module of Fingerprint-Scanner, a library to detect bots/crawlers based on their fingerprint.
Fingerprinting module of [Fingerprint-Scanner](https://github.com/antoinevastel/fpscanner), a library to detect
bots/crawlers based on their fingerprint.
## Warning
The library is still in its early phase, many changes may occur.
## Getting Started
### Installation
```
npm install
```
and
```
npm build
```
It generates a minified version called **fpcollect.js** in the **dist/** directory.
### Usage
```
const fingerprint = await fpCollect.generateFingerprint();
//or
fpCollect.generateFingerprint().then((fingerprint) => {
// Do something with the fingerprint
});
```
### Running the tests
Fp-collect use Puppeteer and Chrome headless to run its tests.
They can be launched using *npm test*.
## Attributes collected
Fp-collect collects only attributes required to detect bots, not attributes classically
used for fingerprinting tracking, such as canvas.
Details on the attributes and their meaning can be found in
[Fingerprint-Scanner](https://github.com/antoinevastel/fpscanner).
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

@@ -21,2 +21,3 @@ const fpCollect = (function () {

nightmareJS: false,
selenium: false,
webDriver: false,

@@ -30,3 +31,5 @@ errorsGenerated: false,

iframeChrome: false,
debugTool: false
debugTool: false,
battery: false,
deviceMemory: false
};

@@ -192,8 +195,31 @@

phantomJS: () => {
return 'callPhantom' in window || '_phantom' in window || 'phantom' in window || 'WebPage' in window;
return [
'callPhantom' in window,
'_phantom' in window,
'phantom' in window
];
},
selenium: () => {
return [
'webdriver' in window,
'_Selenium_IDE_Recorder' in window,
'callSelenium' in window,
'_selenium' in window,
'__webdriver_script_fn' in document,
'__driver_evaluate' in document,
'__webdriver_evaluate' in document,
'__selenium_evaluate' in document,
'__fxdriver_evaluate' in document,
'__driver_unwrapped' in document,
'__webdriver_unwrapped' in document,
'__selenium_unwrapped' in document,
'__fxdriver_unwrapped' in document,
'__webdriver_script_func' in document,
document.documentElement.getAttribute("selenium") !== null,
document.documentElement.getAttribute("webdriver") !== null,
document.documentElement.getAttribute("driver") !== null
];
},
webDriver: () => {
return 'webdriver' in window ||
'true' === document.getElementsByTagName('html')[0].getAttribute('webdriver') ||
'webdriver' in navigator;
return 'webdriver' in navigator;
},

@@ -295,2 +321,8 @@ errorsGenerated: () => {

return cpt > 1;
},
battery: () => {
return 'getBattery' in window.navigator;
},
deviceMemory: () => {
return navigator.deviceMemory || 0;
}

@@ -297,0 +329,0 @@ };

@@ -29,2 +29,18 @@ const {expect} = require('chai');

it('deviceMemory should be a number', async () => {
const deviceMemory = await page.evaluate(async () => {
const fingerprint = await fpCollect.generateFingerprint();
return fingerprint.deviceMemory;
});
expect(typeof deviceMemory).to.equal('number');
});
it('Battery should be true', async () => {
const battery = await page.evaluate(async () => {
const fingerprint = await fpCollect.generateFingerprint();
return fingerprint.battery;
});
expect(battery).to.be.true;
});
it('debugTool should be true', async () => {

@@ -105,3 +121,11 @@ const debugTool = await page.evaluate(async () => {

it('PhantomJS should be false', async () => {
it('Selenium should be an array', async () => {
const selenium = await page.evaluate(async () => {
const fingerprint = await fpCollect.generateFingerprint();
return fingerprint.selenium;
});
expect(selenium instanceof Array).to.be.true;
});
it('PhantomJS should be an array', async () => {
const phantomJS = await page.evaluate(async () => {

@@ -111,3 +135,3 @@ const fingerprint = await fpCollect.generateFingerprint();

});
expect(phantomJS).to.be.false;
expect(phantomJS instanceof Array).to.be.true;
});

@@ -114,0 +138,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc