Skip to content

Instantly share code, notes, and snippets.

@Logicbloke
Created May 31, 2020 02:30
Show Gist options
  • Save Logicbloke/bd97002354460e427842002a8a6a95fc to your computer and use it in GitHub Desktop.
Save Logicbloke/bd97002354460e427842002a8a6a95fc to your computer and use it in GitHub Desktop.
Cheat: Revealing all questions and answers of a Kahoot quiz.
<?php
error_reporting(null);
if(!isset($_GET["pin"]))
die("No PIN?");
$url = "https://kahoot.it/rest/challenges/pin/".$_GET["pin"];
$response = file_get_contents($url);
$jresponse = json_decode($response, TRUE);
$questions = $jresponse["kahoot"]["questions"];
foreach ($questions as $question) {
echo $question["question"].": ".array_pop(array_filter($question["choices"], "check_true"))["answer"]."\n";
}
function check_true($choice) {
return $choice["correct"];
}
?>
@gffyctuxtdctcdt
Copy link

How do i get this to work i want to do the kahoot bot spammer but i can not figer this out

@greenreader9
Copy link

greenreader9 commented Aug 23, 2021

Not working for me. I copy-pasted the code into a new .PHP file on my webserver, and am getting an HTTP 500 error. (No, I never get the "No Pin?" message)
The 500 error is given when...

  • No pin is provided
  • An incorrect pin is provided
  • A correct pin is provided.

The Kahoot I created is public. When adding my pin to this URL (https://kahoot.it/rest/challenges/pin/PIN_HERE) I get an error message from Kahoot.

{"fields":{"arg1":"Invalid challenge pin code"},"error":"INVALID_DATA","timestamp":1629727943516,"errorCode":41,"errorId":"d0c05fa69be74f4ca433891db2ed6300"}

Is this code no longer working with the Kahoot API?

@Logicbloke
Copy link
Author

@greenreader9 Probably not. I put this together over a year ago, they probably changed their API a bit. But it seems like you're getting an invalid challenge pin even when querying kahoot directly?

@greenreader9
Copy link

But it seems like you're getting an invalid challenge pin even when querying kahoot directly?

On that domain, yes. It makes me think that the entire system might have been re-done. Do you have any idea how yourself or someone else could get this working again? I found a site that has documentation of the Kahoot! API, but it got shut down.

@Logicbloke
Copy link
Author

When I built this, I was just inspecting the kahoot game and found an endpoint that, when supplied with the pin, was actually revealing all the questions and all the answers all at once. When the game is played, it's just visual on the browser's level. Everything is sent all at once from the get go. Not sure if that's possible still.

@greenreader9
Copy link

Makes sense. If you figure out a way to get it working, let me know. I’ll take a look at the Kahoot code once I run out of other things to do an ill let you know if I find anything :)

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