Skip to content

Commit

Permalink
fix: 🐛 Silly stockholm stad protection
Browse files Browse the repository at this point in the history
  • Loading branch information
kajetan-kazimierczak committed Sep 8, 2021
1 parent f4d5a45 commit cd19abd
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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<EtjanstChild[]> {
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',
},
Expand Down

0 comments on commit cd19abd

Please sign in to comment.