← Back to challenges

Injection III: Cheating the System

PythonHardlogicgamesdata_structures

Instructions

The bookstore from [this collection] (https://innokodakademija.com/collection/dnXtkLPZpX25t227q) has increased their security again. After setting the variable res, an if statement checks if res is equal to the users dictionary. If it is, it sends an error. Create a query that copies users to res.

Examples

param = "your text here"

users = {
  "user1": "password",
  "user2": "password"
}

res = eval("search("%s")" % param)

if res == users:
  res = {"Error": "No products found."}

print(res) ➞ users

Notes

  • Create a string, not a function.
  • For readability, try to break your string into smaller substrings.
  • As an anti-cheat measure, naming a variable x_x is prohibited.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.