Skip to content

Instantly share code, notes, and snippets.

@Vexcited
Last active March 1, 2024 21:26
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vexcited/3b599b4eaf0797b532f087540728ec09 to your computer and use it in GitHub Desktop.
Save Vexcited/3b599b4eaf0797b532f087540728ec09 to your computer and use it in GitHub Desktop.
Read PRONOTE encrypted/compressed requests right into the browser

When trying to understand PRONOTE requests, we most of the time open the DevTools and try to read directly the response in the "Network" tab.

Even though, some instances have encrypted and/or compressed data in the payload/response.

image

So here's a solution to read these data, right into your browser.

Drop this function into your browser console when you're on the Pronote page :

const decrypt = (data) => copy(JSON.stringify(JSON.parse(require('ObjetCryptage.js').decrypter({
    genreCryptage: (GApplication.getCommunication().constructor.optionsSecurite.sansCryptageAES ?? false) ? 1 : 2,
    chaine: data,
    cle: GApplication.getCommunication().cleAES,
    iv: GApplication.getCommunication().ivAES,
    avecCompression: !(GApplication.getCommunication().constructor.optionsSecurite.sansCompressionAES ?? false)
})), null, 2));

Now, simply use it like this : decrypt("value_from_donneesSec")

It'll copy the uncompressed/decrypted value in your clipboard, and you're now able to drop it wherever you want.

Since I often need to make TypeScript types out of these, I paste the value directly into this tool https://transform.tools/json-to-typescript.

Hope it helped some of y'all.

@LeGeek01
Copy link

LeGeek01 commented Mar 1, 2024

So actually the copy function doesn't seems to work (in Firefox, maybe it will work with other browsers), here is the function to return the JSON data directly:

const decrypt = (data) => JSON.parse(require('ObjetCryptage.js').decrypter({
    genreCryptage: (GApplication.getCommunication().constructor.optionsSecurite.sansCryptageAES ?? false) ? 1 : 2,
    chaine: data,
    cle: GApplication.getCommunication().cleAES,
    iv: GApplication.getCommunication().ivAES,
    avecCompression: !(GApplication.getCommunication().constructor.optionsSecurite.sansCompressionAES ?? false)
})); 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment