Generating hash from data
This commit is contained in:
parent
9cf516f87b
commit
7146159208
6 changed files with 115 additions and 90 deletions
|
|
@ -2,7 +2,6 @@ const data = {
|
|||
locale: Intl.DateTimeFormat().resolvedOptions().locale,
|
||||
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
timezoneOffset: new Date().getTimezoneOffset(),
|
||||
date: new Date().toString(),
|
||||
deviceMemory: navigator.deviceMemory,
|
||||
hardwareConcurrency: navigator.hardwareConcurrency,
|
||||
platform: navigator.platform,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const Blocks = () => {
|
|||
{connectionData ? (
|
||||
<>
|
||||
<div className="centerBlockInner">
|
||||
{/* <FingerprintBlock /> */}
|
||||
<FingerprintBlock workerData={workerData} />
|
||||
<NavigatorBlock workerData={workerData} />
|
||||
<UserAgentBlock workerAgent={workerData.userAgent} />
|
||||
<IntlBlock workerData={workerData} />
|
||||
|
|
|
|||
|
|
@ -1,54 +1,24 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
import { useState } from 'react';
|
||||
import Block from './Block';
|
||||
import Table from './Table';
|
||||
import {
|
||||
getHardware,
|
||||
getWebGL,
|
||||
getSoftware,
|
||||
getFingerprint,
|
||||
getHash,
|
||||
getName,
|
||||
handleSave,
|
||||
} from './mainOld';
|
||||
import getHash from '../utils/fingerprint';
|
||||
|
||||
const FingerprintBlock = () => {
|
||||
const [name, setName] = useState('');
|
||||
const [load, setLoad] = useState(false);
|
||||
const [saved, setSaved] = useState('');
|
||||
const hash = getHash([...getHardware(), ...getWebGL(), ...getSoftware()]);
|
||||
getName(hash, setName, setLoad);
|
||||
const FingerprintBlock = ({ workerData }) => {
|
||||
const hash = getHash(workerData);
|
||||
console.log(hash);
|
||||
return (
|
||||
<Block>
|
||||
<h1>Fingerprint</h1>
|
||||
{load && (
|
||||
<>
|
||||
{name ? (
|
||||
<Table data={getFingerprint(name, hash)} />
|
||||
) : (
|
||||
<div className="boxWrap">
|
||||
<div className="hash">{hash}</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<div className="boxWrap">
|
||||
<div className="hash">{hash}</div>
|
||||
</div>
|
||||
<p>
|
||||
<b>Explanation:</b> This is a unique identifier that can be used to
|
||||
follow you around the web. Even if you clear cookies, change your IP or
|
||||
use private mode the hash will stay the same. Enter your name below and
|
||||
reload the page in private mode to test it out.
|
||||
</p>
|
||||
{saved ? (
|
||||
<p>Success! Re-scan browser.</p>
|
||||
) : (
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
handleSave(e, hash, setSaved);
|
||||
}}
|
||||
>
|
||||
<input type="text" id="name" name="name" placeholder="Enter name" />
|
||||
<input type="submit" id="saveButton" value="Save" maxLength="100" />
|
||||
</form>
|
||||
)}
|
||||
</Block>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
61
frontend/src/components/FingerprintBlock2.js
Normal file
61
frontend/src/components/FingerprintBlock2.js
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import { useState } from 'react';
|
||||
import Block from './Block';
|
||||
import Table from './Table';
|
||||
import {
|
||||
getHardware,
|
||||
getWebGL,
|
||||
getSoftware,
|
||||
getFingerprint,
|
||||
getHash,
|
||||
getName,
|
||||
handleSave,
|
||||
} from './mainOld';
|
||||
|
||||
const FingerprintBlock = () => {
|
||||
const [name, setName] = useState('');
|
||||
const [load, setLoad] = useState(false);
|
||||
const [saved, setSaved] = useState('');
|
||||
const hash = getHash([...getHardware(), ...getWebGL(), ...getSoftware()]);
|
||||
getName(hash, setName, setLoad);
|
||||
return (
|
||||
<Block>
|
||||
<h1>Fingerprint</h1>
|
||||
{load && (
|
||||
<>
|
||||
{name ? (
|
||||
<Table data={getFingerprint(name, hash)} />
|
||||
) : (
|
||||
<div className="boxWrap">
|
||||
<div className="hash">{hash}</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<p>
|
||||
<b>Explanation:</b> This is a unique identifier that can be used to
|
||||
follow you around the web. Even if you clear cookies, change your IP or
|
||||
use private mode the hash will stay the same. Enter your name below and
|
||||
reload the page in private mode to test it out.
|
||||
</p>
|
||||
{saved ? (
|
||||
<p>Success! Re-scan browser.</p>
|
||||
) : (
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
handleSave(e, hash, setSaved);
|
||||
}}
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
id="name"
|
||||
name="name"
|
||||
placeholder="Enter signature"
|
||||
/>
|
||||
<input type="submit" id="saveButton" value="Save" maxLength="100" />
|
||||
</form>
|
||||
)}
|
||||
</Block>
|
||||
);
|
||||
};
|
||||
|
||||
export default FingerprintBlock;
|
||||
5
frontend/src/utils/fingerprint.js
Normal file
5
frontend/src/utils/fingerprint.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import md5 from 'crypto-js/md5';
|
||||
|
||||
const getHash = (data) => md5(JSON.stringify(data)).toString();
|
||||
|
||||
export default getHash;
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
import { checkWebWorker } from './common';
|
||||
|
||||
const detectTor = () => {
|
||||
|
|
@ -22,54 +21,45 @@ const checkDatePrototype = () => {
|
|||
};
|
||||
|
||||
// Returns object with location data
|
||||
const getOther = (battery, adBlock, workerData) => {
|
||||
const workerAgentParsed = 1;
|
||||
return [
|
||||
{
|
||||
key: 'Brave browser',
|
||||
value: navigator.brave ? 'True' : 'False',
|
||||
issues: [checkWebWorker],
|
||||
},
|
||||
{
|
||||
key: 'Tor browser',
|
||||
value: detectTor() ? 'True' : 'False',
|
||||
issues: [],
|
||||
},
|
||||
{
|
||||
key: 'Adblock',
|
||||
value: adBlock ? 'True' : 'False',
|
||||
issues: [],
|
||||
},
|
||||
{
|
||||
key: 'Date',
|
||||
value: new Date().toString(),
|
||||
issues: [
|
||||
checkDatePrototype(),
|
||||
checkWebWorker(new Date().toString(), workerData.date),
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'Timezone offset',
|
||||
value: new Date().getTimezoneOffset(),
|
||||
issues: [
|
||||
checkDatePrototype(),
|
||||
checkWebWorker(
|
||||
new Date().getTimezoneOffset(),
|
||||
workerData.timezoneOffset
|
||||
),
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'Battery level',
|
||||
value: `${Math.round(battery.level * 100)}%`,
|
||||
issues: [],
|
||||
},
|
||||
{
|
||||
key: 'Battery status',
|
||||
value: battery.charging ? 'Charging' : 'Not charging',
|
||||
issues: [],
|
||||
},
|
||||
];
|
||||
};
|
||||
const getOther = (battery, adBlock, workerData) => [
|
||||
{
|
||||
key: 'Brave browser',
|
||||
value: navigator.brave ? 'True' : 'False',
|
||||
issues: [checkWebWorker],
|
||||
},
|
||||
{
|
||||
key: 'Tor browser',
|
||||
value: detectTor() ? 'True' : 'False',
|
||||
issues: [],
|
||||
},
|
||||
{
|
||||
key: 'Adblock',
|
||||
value: adBlock ? 'True' : 'False',
|
||||
issues: [],
|
||||
},
|
||||
{
|
||||
key: 'Date',
|
||||
value: new Date().toString(),
|
||||
issues: [checkDatePrototype()],
|
||||
},
|
||||
{
|
||||
key: 'Timezone offset',
|
||||
value: new Date().getTimezoneOffset(),
|
||||
issues: [
|
||||
checkDatePrototype(),
|
||||
checkWebWorker(new Date().getTimezoneOffset(), workerData.timezoneOffset),
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'Battery level',
|
||||
value: `${Math.round(battery.level * 100)}%`,
|
||||
issues: [],
|
||||
},
|
||||
{
|
||||
key: 'Battery status',
|
||||
value: battery.charging ? 'Charging' : 'Not charging',
|
||||
issues: [],
|
||||
},
|
||||
];
|
||||
|
||||
export default getOther;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue