Coder Social home page Coder Social logo

khanacademy_bot's Introduction

An answer revealer for Khan Academy

Working as of 12/5/2020

If this script helped or interested you, please consider staring the repo above. That number looks cool when it's big

Usage

  1. Download a userscript manager like TamperMonkey for Chrome or Greasemonkey for Firefox.
  2. Use this link to install the script.
  3. Click the extension while in Khan Academy and ensure both the extension and the script are on.
  4. Open Developer Tools and go to the Console tab. The script will console log answers as the browser gets them.

Tips

  • Khan Academy always requests the current and next question, so expect the second to last console log message to be the correct answer
  • When there are multiple answers, fill in the boxes left-to-right and then down. You can also press tab to get to the next field. Example below
    • answer: [1, 2, 3, 4] question:
  • Change your console log level to only info for a much better experience

Gotchas

  • This works only for expression, free response, multiple choice, and dropdown questions.
  • The script will do its best to find the answer in the question data, but some edge case questions do not follow the same structure, therefore I can't account for them. (read below to understand the exploit)
  • If the script breaks for a certain type of question, open an issue and I will take a look.
  • I am lazy, therefore this is buggy. Don't be surprised when you run into a question you'll actually have to do

Exploit

It's pretty simple. On every 'quiz' you open in the app, your browser makes a request to /getAssessmentItem. The server responds with everything your client needs to draw and grade your question. Within this graphql response is a json blob containing a list of questions, most of them with a correct: boolean attribute. Sometimes, they try to throw you off by placing correct as the value to a key labeled either status or considered.

Implementation

I wrote this for Chrome, although all should work on gecko. It essentially hooks into the browser's fetch, which is what Khan Academy uses now instead of XMLHttpRequest (this is why the some old exploits no longer work, along with the endpoint change), and when /getAssessmentItem is requested, it logs the "important" part of the response.

Contribution

This is fully open source! If you want to take a crack at automating this script, or if you'd like to add support for more types of questions, like matching for example, feel free to submit a pull request. I'll be sure to credit you accordingly!

Licence

This has the GNU GPL 3.0 licence. I expect most users will be people like me who have AP Stats assignments and no will to do them. I don't care too much about what you do with it, but I like credit :)

khanacademy_bot's People

Contributors

adubov1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.