question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hints can't be unlocked when challenge name has special charactes (SQLite)

See original GitHub issue

I’ve been running a Czech CTF for a couple days now. Users have been complaining about the inability to buy hints. I investigated and found out that the presence of characters like “ž” or “é” in the challenge name does not play nice with SQLite when buying hints. I’m attaching the error message. The challenge name was Cože? Jaké heslo? (means What password?). Removing the Czech characters fixed the problem, but it forces me to not use correct Czech.

Instance details:

  • Debian 9 (stretch)
  • CTFd-1.0.3
  • SQLite (libsqlite3-0:amd64 - 3.16.2-5)
ProgrammingError: (sqlite3.ProgrammingError) You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings. [SQL: u'INSERT INTO awards (teamid, name, description, date, value, category, icon) VALUES (?, ?, ?, ?, ?, ?, ?)'] [parameters: (24, 'Hint for Co\xc5\xbee? Jak\xc3\xa9 heslo?', None, '2017-09-07 09:46:29.728823', -25, None, None)]

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ColdHeatcommented, Sep 9, 2017

Okay @octaroot here is the solution:

In challenges.py Look for this line:

award = Awards(teamid=session['id'], name='Hint for {}'.format(chal.name), value=(-hint.cost))

and change it to:

award = Awards(teamid=session['id'], name=unicode('Hint for {}'.format(chal.name)), value=(-hint.cost))

There will be a better fix for this in master.

0reactions
ColdHeatcommented, Sep 8, 2017

Yeah master has a variety of Python 3 fixes that you would need to use. The 1.0.3 release is behind and there will be a new release this weekend.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL String throws error with special character in SQLIte ...
Here is the solution. The column name just needs double-quotes around it i.e. on the inside of the single quotes such that ...
Read more >
Challenge solutions - Pwning OWASP Juice Shop
The challenge solutions found in this release of the companion guide are compatible with v14.3.1 of OWASP Juice Shop. ⭐ Challenges. Receive a...
Read more >
Special characters * and ? are not supported in ... - SQLite Forum
Hi, I am able to create database name with special characters including * and ? on RHEL 8, Sqlite3. But it fails on...
Read more >
The Definitive Guide to SQLite, Second Edition (Expert's Voice ...
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation...
Read more >
Many small queries are efficient in SQLite | Hacker News
I've been applying all those tips and tricks, but it didn't improve performance that much, but I have lost data. Sqlite is full...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found