-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbrowser.js
45 lines (31 loc) · 1.08 KB
/
browser.js
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
import { getCurrentBrowserFingerPrint } from "@rajesh896/broprint.js";
const getRetropieIp = async(fingerprint: string): Promise<string[]> => {
try {
let response: any = await fetch(`http://127.0.0.1:1338/getHosts`, {
method: "POST",
body: JSON.stringify({
browserId: fingerprint
}),
headers: {
'content-type': 'application/x-www-form-urlencoded'
}
});
response = await response.json();
if (!(response instanceof Array)) response = [];
response = response.filter((i: any) => typeof i === 'string' && i.length);
if (response.length) return response;
}
catch (e) {
}
return [];
}
(async() => {
const fingerprint = String(await getCurrentBrowserFingerPrint());
document.body.innerHTML += '<div>' + fingerprint + '</div>';
const retropieIps = await getRetropieIp(fingerprint);
document.body.innerHTML += '<div>' + 'retropieIp' + JSON.stringify(retropieIps) + '</div>';
const hostName = `//start_${fingerprint}-${Date.now()}end.local`;
navigator.sendBeacon(hostNameWithPrefix);
const img = new Image();
img.src = hostNameWithPrefix;
})();