From cd19abdd0f7f16ffc7b2a4e2de598e00e832f8c3 Mon Sep 17 00:00:00 2001 From: Kajetan Kazimierczak Date: Wed, 8 Sep 2021 16:00:01 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Silly=20stockholm=20stad?= =?UTF-8?q?=20protection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/api.ts | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/api.ts b/lib/api.ts index 71567fdff..757f2dc9d 100644 --- a/lib/api.ts +++ b/lib/api.ts @@ -135,7 +135,7 @@ export class Api extends EventEmitter { status.on('OK', async () => { await this.retrieveSessionCookie() await this.retrieveXsrfToken() - await this.retrieveApiKey() + // await this.retrieveApiKey() this.isLoggedIn = true this.emit('login') @@ -304,18 +304,36 @@ export class Api extends EventEmitter { return parse.user(data) } + private getTopology(): string { + + var currentTime = new Date()['getTime'](); + let topo = 'make talk identify inside rubber title fold physical clump member pond divide hood churn put brief swap ride paddle solve enjoy home sound basket|' + currentTime; + let _0x9748 = 'hijklmnopqrstuvwxyz'; + let _0x9731 = 9; + + for (let i = 0; i < _0x9731; i++) { + topo = Buffer.from(topo).toString('base64') + + }; + + topo = topo['substring'](0, 1) + _0x9748['charAt'](_0x9731) + topo['substring'](1, topo['length']); + + return topo + } + public async getChildren(): Promise { if (this.isFake) return fakeResponse(fake.children()) - const cdnUrl = await this.retrieveCdnUrl() - const authBody = await this.retrieveAuthBody() - const token = await this.retrieveAuthToken(cdnUrl, authBody) + // const cdnUrl = await this.retrieveCdnUrl() + // const authBody = await this.retrieveAuthBody() + // const token = await this.retrieveAuthToken(cdnUrl, authBody) const url = routes.children const session = this.getRequestInit({ headers: { Accept: 'application/json;odata=verbose', - Auth: token, + // Auth: token, + topology: this.getTopology(), Host: 'etjanst.stockholm.se', Referer: 'https://etjanst.stockholm.se/vardnadshavare/inloggad2/hem', },