-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinspector.html
More file actions
174 lines (156 loc) · 6.35 KB
/
Copy pathinspector.html
File metadata and controls
174 lines (156 loc) · 6.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>FingerprintJS by BotBlocker Inspector</title>
<style>
:root {
color-scheme: light;
--bg: #f6f8fa;
--panel: #ffffff;
--ink: #18212a;
--muted: #5d6b78;
--line: #d9e1e7;
--brand: #0f766e;
--warn: #a16207;
}
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100vh;
background: var(--bg);
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
main {
width: min(1200px, calc(100% - 28px));
margin: 0 auto;
padding: 24px 0;
}
header, .toolbar, .grid {
display: grid;
gap: 12px;
}
header {
grid-template-columns: minmax(0, 1fr) auto;
align-items: center;
border-bottom: 1px solid var(--line);
padding-bottom: 14px;
}
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 26px; }
h2 { font-size: 15px; }
a, button {
min-height: 38px;
border-radius: 6px;
border: 0;
background: var(--brand);
color: #fff;
font: inherit;
font-weight: 750;
text-decoration: none;
}
a { display: inline-flex; align-items: center; padding: 0 12px; }
button { padding: 0 16px; cursor: pointer; }
.toolbar { margin: 14px 0; grid-template-columns: minmax(0, 1fr) auto; }
textarea, pre {
width: 100%;
border: 1px solid var(--line);
border-radius: 8px;
background: var(--panel);
color: var(--ink);
font: 12px/1.5 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
textarea { min-height: 220px; padding: 12px; resize: vertical; }
pre { min-height: 360px; max-height: 70vh; overflow: auto; margin: 0; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.grid { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
@media (max-width: 820px) {
header, .toolbar, .grid { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<main>
<header>
<h1>FingerprintJS by BotBlocker Inspector</h1>
<a href="https://botblocker.top" target="_blank" rel="noopener noreferrer">BotBlocker Security</a>
</header>
<div class="toolbar">
<label class="muted" for="input">Paste an IdentifyResult or full demo report JSON</label>
<button id="inspect" type="button">Inspect</button>
</div>
<div class="grid">
<section>
<h2>Input</h2>
<textarea id="input" spellcheck="false">{"visitorId":"demo","namespace":"demo","confidence":{"score":1},"components":[],"meta":{"identityComponents":[],"reportOnlyComponents":[]}}</textarea>
</section>
<section>
<h2>Inspection</h2>
<pre id="output">Ready</pre>
</section>
</div>
</main>
<script>
const input = document.querySelector('#input');
const output = document.querySelector('#output');
document.querySelector('#inspect').addEventListener('click', inspect);
function inspect() {
try {
const parsed = JSON.parse(input.value);
const result = parsed.result || parsed.analysisReport || parsed;
const components = Array.isArray(result.components) ? result.components : [];
const results = result.results && typeof result.results === 'object' ? result.results : {};
const identity = new Set(result.meta && Array.isArray(result.meta.identityComponents) ? result.meta.identityComponents : Array.isArray(result.identityComponents) ? result.identityComponents : []);
for (const component of components) {
if (component.role === 'identity') {
identity.add(component.id);
}
}
const reportOnly = result.meta && Array.isArray(result.meta.reportOnlyComponents)
? result.meta.reportOnlyComponents
: Array.isArray(result.reportOnlyComponents)
? result.reportOnlyComponents
: components.filter((component) => component.role === 'report-only').map((component) => component.id);
output.textContent = JSON.stringify({
visitorId: result.visitorId || result.id || null,
namespace: result.namespace || null,
confidence: result.confidence || null,
identityComponents: Array.from(identity),
reportOnlyComponents: reportOnly,
tamper: riskValue(result, components, 'browser.tamperEvidence'),
bot: riskValue(result, components, 'browser.botDetection'),
privateMode: riskValue(result, components, 'browser.privacyMode'),
components: components.length ? components.map((component) => ({
id: component.id,
role: identity.has(component.id) ? 'identity' : 'report-only',
status: component.status,
hashable: component.hashable,
stability: component.stability
})) : Object.keys(results).map((id) => ({ id, role: identity.has(id) ? 'identity' : 'report-only', result: results[id] }))
}, null, 2);
} catch (error) {
output.innerHTML = '<span class="warn">Invalid JSON: ' + escapeHtml(error.message || String(error)) + '</span>';
}
}
function riskValue(result, components, id) {
if (result.risk && id === 'browser.tamperEvidence') {
return result.risk.tamper || null;
}
if (result.risk && id === 'browser.botDetection') {
return result.risk.bot || null;
}
if (result.risk && id === 'browser.privacyMode') {
return result.risk.privateMode || null;
}
const component = components.find((item) => item.id === id && item.status === 'ok');
return component && (component.value || component.result) ? component.value || component.result : null;
}
function escapeHtml(value) {
return String(value).replace(/[&<>"]/g, (char) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[char]));
}
</script>
</body>
</html>