mirror of
https://github.com/duckietm/Nitro-Cool-UI-Renderer.git
synced 2025-06-21 15:06:58 +00:00
Added: MachineID generated at login
This commit is contained in:
parent
d567171bcf
commit
187622429f
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,9 +1,8 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# compiled output
|
||||
mpiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
|
||||
# Only exists if Bazel was run
|
||||
/bazel-out
|
||||
|
||||
|
@ -29,7 +29,9 @@
|
||||
"howler": "^2.2.4",
|
||||
"pako": "^2.1.0",
|
||||
"pixi-filters": "^6.0.0",
|
||||
"pixi.js": "~8.0.4"
|
||||
"pixi.js": "~8.0.4",
|
||||
"@pixi/gif": "^3.0.0",
|
||||
"clientjs": "^0.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
|
@ -4,7 +4,8 @@ import { GetEventDispatcher, NitroEventType } from '@nitrots/events';
|
||||
import { GetTickerTime } from '@nitrots/utils';
|
||||
import { NitroMessages } from './NitroMessages';
|
||||
import { SocketConnection } from './SocketConnection';
|
||||
import { AuthenticatedEvent, ClientHelloMessageComposer, ClientPingEvent, InfoRetrieveMessageComposer, PongMessageComposer, SSOTicketMessageComposer } from './messages';
|
||||
import { AuthenticatedEvent, ClientHelloMessageComposer, ClientPingEvent, InfoRetrieveMessageComposer, PongMessageComposer, SSOTicketMessageComposer, UniqueIDMessageComposer } from './messages';
|
||||
import { ClientJS } from 'clientjs';
|
||||
|
||||
export class CommunicationManager implements ICommunicationManager
|
||||
{
|
||||
@ -13,6 +14,73 @@ export class CommunicationManager implements ICommunicationManager
|
||||
|
||||
private _pongInterval: any = null;
|
||||
|
||||
private getGpu(): string {
|
||||
const e = document.createElement('canvas');
|
||||
let t, s, i, r;
|
||||
try {
|
||||
if (
|
||||
((t = e.getContext('webgl') || e.getContext('experimental-webgl')), (s = t.getExtension('WEBGL_debug_renderer_info')), null === t || null === s))
|
||||
return '';
|
||||
} catch (n) {
|
||||
return '';
|
||||
}
|
||||
return ((i = t.getParameter(s.UNMASKED_VENDOR_WEBGL)), (r = t.getParameter(s.UNMASKED_RENDERER_WEBGL)), i + '|' + r);
|
||||
}
|
||||
|
||||
private getMathResult(): string {
|
||||
let e, t;
|
||||
(e = '<mathroutines>Error</mathroutines>'), (t = '');
|
||||
try {
|
||||
return (
|
||||
(t ='<mathroutines>' + (Math.exp(10) + 1 / Math.exp(10)) / 2 + '|' + Math.tan(-1e300) + '</mathroutines>'), t);
|
||||
} catch (s) {
|
||||
return '<mathroutines>Error</mathroutines>';
|
||||
}
|
||||
}
|
||||
|
||||
private getCanvas(): any {
|
||||
const e = document.createElement('canvas'), t = e.getContext('2d'), userAgent = navigator.userAgent, screenInfo = '${window.screen.width}x${window.screen.height}', currentDate = new Date().toString(), s = 'ThiosIsVerrySeCuRe02938883721##@@@_moreStuff! | ${userAgent} | ${screenInfo} | ${currentDate}';
|
||||
t.textBaseline = 'top';
|
||||
t.font = "16px 'Arial'";
|
||||
t.textBaseline = 'alphabetic';
|
||||
t.rotate(0.05);
|
||||
t.fillStyle = '#f60';
|
||||
t.fillRect(125, 1, 62, 20);
|
||||
t.fillStyle = '#069';
|
||||
t.fillText(s, 2, 15);
|
||||
t.fillStyle = 'rgba(102, 200, 0, 0.7)';
|
||||
t.fillText(s, 4, 17);
|
||||
t.shadowBlur = 10;
|
||||
t.shadowColor = 'blue';
|
||||
t.fillRect(-20, 10, 234, 5);
|
||||
const i = e.toDataURL();
|
||||
document.body.appendChild(e);
|
||||
let r = 0;
|
||||
if (i.length === 0) return 'nothing!';
|
||||
for (let n = 0; n < i.length; n++) {
|
||||
r = (r << 5) - r + i.charCodeAt(n);
|
||||
r &= r;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
private generateMachineID(): string {
|
||||
const fp = new ClientJS();
|
||||
const uniqueId = fp.getCustomFingerprint(
|
||||
fp.getAvailableResolution(),
|
||||
fp.getOS(),
|
||||
fp.getCPU(),
|
||||
fp.getColorDepth(),
|
||||
this.getGpu(),
|
||||
fp.getSilverlightVersion(),
|
||||
fp.getOSVersion(),
|
||||
this.getMathResult(),
|
||||
fp.getCanvasPrint(),
|
||||
this.getCanvas()
|
||||
);
|
||||
return uniqueId == null ? 'FAILED' : `IID-${uniqueId}`;
|
||||
}
|
||||
|
||||
constructor()
|
||||
{
|
||||
this._connection.registerMessages(this._messages);
|
||||
@ -31,8 +99,11 @@ export class CommunicationManager implements ICommunicationManager
|
||||
{
|
||||
if(GetConfiguration().getValue<boolean>('system.pong.manually', false)) this.startPong();
|
||||
|
||||
const machineId = this.generateMachineID();
|
||||
|
||||
this._connection.send(new ClientHelloMessageComposer(null, null, null, null));
|
||||
this._connection.send(new SSOTicketMessageComposer(GetConfiguration().getValue('sso.ticket', null), GetTickerTime()));
|
||||
this._connection.send(new UniqueIDMessageComposer(machineId, '', ''));
|
||||
});
|
||||
|
||||
GetEventDispatcher().addEventListener(NitroEventType.SOCKET_ERROR, () =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user