Generating hash from data

This commit is contained in:
z0ccc 2021-09-28 15:56:04 -04:00
parent 9cf516f87b
commit 7146159208
6 changed files with 115 additions and 90 deletions

View file

@ -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,

View file

@ -29,7 +29,7 @@ const Blocks = () => {
{connectionData ? (
<>
<div className="centerBlockInner">
{/* <FingerprintBlock /> */}
<FingerprintBlock workerData={workerData} />
<NavigatorBlock workerData={workerData} />
<UserAgentBlock workerAgent={workerData.userAgent} />
<IntlBlock workerData={workerData} />

View file

@ -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>
)}
</>
)}
<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>
);
};

View 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;

View file

@ -0,0 +1,5 @@
import md5 from 'crypto-js/md5';
const getHash = (data) => md5(JSON.stringify(data)).toString();
export default getHash;

View file

@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { checkWebWorker } from './common';
const detectTor = () => {
@ -22,9 +21,7 @@ const checkDatePrototype = () => {
};
// Returns object with location data
const getOther = (battery, adBlock, workerData) => {
const workerAgentParsed = 1;
return [
const getOther = (battery, adBlock, workerData) => [
{
key: 'Brave browser',
value: navigator.brave ? 'True' : 'False',
@ -43,20 +40,14 @@ const getOther = (battery, adBlock, workerData) => {
{
key: 'Date',
value: new Date().toString(),
issues: [
checkDatePrototype(),
checkWebWorker(new Date().toString(), workerData.date),
],
issues: [checkDatePrototype()],
},
{
key: 'Timezone offset',
value: new Date().getTimezoneOffset(),
issues: [
checkDatePrototype(),
checkWebWorker(
new Date().getTimezoneOffset(),
workerData.timezoneOffset
),
checkWebWorker(new Date().getTimezoneOffset(), workerData.timezoneOffset),
],
},
{
@ -70,6 +61,5 @@ const getOther = (battery, adBlock, workerData) => {
issues: [],
},
];
};
export default getOther;