@denniskrol/device-profiles 0.0.1
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.
- package/LICENSE +24 -0
- package/README.md +145 -0
- package/dist/deviceprofiles.json +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +65 -0
- package/package.json +47 -0
- package/src/deviceprofiles.json +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
+
distribute this software, either in source code form or as a compiled
|
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
+
means.
|
|
7
|
+
|
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
+
of this software dedicate any and all copyright interest in the
|
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
|
11
|
+
of the public at large and to the detriment of our heirs and
|
|
12
|
+
successors. We intend this dedication to be an overt act of
|
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
+
software under copyright law.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
For more information, please refer to <https://unlicense.org>
|
package/README.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Device Profiles
|
|
2
|
+
|
|
3
|
+
Daily updated browser/device profiles with weighted random selection. Useful for realistic client fingerprint spoofing, testing, load generation.
|
|
4
|
+
|
|
5
|
+
Data comes from a website with about 65% mobile and 35% desktop traffic. Uses [browser-profiler](https://github.com/denniskrol/browser-profiler) to get data
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @denniskrol/device-profiles
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Basic Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import DeviceProfiles from '@denniskrol/device-profiles';
|
|
17
|
+
|
|
18
|
+
// Get a weighted random profile
|
|
19
|
+
const profile = new DeviceProfiles();
|
|
20
|
+
console.log(profile.userAgent, profile.deviceType);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Filtered Random
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
// Only mobile devices
|
|
27
|
+
const mobile = new DeviceProfiles({ deviceType: 'mobile' });
|
|
28
|
+
|
|
29
|
+
// Regex match browser name
|
|
30
|
+
const safari = new DeviceProfiles({ browser: /Safari/ });
|
|
31
|
+
|
|
32
|
+
// Inclusion list (e.g. mobile OR tablet)
|
|
33
|
+
const touch = new DeviceProfiles({ deviceType: ['mobile', 'tablet'] });
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Static Helpers
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { DeviceProfiles } from '@denniskrol/device-profiles';
|
|
40
|
+
|
|
41
|
+
// Get array of all profiles
|
|
42
|
+
const all = DeviceProfiles.all();
|
|
43
|
+
|
|
44
|
+
// Get random with filter without instantiating
|
|
45
|
+
const randomDesktop = DeviceProfiles.random({ deviceType: 'desktop' });
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Profile example
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36",
|
|
53
|
+
"platform": "Win32",
|
|
54
|
+
"deviceMemory": 8,
|
|
55
|
+
"hardwareConcurrency": 8,
|
|
56
|
+
"vendor": "Google Inc.",
|
|
57
|
+
"screenHeight": 720,
|
|
58
|
+
"screenWidth": 1280,
|
|
59
|
+
"viewportHeight": 568,
|
|
60
|
+
"viewportWidth": 1251,
|
|
61
|
+
"devicePixelRatio": 1.5,
|
|
62
|
+
"webglRenderer": "ANGLE (Intel, Intel(R) UHD Graphics (0x00009B41) Direct3D11 vs_5_0 ps_5_0, D3D11)",
|
|
63
|
+
"webglVendor": "Google Inc. (Intel)",
|
|
64
|
+
"webGpuArchitecture": "gen-9",
|
|
65
|
+
"webGpuVendor": "intel",
|
|
66
|
+
"storageQuota": {
|
|
67
|
+
"quota": 113282066841,
|
|
68
|
+
"usage": 0,
|
|
69
|
+
"available": 113282066841
|
|
70
|
+
},
|
|
71
|
+
"jsHeapSizeLimit": 2248146944,
|
|
72
|
+
"fonts": [
|
|
73
|
+
"Aldhabi",
|
|
74
|
+
"Bahnschrift",
|
|
75
|
+
"Cambria Math",
|
|
76
|
+
"Gadugi",
|
|
77
|
+
"HoloLens MDL2 Assets",
|
|
78
|
+
"Ink Free",
|
|
79
|
+
"Javanese Text",
|
|
80
|
+
"Leelawadee UI",
|
|
81
|
+
"Lucida Console",
|
|
82
|
+
"MS Outlook",
|
|
83
|
+
"Myanmar Text",
|
|
84
|
+
"Nirmala UI",
|
|
85
|
+
"Segoe MDL2 Assets",
|
|
86
|
+
"Segoe UI Emoji"
|
|
87
|
+
],
|
|
88
|
+
"userAgentData": {
|
|
89
|
+
"architecture": "x86",
|
|
90
|
+
"bitness": "64",
|
|
91
|
+
"brands": [
|
|
92
|
+
{
|
|
93
|
+
"brand": "Chromium",
|
|
94
|
+
"version": "142"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"brand": "Google Chrome",
|
|
98
|
+
"version": "142"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"brand": "Not_A Brand",
|
|
102
|
+
"version": "99"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"fullVersionList": [
|
|
106
|
+
{
|
|
107
|
+
"brand": "Chromium",
|
|
108
|
+
"version": "142.0.7444.134"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"brand": "Google Chrome",
|
|
112
|
+
"version": "142.0.7444.134"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"brand": "Not_A Brand",
|
|
116
|
+
"version": "99.0.0.0"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"mobile": false,
|
|
120
|
+
"model": null,
|
|
121
|
+
"platform": "Windows",
|
|
122
|
+
"platformVersion": "10.0.0",
|
|
123
|
+
"uaFullVersion": "142.0.7444.134"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Filtering Rules
|
|
129
|
+
- Primitive equality (deviceType: `'mobile'`)
|
|
130
|
+
- Inclusion list (deviceType: `['mobile','tablet']`)
|
|
131
|
+
- RegExp match (browser: `/Safari/`)
|
|
132
|
+
|
|
133
|
+
## Weighted Selection
|
|
134
|
+
Each profile has a weight. Random selection is proportional to weight.
|
|
135
|
+
|
|
136
|
+
## JSON Access
|
|
137
|
+
You can also import the raw JSON:
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
import profilesJson from '@denniskrol/device-profiles/deviceprofiles.json';
|
|
141
|
+
console.log(profilesJson.length);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
Unlicense
|