Added main file for functions

This commit is contained in:
z0ccc 2021-08-23 20:31:52 -04:00
parent 871f89467d
commit 90cad36930
5 changed files with 32 additions and 38 deletions

View file

@ -10,14 +10,14 @@ Check it out at https://vytal.io
# Dev # Dev
Backend setup: Backend Django setup:
``` ```
cd backend cd backend
python manage.py runserver python manage.py runserver
``` ```
Frontend setup: Frontend React setup:
``` ```
cd frontend cd frontend

View file

@ -11,7 +11,7 @@ const FingerprintBlock = () => {
useEffect(() => { useEffect(() => {
axios axios
.get(`http://localhost:8000/fingerprint/?hash=${hash}`) .get(`https://api.vytal.io/fingerprint/?hash=${hash}`)
.then((response) => { .then((response) => {
if (response.data.length !== 0) { if (response.data.length !== 0) {
setName(response.data[response.data.length - 1].name); setName(response.data[response.data.length - 1].name);
@ -22,7 +22,7 @@ const FingerprintBlock = () => {
const handleSave = (e) => { const handleSave = (e) => {
e.preventDefault(); e.preventDefault();
axios.post('http://localhost:8000/fingerprint/', { axios.post('https://api.vytal.io/fingerprint/', {
name: e.target[0].value, name: e.target[0].value,
hash, hash,
}); });
@ -134,10 +134,10 @@ const FingerprintBlock = () => {
)} )}
</div> </div>
<p> <p>
<b>Explanation:</b> This is a unique identifier that can be <b>Explanation:</b> This is a unique identifier that can be used to
used to follow you around the web. Even if you clear cookies, change follow you around the web. Even if you clear cookies, change your IP or
your IP or use private mode the hash will stay the same. Enter use private mode the hash will stay the same. Enter your name below and
your name below and reload the page in private mode to test it out. reload the page in private mode to test it out.
</p> </p>
{saved ? ( {saved ? (
<p>Success! Re-scan browser.</p> <p>Success! Re-scan browser.</p>

View file

@ -9,11 +9,7 @@ const MainColumn = () => {
<div className="centerBlockOuter"> <div className="centerBlockOuter">
<div className="centerBlockInner"> <div className="centerBlockInner">
<Logo /> <Logo />
{scan ? ( {scan ? <ScanBlocks /> : <StartBlock scan={scan} setScan={setScan} />}
<ScanBlocks />
) : (
<StartBlock scan={scan} onScanClick={setScan} />
)}
</div> </div>
</div> </div>
); );

View file

@ -1,4 +1,3 @@
import { useCallback } from 'react';
import ContentList from './ContentList'; import ContentList from './ContentList';
import ScanBlock from './ScanBlock'; import ScanBlock from './ScanBlock';
@ -16,32 +15,26 @@ const contentItems = [
{ {
title: 'System Info', title: 'System Info',
icon: 'browser', icon: 'browser',
body: 'JavaScript can be used to find data about your computer\'s software and hardware. This information can be used to create a fingerprint.', body: "JavaScript can be used to find data about your computer's software and hardware. This information can be used to create a fingerprint.",
}, },
]; ];
const StartBlock = ({ onScanClick }) => { const StartBlock = ({ setScan }) => (
const startScan = useCallback(() => { <ScanBlock>
onScanClick(true); <h2>About</h2>
}, [onScanClick]); <div className="contentBody">
Vytal shows you what traces your browser leaves behind while surfing the
return ( web. This scan allows you to understand how easy it is to identify and
<ScanBlock> track your browser even while using private mode.
<h2>About</h2> </div>
<div className="contentBody"> <ContentList items={contentItems} />
Vytal shows you what traces your browser leaves behind while surfing the <input
web. This scan allows you to understand how easy it is to identify and type="submit"
track your browser even while using private mode. onClick={() => setScan(true)}
</div> id="scanButton"
<ContentList items={contentItems} /> value="Scan Browser"
<input />
type="submit" </ScanBlock>
onClick={startScan} );
id="scanButton"
value="Scan Browser"
/>
</ScanBlock>
);
};
export default StartBlock; export default StartBlock;

View file

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