Created
September 8, 2023 17:31
-
-
Save mpfaff/b44d1f07b1a086ebc553e413a84b0ab8 to your computer and use it in GitHub Desktop.
Speedrun your OSG "Accessibility for Ontarians with Disabilities Act" certificate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs"); | |
const { randomUUID } = require("crypto"); | |
async function register({email, name, company, phone}) { | |
const body = JSON.stringify({ email, full_name: name || "", company: company || "", phone: phone || "" }); | |
console.log(body); | |
return await fetch("https://0rxyymz0p0.execute-api.ca-central-1.amazonaws.com/prod/user", { | |
"credentials": "omit", | |
"headers": { | |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; rv:103.0) Gecko/20100101 Firefox/103.0", | |
"Accept": "application/json, text/javascript, */*; q=0.01", | |
"Accept-Language": "en-US,en;q=0.5", | |
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", | |
"Sec-Fetch-Dest": "empty", | |
"Sec-Fetch-Mode": "cors", | |
"Sec-Fetch-Site": "cross-site" | |
}, | |
"referrer": "https://www.aoda.ca/", | |
"body": body, | |
"method": "POST", | |
"mode": "cors" | |
}); | |
} | |
(async function(){ | |
const uuidA = randomUUID(); | |
const uuidB = randomUUID(); | |
const email = `${uuidA}@${uuidB}.com`; | |
await register({email, name: process.argv[2]}); | |
let cert_req_body = { | |
score: 100, | |
email, | |
time: 0, | |
}; | |
// invalid JSON causes internal server errors... | |
cert_req_body = JSON.stringify(cert_req_body); | |
let response = await fetch("https://0rxyymz0p0.execute-api.ca-central-1.amazonaws.com/prod/send_score", { | |
"credentials": "omit", | |
"headers": { | |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; rv:103.0) Gecko/20100101 Firefox/103.0", | |
"Accept": "application/json, text/javascript, */*; q=0.01", | |
"Accept-Language": "en-US,en;q=0.5", | |
"Content-Type": "application/json", | |
"Sec-Fetch-Dest": "empty", | |
"Sec-Fetch-Mode": "cors", | |
"Sec-Fetch-Site": "cross-site" | |
}, | |
"referrer": "https://www.aoda.ca/", | |
"body": cert_req_body, | |
"method": "POST", | |
"mode": "cors" | |
}); | |
response = await response.json(); | |
console.log(response); | |
const { cert_id } = response; | |
console.log(`Got certificate id: ${cert_id}`); | |
response = await fetch("https://0rxyymz0p0.execute-api.ca-central-1.amazonaws.com/prod/download_cert?cert_id=" + cert_id, { | |
"credentials": "omit", | |
"headers": { | |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; rv:103.0) Gecko/20100101 Firefox/103.0", | |
"Accept": "*/*", | |
"Accept-Language": "en-US,en;q=0.5", | |
"Sec-Fetch-Dest": "empty", | |
"Sec-Fetch-Mode": "cors", | |
"Sec-Fetch-Site": "cross-site" | |
}, | |
"referrer": "https://www.aoda.ca/", | |
"method": "GET", | |
"mode": "cors" | |
}); | |
const { cert } = await response.json(); | |
let buff = Buffer.from(cert, 'base64'); | |
await fs.writeFile(`certificate-${Date.now()}.pdf`, buff, (err) => { | |
if (err) throw err; | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment