Instruction
stringlengths
13
145k
input_code
stringlengths
35
390k
output_code
stringlengths
35
390k
We don't always find translations because of relative path lookup This fails: ``` grant@johnicicleboy:~/src/PyBitmessage$ LANG=fr_BE.UTF-8 python bitmessagemain.py ``` This works: ``` grant@johnicicleboy:~/src/PyBitmessage/src$ LANG=fr_BE.UTF-8 python bitmessagemain.py ``` Because we use a relative path to lookup t...
src/bitmessageqt/__init__.py <|code_start|>withMessagingMenu = False try: from gi.repository import MessagingMenu from gi.repository import Notify withMessagingMenu = True except ImportError: MessagingMenu = None from addresses import * import shared from bitmessageui import * from namecoin import name...
src/bitmessageqt/__init__.py <|code_start|>withMessagingMenu = False try: from gi.repository import MessagingMenu from gi.repository import Notify withMessagingMenu = True except ImportError: MessagingMenu = None from addresses import * import shared from bitmessageui import * from namecoin import name...
GUI in both french and english The GUI is in both in french and english but for the same message, it's not like the message isn't in the french translation files. The behavior of switching from a language to another is random! ![capture](https://f.cloud.github.com/assets/367844/1649926/c4094920-5a43-11e3-85d1-c1855fe84...
src/bitmessageqt/__init__.py <|code_start|>withMessagingMenu = False try: from gi.repository import MessagingMenu from gi.repository import Notify withMessagingMenu = True except ImportError: MessagingMenu = None from addresses import * import shared from bitmessageui import * from namecoin import name...
src/bitmessageqt/__init__.py <|code_start|>withMessagingMenu = False try: from gi.repository import MessagingMenu from gi.repository import Notify withMessagingMenu = True except ImportError: MessagingMenu = None from addresses import * import shared from bitmessageui import * from namecoin import name...
Error creating address A print statement seems to create a division by 0 exception ``` Exception in thread Thread-1: Traceback (most recent call last): File "C:\Python27\lib\threading.py", line 810, in __bootstrap_inner self.run() File "C:\AdminRoot\TBM\PyBitmessage\src\class_addressGenerator.py", line 101,in ...
src/bitmessageqt/bitmessageui.py <|code_start|># -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'bitmessageui.ui' # # Created: Fri Aug 01 15:30:14 2014 # by: PyQt4 UI code generator 4.10.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: ...
src/bitmessageqt/bitmessageui.py <|code_start|># -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'bitmessageui.ui' # # Created: Mon Jan 05 16:21:20 2015 # by: PyQt4 UI code generator 4.10.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: ...
French time format is wrong: 12-hours without AM/PM instead of 24-hours I have something like (with the af0dfdc version on fedora 23 and the french language) : - _jeu., 03 juin 2016 **01:45**_, instead of - _jeu., 03 juin 2016 **13:45**_. Apparently I have the 12-hours format without the AM/PM indication, so morning ...
src/helper_startup.py <|code_start|>import shared import ConfigParser import sys import os import locale import random import string import platform from distutils.version import StrictVersion from namecoin import ensureNamecoinOptions storeConfigFilesInSameDirectoryAsProgramByDefault = False # The user may de-selec...
src/helper_startup.py <|code_start|>import shared import ConfigParser import sys import os import locale import random import string import platform from distutils.version import StrictVersion from namecoin import ensureNamecoinOptions storeConfigFilesInSameDirectoryAsProgramByDefault = False # The user may de-selec...
Label unicode bug Arrived in bitmessage chan. > Got to Messages tab, double click address, enter name/label/alias: > > Traceback (most recent call last): > File > "/usr/local/lib/python2.7/dist-packages/pybitmessage/bitmessageqt/foldertree.py", > line 237, in setData > if isinstance(value, QtCore.QVaria...
src/bitmessageqt/foldertree.py <|code_start|>from PyQt4 import QtCore, QtGui from tr import _translate from bmconfigparser import BMConfigParser from helper_sql import * from utils import avatarize from settingsmixin import SettingsMixin # for pylupdate _translate("MainWindow", "inbox") _translate("MainWindow", "new"...
src/bitmessageqt/foldertree.py <|code_start|>from PyQt4 import QtCore, QtGui from tr import _translate from bmconfigparser import BMConfigParser from helper_sql import * from utils import avatarize from settingsmixin import SettingsMixin # for pylupdate _translate("MainWindow", "inbox") _translate("MainWindow", "new"...
Any / All revert Revert some code style changes that were too aggressive and adversely affected runtime logic. Reported in the chan: BM-NBctD2fu6pS7M21x5CrkFkkQ25kSvy6M 7 hours ago [raw] This patch undoes the conversion to any()/all() conditionals, reverting to the much faster (and IMO prettier format-wise) lazily...
src/bitmessageqt/__init__.py <|code_start|># pylint: disable=too-many-lines,broad-except,too-many-instance-attributes,global-statement,too-few-public-methods # pylint: disable=too-many-statements,too-many-branches,attribute-defined-outside-init,too-many-arguments,no-member # pylint: disable=unused-argument,no-self-use,...
src/bitmessageqt/__init__.py <|code_start|># pylint: disable=too-many-lines,broad-except,too-many-instance-attributes,global-statement,too-few-public-methods # pylint: disable=too-many-statements,too-many-branches,attribute-defined-outside-init,too-many-arguments,no-member # pylint: disable=unused-argument,no-self-use,...
checkdeps.py broken ``` Traceback (most recent call last): File "checkdeps.py", line 142, in <module> if x in EXTRAS_REQUIRE_DEPS KeyError: None ```
src/depends.py <|code_start|>""" Utility functions to check the availability of dependencies and suggest how it may be installed """ import sys # Only really old versions of Python don't have sys.hexversion. We don't # support them. The logging module was introduced in Python 2.3 if not hasattr(sys, 'hexversion') or ...
src/depends.py <|code_start|>""" Utility functions to check the availability of dependencies and suggest how it may be installed """ import sys # Only really old versions of Python don't have sys.hexversion. We don't # support them. The logging module was introduced in Python 2.3 if not hasattr(sys, 'hexversion') or ...
Crashing on Boot $ python src/bitmessagemain.py Loading existing config files from /home/.config/PyBitmessage/ 2018-08-05 13:19:02,170 - WARNING - Using default logger configuration 2018-08-05 13:19:02,592 - CRITICAL - Unhandled exception Traceback (most recent call last): File "src/bitmessagemain.py", line 507...
src/knownnodes.py <|code_start|>import json import os import pickle # import sys import threading import time import state from bmconfigparser import BMConfigParser from debug import logger knownNodesLock = threading.Lock() knownNodes = {stream: {} for stream in range(1, 4)} knownNodesTrimAmount = 2000 # forget a n...
src/knownnodes.py <|code_start|>import json import os import pickle # import sys import threading import time import state from bmconfigparser import BMConfigParser from debug import logger knownNodesLock = threading.Lock() knownNodes = {stream: {} for stream in range(1, 4)} knownNodesTrimAmount = 2000 # forget a n...
list index out of range traceback when no connects found or file corrupt. random choice need a list to Generates a random sample from a list, but in connection pool it find self.stream empty and through list index out of range traceback: Exception in thread Asyncore: Traceback (most recent call last): PyBitmessa...
src/class_singleCleaner.py <|code_start|>""" The singleCleaner class is a timer-driven thread that cleans data structures to free memory, resends messages when a remote node doesn't respond, and sends pong messages to keep connections alive if the network isn't busy. It cleans these data structures in memory: inventory...
src/class_singleCleaner.py <|code_start|>""" The singleCleaner class is a timer-driven thread that cleans data structures to free memory, resends messages when a remote node doesn't respond, and sends pong messages to keep connections alive if the network isn't busy. It cleans these data structures in memory: inventory...
Wrong lastseen values got written to knownnodes in bmproto Hello! While investigating #1335 I discovered another potential bug. In the [line 380 in bmproto](../blob/v0.6/src/network/bmproto.py#L380) value of `seenTime` is often wrong. I added a simple check: ```python try: assert time.time() - seenTi...
src/network/bmproto.py <|code_start|>import base64 import hashlib import random import socket import struct import time from bmconfigparser import BMConfigParser from debug import logger from inventory import Inventory import knownnodes from network.advanceddispatcher import AdvancedDispatcher from network.dandelion i...
src/network/bmproto.py <|code_start|>import base64 import hashlib import random import socket import struct import time from bmconfigparser import BMConfigParser from debug import logger from inventory import Inventory import knownnodes from network.advanceddispatcher import AdvancedDispatcher from network.dandelion i...
API not HTTP conform # Issue The API does not responds correctly to failed login attempts. # Current result In case invalid or no credentials are provided, the API returns an XML with an error message. While this is not incorrect, the HTTP headers themselves are. # Expected result The API should return with a 401 He...
setup.py <|code_start|>#!/usr/bin/env python2.7 import os import shutil from setuptools import setup, Extension from setuptools.command.install import install from src.version import softwareVersion EXTRAS_REQUIRE = { 'gir': ['pygobject'], 'notify2': ['notify2'], 'opencl': ['pyopencl', 'numpy'], 'p...
setup.py <|code_start|>#!/usr/bin/env python2.7 import os import shutil from setuptools import setup, Extension from setuptools.command.install import install from src.version import softwareVersion EXTRAS_REQUIRE = { 'gir': ['pygobject'], 'json': ['jsonrpclib'], 'notify2': ['notify2'], 'opencl': [...
API clientStatus bug **came over BM. I haven't tested it, just crosspasting** ------------------------------------------------------ In their infinite wisdom the devs have decided on the following logic: If currently connected networkStatus is 'notConnected' If not currently connected and have not received any ...
src/api.py <|code_start|># pylint: disable=too-many-locals,too-many-lines,no-self-use,too-many-public-methods,too-many-branches # pylint: disable=too-many-statements """ src/api.py ========== # Copyright (c) 2012-2016 Jonathan Warren # Copyright (c) 2012-2018 The Bitmessage developers This is not what you run to run ...
src/api.py <|code_start|># pylint: disable=too-many-locals,too-many-lines,no-self-use,too-many-public-methods,too-many-branches # pylint: disable=too-many-statements """ src/api.py ========== # Copyright (c) 2012-2016 Jonathan Warren # Copyright (c) 2012-2018 The Bitmessage developers This is not what you run to run ...
daemon = true in keys.dat doesn't work Probably some of the recent changes broke it. I don't have time to debug, but the symptom is that with `daemon = true` and pyqt absent in the system, upon launch it will complain that pyqt is missing and refuse to start. When run with `-d`, it's fine. Latest `v0.6`. It worked corr...
src/bitmessagemain.py <|code_start|>#!/usr/bin/python2.7 # Copyright (c) 2012-2016 Jonathan Warren # Copyright (c) 2012-2018 The Bitmessage developers # Distributed under the MIT/X11 software license. See the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Right now, PyBitmessage o...
src/bitmessagemain.py <|code_start|>#!/usr/bin/python2.7 # Copyright (c) 2012-2016 Jonathan Warren # Copyright (c) 2012-2018 The Bitmessage developers # Distributed under the MIT/X11 software license. See the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Right now, PyBitmessage o...
Better logging Using the built-in python logging module I've made various log levels possible and made the creation of a log file a matter of changing the configuration in debug.py. The python logging module is thread-safe so we can safely replace all `print` calls with calls to `logger`. I only replaced some of them m...
checkdeps.py <|code_start|>#!/usr/bin/env python2 """ Check dependendies and give recommendations about how to satisfy them Limitations: * Does not detect whether packages are already installed. Solving this requires writing more of a configuration management system. Or we could switch to an existing one. ...
checkdeps.py <|code_start|>#!/usr/bin/env python2 """ Check dependendies and give recommendations about how to satisfy them Limitations: * Does not detect whether packages are already installed. Solving this requires writing more of a configuration management system. Or we could switch to an existing one. ...
Duplicate connections to some onion peers The description is based on messages from `[chan] bitmessage` but I've seen it myself a couple of weeks ago (I thought it's related to my #1394 - wrongly). ![image](https://user-images.githubusercontent.com/4012700/49939372-56add980-fee5-11e8-8f6c-de2f83123ebd.png) Change...
src/network/connectionpool.py <|code_start|>from ConfigParser import NoOptionError, NoSectionError import errno import socket import time import random import re from bmconfigparser import BMConfigParser from debug import logger import helper_bootstrap import knownnodes from network.proxy import Proxy from network.tcp...
src/network/connectionpool.py <|code_start|>from ConfigParser import NoOptionError, NoSectionError import errno import socket import time import random import re from bmconfigparser import BMConfigParser from debug import logger import helper_bootstrap import knownnodes from network.proxy import Proxy from network.tcp...
Reply to own messages handling Came over BM, I think it's a good suggestion: > 2) I would like to reply to my own messages like in regular emails > or chats, usually meant to add information left out, PS, correction > etc. The recepient should be the same as the original message, of > course.
src/bitmessageqt/__init__.py <|code_start|>""" PyQt based UI for bitmessage, the main module """ import hashlib import locale import os import random import string import sys import textwrap import time from datetime import datetime, timedelta from sqlite3 import register_adapter from PyQt4 import QtCore, QtGui from ...
src/bitmessageqt/__init__.py <|code_start|>""" PyQt based UI for bitmessage, the main module """ import hashlib import locale import os import random import string import sys import textwrap import time from datetime import datetime, timedelta from sqlite3 import register_adapter from PyQt4 import QtCore, QtGui from ...
Send message to this chan The chan context menu should contain the ability to send a message to the chan.
src/bitmessageqt/__init__.py <|code_start|>""" PyQt based UI for bitmessage, the main module """ import hashlib import locale import os import random import string import sys import textwrap import threading import time from datetime import datetime, timedelta from sqlite3 import register_adapter from PyQt4 import Qt...
src/bitmessageqt/__init__.py <|code_start|>""" PyQt based UI for bitmessage, the main module """ import hashlib import locale import os import random import string import sys import textwrap import threading import time from datetime import datetime, timedelta from sqlite3 import register_adapter from PyQt4 import Qt...
Tooltip sanitisation Posted in bitmessage chan, easily reproducible. A tooltip is displayed when mouse cursor is moved over the subject field on the message list. That tooltip is affected by HTML tags included in the message subject. It should not be intended behavior. Try on this message's subject that has `<h1>`...
src/bitmessageqt/foldertree.py <|code_start|>""" src/bitmessageqt/foldertree.py ============================== """ # pylint: disable=too-many-arguments,bad-super-call,attribute-defined-outside-init from PyQt4 import QtCore, QtGui from bmconfigparser import BMConfigParser from helper_sql import sqlExecute, sqlQuery fr...
src/bitmessageqt/foldertree.py <|code_start|>""" src/bitmessageqt/foldertree.py ============================== """ # pylint: disable=too-many-arguments,bad-super-call,attribute-defined-outside-init from cgi import escape from PyQt4 import QtCore, QtGui from bmconfigparser import BMConfigParser from helper_sql import...
idea: QR Code export of identities QR Code export for identities would be nice to have for business cards, websites, and once we have an functional (whatever-floats-your-boat system) mobile platform client.
src/bitmessageqt/__init__.py <|code_start|>""" PyQt based UI for bitmessage, the main module """ import hashlib import locale import os import random import string import sys import textwrap import threading import time from datetime import datetime, timedelta from sqlite3 import register_adapter from PyQt4 import Qt...
src/bitmessageqt/__init__.py <|code_start|>""" PyQt based UI for bitmessage, the main module """ import hashlib import locale import os import random import string import sys import textwrap import threading import time from datetime import datetime, timedelta from sqlite3 import register_adapter from PyQt4 import Qt...
extPort bug I think `extPort` was incorrectly refactored, and references in `src/protocol.py` to `state.extPort` should be replaced with `BMConfigParser().safeGetInt('bitmessagesettings', 'extport')`.
src/protocol.py <|code_start|># pylint: disable=too-many-boolean-expressions,too-many-return-statements,too-many-locals,too-many-statements """ protocol.py =========== Low-level protocol-related functions. """ from __future__ import absolute_import import base64 import hashlib import random import socket import sys ...
src/protocol.py <|code_start|># pylint: disable=too-many-boolean-expressions,too-many-return-statements,too-many-locals,too-many-statements """ protocol.py =========== Low-level protocol-related functions. """ from __future__ import absolute_import import base64 import hashlib import random import socket import sys ...
SQL statement error when deleting in QT interface `2019-08-16 08:12:03,023 - CRITICAL - Major error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error mess age or post it in the forum! Error occurred while trying to execute statement: " DELETE FROM inbox" Her...
src/bitmessageqt/__init__.py <|code_start|>""" PyQt based UI for bitmessage, the main module """ import hashlib import locale import os import random import string import sys import textwrap import threading import time from datetime import datetime, timedelta from sqlite3 import register_adapter from PyQt4 import Qt...
src/bitmessageqt/__init__.py <|code_start|>""" PyQt based UI for bitmessage, the main module """ import hashlib import locale import os import random import string import sys import textwrap import threading import time from datetime import datetime, timedelta from sqlite3 import register_adapter from PyQt4 import Qt...
Excessive memory usage I got a report about excessive memory usage. At first I thought it's wrongly deployed because I haven't seen it in a long time, but after upgrading to latest code I could trigger it as well. I'm now doing a poor man's bisect to see where it broke.
src/network/bmproto.py <|code_start|>""" Bitmessage Protocol """ # pylint: disable=attribute-defined-outside-init, too-few-public-methods import base64 import hashlib import logging import socket import struct import time from binascii import hexlify import addresses import connectionpool import knownnodes import prot...
src/network/bmproto.py <|code_start|>""" Bitmessage Protocol """ # pylint: disable=attribute-defined-outside-init, too-few-public-methods import base64 import hashlib import logging import socket import struct import time from binascii import hexlify import addresses import connectionpool import knownnodes import prot...
BMProto.timeOffsetWrongCount unfinished Forgot to finish it after moving to asyncore. There should be a check for a threshold, and a panel notification.
src/network/tcp.py <|code_start|>""" TCP protocol handler """ # pylint: disable=too-many-ancestors import logging import math import random import socket import time import addresses import asyncore_pollchoose as asyncore import connectionpool import helper_random import knownnodes import protocol import state from bm...
src/network/tcp.py <|code_start|>""" TCP protocol handler """ # pylint: disable=too-many-ancestors import l10n import logging import math import random import socket import time import addresses import asyncore_pollchoose as asyncore import connectionpool import helper_random import knownnodes import protocol import s...
Offline mode first time network settings Reported in bitmessage chan: > I am reporting a bug. > To reproduce: > > 1. Backup $HOME/.config/PyBitmessage and remove the directory > 2. Start bitmessagemain.py > 3. When dialog popped, select "Work offline" and push "OK" > 4. On "Settings" menu, go "Network Settings...
src/bitmessageqt/__init__.py <|code_start|>""" PyQt based UI for bitmessage, the main module """ import hashlib import locale import os import random import string import subprocess import sys import textwrap import threading import time from datetime import datetime, timedelta from sqlite3 import register_adapter fr...
src/bitmessageqt/__init__.py <|code_start|>""" PyQt based UI for bitmessage, the main module """ import hashlib import locale import os import random import string import subprocess import sys import textwrap import threading import time from datetime import datetime, timedelta from sqlite3 import register_adapter fr...
own addresses cannot be added to addressbook here when I tried adding my own address to address book,it adds that without any error and I think it should not be like that.
src/bitmessageqt/__init__.py <|code_start|>""" PyQt based UI for bitmessage, the main module """ import hashlib import locale import os import random import string import subprocess import sys import textwrap import threading import time from datetime import datetime, timedelta from sqlite3 import register_adapter fr...
src/bitmessageqt/__init__.py <|code_start|>""" PyQt based UI for bitmessage, the main module """ import hashlib import locale import os import random import string import subprocess import sys import textwrap import threading import time from datetime import datetime, timedelta from sqlite3 import register_adapter fr...
Fix backward compatibility in pickle_deserialize_old_knownnodes() Hello! #1662 is caused by changed package structure. Here I've set up a minimal upgrade from v0.6.3 to reproduce the bug. Using v0.6.2 would be difficult, because it has no command line args.
src/network/knownnodes.py <|code_start|>""" Manipulations with knownNodes dictionary. """ import json import logging import os import pickle import threading import time try: from collections.abc import Iterable except ImportError: from collections import Iterable import state from bmconfigparser import BMCon...
src/network/knownnodes.py <|code_start|>""" Manipulations with knownNodes dictionary. """ import json import logging import os import pickle import threading import time try: from collections.abc import Iterable except ImportError: from collections import Iterable import state from bmconfigparser import BMCon...
Object processor queue starts too early Received a report. Looks like `objectProcessor` starts before `sqlThread` is ready. I can't actually reproduce it, it probably only happens ~if the `objectProcessorQueue` isn't empty~ under non-deterministic conditions. The problem was revealed in 184664d7583096e6cd7b828e08d112ff...
src/class_objectProcessor.py <|code_start|>""" The objectProcessor thread, of which there is only one, processes the network objects """ # pylint: disable=too-many-locals,too-many-return-statements # pylint: disable=too-many-branches,too-many-statements import hashlib import logging import random import threading impor...
src/class_objectProcessor.py <|code_start|>""" The objectProcessor thread, of which there is only one, processes the network objects """ # pylint: disable=too-many-locals,too-many-return-statements # pylint: disable=too-many-branches,too-many-statements import hashlib import logging import random import threading impor...
I can not run Bitmessage when I double click it. I run v0.6, I can not run Bitmessage when I double click it. debug.log : 2016-08-29 19:01:30,918 - ERROR - C PoW test fail. Traceback (most recent call last): File "F:\Coin\FTC\pack\PyInstaller-2.1-0.6\bitmessagemain\build\bitmessagemain\out00-PYZ.pyz\proofofwork", l...
src/proofofwork.py <|code_start|># pylint: disable=too-many-branches,too-many-statements,protected-access """ Proof of work calculation """ import ctypes import hashlib import os import sys import time from struct import pack, unpack from subprocess import call import openclpow import paths import queues import state...
src/proofofwork.py <|code_start|># pylint: disable=too-many-branches,too-many-statements,protected-access """ Proof of work calculation """ import ctypes import hashlib import os import sys import time from struct import pack, unpack from subprocess import call import openclpow import paths import queues import state...
Added "run" tartget for easy launch under Linux What I have changed: - some empty lines added to make it more readable - "run" target added to Makefile for easy launch from source - Updated INSTALL.md accordingly Under Windows you may still need do a "cd src" and "python.exe ./bitmessagemain.py" to launch it.
fabfile/__init__.py <|code_start|>""" Fabric is a Python library for performing devops tasks. If you have Fabric installed (systemwide or via pip) you can run commands like this: $ fab code_quality For a list of commands: $ fab -l For help on fabric itself: $ fab -h For more help on a particular comma...
fabfile/__init__.py <|code_start|><|code_end|> fabfile/lib.py <|code_start|><|code_end|> fabfile/tasks.py <|code_start|><|code_end|>
Error on send message via API If you send a message to an address registered in the address book via API, an error will be returned. ```log 2021-12-11 02:50:58,436 - ERROR - too many values to unpack Traceback (most recent call last): File "api.py", line 1514, in _dispatch File "api.py", line 1487, in _handl...
src/api.py <|code_start|># Copyright (c) 2012-2016 Jonathan Warren # Copyright (c) 2012-2020 The Bitmessage developers """ This is not what you run to start the Bitmessage API. Instead, `enable the API <https://bitmessage.org/wiki/API>`_ and optionally `enable daemon mode <https://bitmessage.org/wiki/Daemon>`_ then ru...
src/api.py <|code_start|># Copyright (c) 2012-2016 Jonathan Warren # Copyright (c) 2012-2020 The Bitmessage developers """ This is not what you run to start the Bitmessage API. Instead, `enable the API <https://bitmessage.org/wiki/API>`_ and optionally `enable daemon mode <https://bitmessage.org/wiki/Daemon>`_ then ru...
Adding Protocol specification to docs (WIP) I am slowly formatting Protocol Specification doc. I see some typos and mistakes in the wiki, which I also hope to fix. [A quick preview](https://pybitmessage-test.readthedocs.io/en/doc/protocol.html)
docs/conf.py <|code_start|># -*- coding: utf-8 -*- """ Configuration file for the Sphinx documentation builder. For a full list of options see the documentation: http://www.sphinx-doc.org/en/master/config """ import os import sys sys.path.insert(0, os.path.abspath('../src')) from importlib import import_module imp...
docs/conf.py <|code_start|># -*- coding: utf-8 -*- """ Configuration file for the Sphinx documentation builder. For a full list of options see the documentation: http://www.sphinx-doc.org/en/master/config """ import os import sys sys.path.insert(0, os.path.abspath('../src')) from importlib import import_module imp...
Incorrect stream offset in `HandleDisseminatePreEncryptedMsg` A user wanted to use `HandleDisseminatePreEncryptedMsg` API call and it didn't appear to work. After reviewing the code and specification, it looks like when decoding destination stream: https://github.com/Bitmessage/PyBitmessage/blob/a5a56fe7f1af86f5b8c4...
src/api.py <|code_start|># Copyright (c) 2012-2016 Jonathan Warren # Copyright (c) 2012-2022 The Bitmessage developers """ This is not what you run to start the Bitmessage API. Instead, `enable the API <https://bitmessage.org/wiki/API>`_ and optionally `enable daemon mode <https://bitmessage.org/wiki/Daemon>`_ then ru...
src/api.py <|code_start|># Copyright (c) 2012-2016 Jonathan Warren # Copyright (c) 2012-2022 The Bitmessage developers """ This is not what you run to start the Bitmessage API. Instead, `enable the API <https://bitmessage.org/wiki/API>`_ and optionally `enable daemon mode <https://bitmessage.org/wiki/Daemon>`_ then ru...
When editing an application user can select capabilities not allowed by his groups
apps/dot_ext/views/application.py <|code_start|>from django.core.urlresolvers import reverse_lazy from django.forms.models import modelform_factory from django.views.generic import CreateView, DetailView, DeleteView, ListView, UpdateView from braces.views import LoginRequiredMixin from oauth2_provider.models import g...
apps/dot_ext/views/application.py <|code_start|>from django.core.urlresolvers import reverse_lazy from django.forms.models import modelform_factory from django.views.generic import CreateView, DetailView, DeleteView, ListView, UpdateView from braces.views import LoginRequiredMixin from oauth2_provider.models import g...
Add URL pattern mating support to Protected Capability Add URL pattern mating support to Protected Capability model. For example, something like this could work: [ ["POST", "/fhir/v3/Practitioner"], ["PUT", "/fhir/v3/Practitioner/[id]"], ["POST", "/fhir/v3/Organization"], ["PUT", "/fhir/v3/Organizatio...
apps/capabilities/models.py <|code_start|>from __future__ import absolute_import from __future__ import unicode_literals import json from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.contrib.auth.models import Group @python_2_unicode_compatible class ProtectedCap...
apps/capabilities/models.py <|code_start|>from __future__ import absolute_import from __future__ import unicode_literals import json import re try: # this import should work on python2 only from itertools import izip as zip except ImportError: pass from django.db import models from django.contrib.auth.mo...
Auto-archive script not running on crawled dataset? All OSF or Zenodo datasets are not being archived when running the script `auto_archive.py` with option `--all`. The following information systematically shows: ``` SKIPPED: archive not needed for projects/<dataset_name> ``` but the dataset size is definitely ...
scripts/auto_archive.py <|code_start|>from __future__ import annotations import argparse import json import logging import os from datetime import datetime from datetime import timedelta import git import humanfriendly from datalad.plugin import export_archive from github import Github from scripts.datalad_utils imp...
scripts/auto_archive.py <|code_start|>from __future__ import annotations import argparse import json import logging import os from datetime import datetime from datetime import timedelta import git import humanfriendly from datalad.plugin import export_archive from github import Github from scripts.datalad_utils imp...
Zenodo: Add taxonomic "subject" annotation to crawl results ## Purpose Zenodo offers authors the [option to annotate with "Subjects"](https://developers.zenodo.org/#representation): > Specify subjects from a taxonomy or controlled vocabulary. Each term must be uniquely identified (e.g. a URL). For free form text, us...
scripts/Crawlers/ZenodoCrawler.py <|code_start|>import datetime import json import os from typing import Callable import html2markdown import humanize import requests from datalad.distribution.dataset import Dataset from git import Repo from scripts.Crawlers.BaseCrawler import BaseCrawler def _create_zenodo_tracker...
scripts/Crawlers/ZenodoCrawler.py <|code_start|>import datetime import json import os import re from typing import Callable import html2markdown import humanize import requests from datalad.distribution.dataset import Dataset from git import Repo from scripts.Crawlers.BaseCrawler import BaseCrawler def _create_zeno...
Interface to view wrong key submissions
CTFd/admin.py <|code_start|>from flask import render_template, request, redirect, abort, jsonify, url_for, session from CTFd.utils import sha512, is_safe_url, authed, admins_only, is_admin, unix_time, unix_time_millis, get_config, set_config, get_digitalocean, sendmail, rmdir from CTFd.models import db, Teams, Solves, ...
CTFd/admin.py <|code_start|>from flask import render_template, request, redirect, abort, jsonify, url_for, session from CTFd.utils import sha512, is_safe_url, authed, admins_only, is_admin, unix_time, unix_time_millis, get_config, set_config, get_digitalocean, sendmail, rmdir from CTFd.models import db, Teams, Solves, ...
Fix Python 3 compatability Like a weenie, I dev on Python 2 so occasionally Python 3 breaking changes will be introduced. Need to root those out and fix those.
migrations/versions/87733981ca0e_adds_challenge_types_and_uses_keys_table.py <|code_start|>"""Adds challenge types and uses keys table Revision ID: 87733981ca0e Revises: cb3cfcc47e2f Create Date: 2017-02-04 14:50:16.999303 """ from CTFd.models import db, Challenges, Keys from alembic import op import sqlalchemy as sa...
migrations/versions/87733981ca0e_adds_challenge_types_and_uses_keys_table.py <|code_start|>"""Adds challenge types and uses keys table Revision ID: 87733981ca0e Revises: cb3cfcc47e2f Create Date: 2017-02-04 14:50:16.999303 """ from CTFd.models import db, Challenges, Keys from alembic import op import sqlalchemy as sa...
Unsupported python3 method In the challenges.py it is used unicode, an unsupported python3, method. This makes it impossible to submit flags. This is the relevant line: ` provided_key = unicode(request.form['key'].strip())`
CTFd/__init__.py <|code_start|>import os from distutils.version import StrictVersion from flask import Flask from jinja2 import FileSystemLoader from sqlalchemy.engine.url import make_url from sqlalchemy.exc import OperationalError, ProgrammingError from sqlalchemy_utils import database_exists, create_database from si...
CTFd/__init__.py <|code_start|>import sys import os from distutils.version import StrictVersion from flask import Flask from jinja2 import FileSystemLoader from sqlalchemy.engine.url import make_url from sqlalchemy.exc import OperationalError, ProgrammingError from sqlalchemy_utils import database_exists, create_datab...
Searching teams from the admin panel
CTFd/admin/teams.py <|code_start|>from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint from CTFd.utils import admins_only, is_admin, cache from CTFd.models import db, Teams, Solves, Awards, Unlocks, Containers, Challenges, WrongKeys, Keys, Tags, Files, Tracking, Pages, C...
CTFd/admin/teams.py <|code_start|>from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint from CTFd.utils import admins_only, is_admin, cache from CTFd.models import db, Teams, Solves, Awards, Unlocks, Containers, Challenges, WrongKeys, Keys, Tags, Files, Tracking, Pages, C...
Hints can move the scoreboard after the CTF is over If someone pays to unlock a hint after the CTF is over their dot will move on the scoreboard to reflect it. 1 possible solution. Make hints automatically free after CTF time is done Hints can move the scoreboard after the CTF is over If someone pays to unlock a hin...
CTFd/challenges.py <|code_start|>import json import logging import re import time from flask import render_template, request, redirect, jsonify, url_for, session, Blueprint from sqlalchemy.sql import or_ from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys, Tags, Teams, Awards, Hints, Unlocks from C...
CTFd/challenges.py <|code_start|>import json import logging import re import time from flask import render_template, request, redirect, jsonify, url_for, session, Blueprint from sqlalchemy.sql import or_ from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys, Tags, Teams, Awards, Hints, Unlocks from C...
email module error when running under Gunicorn While sending a mail under a production environment deployed with Gunicorn, utils.py will return a exception like that: ``` File "/home/ubuntu/CTFd/CTFd/utils.py", line 477, in sendmail msg = email.mime.text.MIMEText(text) AttributeError: 'module' object has no a...
CTFd/utils.py <|code_start|>import datetime import email import functools import hashlib import json import logging import logging.handlers import mistune import os import re import requests import shutil import smtplib import socket import subprocess import sys import tempfile import time import urllib import dataset ...
CTFd/utils.py <|code_start|>import datetime import functools import hashlib import json import logging import logging.handlers import mistune import os import re import requests import shutil import six import smtplib import socket import subprocess import sys import tempfile import time import urllib import dataset im...
Advice on E-mail Mechanism It seems that when E-mail server and E-mail confirmation are enabled, CTFd will send a new E-mail to the E-mail address input by the new user every time he or she logged in without confirmation yet (At least my SMTP server does like that, I will be apologize if it is my own wrong configuratio...
CTFd/auth.py <|code_start|>import logging import os import re import time import urllib from flask import current_app as app, render_template, request, redirect, url_for, session, Blueprint from itsdangerous import TimedSerializer, BadTimeSignature, Signer, BadSignature from passlib.hash import bcrypt_sha256 from CTF...
CTFd/auth.py <|code_start|>import logging import os import re import time import urllib from flask import current_app as app, render_template, request, redirect, url_for, session, Blueprint from itsdangerous import TimedSerializer, BadTimeSignature, Signer, BadSignature from passlib.hash import bcrypt_sha256 from CTF...
Log failed login attempts During CTF competitions, mischievous participants or rogue strangers may try to exploit CTFd by brute forcing the login page or attempt SQL injections, etc... It'll be useful if we could add the failed login attempts into the existing /opt/CTFd/CTFd/logs/logins.log or maybe a new file named...
CTFd/auth.py <|code_start|>import logging import os import re import time import urllib from flask import current_app as app, render_template, request, redirect, url_for, session, Blueprint from itsdangerous import TimedSerializer, BadTimeSignature, Signer, BadSignature from passlib.hash import bcrypt_sha256 from CTF...
CTFd/auth.py <|code_start|>import logging import os import re import time import urllib from flask import current_app as app, render_template, request, redirect, url_for, session, Blueprint from itsdangerous import TimedSerializer, BadTimeSignature, Signer, BadSignature from passlib.hash import bcrypt_sha256 from CTF...
Awards is not accounted in `user.place()` [`user.place()`][user_place] is not accounting awards while [`get_standings()`][get_standings] does. This causes different ordering in scoreboard and team profile. Is this by design? [user_place]: https://github.com/CTFd/CTFd/blob/master/CTFd/models.py#L200 [get_standings]:...
CTFd/models.py <|code_start|>import datetime import hashlib import json import netaddr from socket import inet_pton, inet_ntop, AF_INET, AF_INET6 from struct import unpack, pack, error as struct_error from flask_sqlalchemy import SQLAlchemy from passlib.hash import bcrypt_sha256 from sqlalchemy.exc import DatabaseErro...
CTFd/models.py <|code_start|>import datetime import hashlib import json import netaddr from socket import inet_pton, inet_ntop, AF_INET, AF_INET6 from struct import unpack, pack, error as struct_error from flask_sqlalchemy import SQLAlchemy from passlib.hash import bcrypt_sha256 from sqlalchemy.exc import DatabaseErro...
Error in email verification with python3 I'm running CTFd 1.0.3 with python3. I turned on email verification and now, when registering an account, I get a 500 error and the following backtrace: ``` [2017-08-01 18:49:31,526] ERROR in app: Exception on /confirm [POST] Traceback (most recent call last): File "/opt/C...
CTFd/auth.py <|code_start|>import logging import os import re import time import urllib from flask import current_app as app, render_template, request, redirect, url_for, session, Blueprint from itsdangerous import TimedSerializer, BadTimeSignature, Signer, BadSignature from passlib.hash import bcrypt_sha256 from CTF...
CTFd/auth.py <|code_start|>import logging import os import re import time from flask import current_app as app, render_template, request, redirect, url_for, session, Blueprint from itsdangerous import TimedSerializer, BadTimeSignature, Signer, BadSignature from passlib.hash import bcrypt_sha256 from CTFd.models impor...
Put documentation around caching CTFd relies on a cache to make sure that it doesnt overload the DB with unnecessary queries. `config.py` should be very clear that this is the case and we should make sure that the user knows that they need to have a cache available.
CTFd/config.py <|code_start|>import os ''' GENERATE SECRET KEY ''' with open('.ctfd_secret_key', 'a+b') as secret: secret.seek(0) # Seek to beginning of file since a+ mode leaves you at the end and w+ deletes the file key = secret.read() if not key: key = os.urandom(64) secret.write(key) ...
CTFd/config.py <|code_start|>import os ''' GENERATE SECRET KEY ''' with open('.ctfd_secret_key', 'a+b') as secret: secret.seek(0) # Seek to beginning of file since a+ mode leaves you at the end and w+ deletes the file key = secret.read() if not key: key = os.urandom(64) secret.write(key) ...
Hiding scores config needs to be more expansive Score hiding needs to cover a few more routes.
CTFd/challenges.py <|code_start|>import json import logging import re import time from flask import render_template, request, redirect, jsonify, url_for, session, Blueprint, abort from sqlalchemy.sql import or_ from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys, Tags, Teams, Awards, Hints, Unlocks...
CTFd/challenges.py <|code_start|>import json import logging import re import time from flask import render_template, request, redirect, jsonify, url_for, session, Blueprint, abort from sqlalchemy.sql import or_ from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys, Tags, Teams, Awards, Hints, Unlocks...
Hints can't be unlocked when challenge name has special charactes (SQLite) 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 ...
CTFd/challenges.py <|code_start|>import json import logging import re import time from flask import render_template, request, redirect, jsonify, url_for, session, Blueprint, abort from sqlalchemy.sql import or_ from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys, Tags, Teams, Awards, Hints, Unlocks...
CTFd/challenges.py <|code_start|>import json import logging import re import time from flask import render_template, request, redirect, jsonify, url_for, session, Blueprint, abort from sqlalchemy.sql import or_ from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys, Tags, Teams, Awards, Hints, Unlocks...
Exporting Error When I try to backup the CTFd data using the Admin Panel.I get an 500 error.And I'm using gunicorn to deploy it. Here's the traceback: ``` ~[2017-09-13 20:16:18,514] ERROR in app: Exception on /admin/export [GET] Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/flas...
CTFd/utils.py <|code_start|>import base64 import datetime import functools import hashlib import json import logging import logging.handlers import mistune import os import re import requests import shutil import six import smtplib import socket import sys import tempfile import time import dataset import zipfile impor...
CTFd/utils.py <|code_start|>import base64 import datetime import functools import hashlib import json import logging import logging.handlers import mistune import os import re import requests import shutil import six import smtplib import socket import sys import tempfile import time import dataset import datafreeze im...
Move plugin focused functions to the plugins folder `override_template` `register_plugin_script` `register_plugin_stylesheet` These should move to the plugins directory.
CTFd/plugins/__init__.py <|code_start|>import glob import importlib import os from flask.helpers import safe_join from flask import send_file, send_from_directory, abort from CTFd.utils import admins_only as admins_only_wrapper def register_plugin_assets_directory(app, base_path, admins_only=False): """ Regi...
CTFd/plugins/__init__.py <|code_start|>import glob import importlib import os from flask.helpers import safe_join from flask import current_app as app, send_file, send_from_directory, abort from CTFd.utils import ( admins_only as admins_only_wrapper, override_template as utils_override_template, register_p...
Mechanism for registering new admin links on the navbar
CTFd/admin/__init__.py <|code_start|>import hashlib import json import os import datetime from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint, \ abort, render_template_string, send_file from passlib.hash import bcrypt_sha256 from sqlalchemy.sql import not_ from sql...
CTFd/admin/__init__.py <|code_start|>import hashlib import json import os import datetime from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint, \ abort, render_template_string, send_file from passlib.hash import bcrypt_sha256 from sqlalchemy.sql import not_ from sql...
Configuration can be auto-filled potentially causing issues
CTFd/admin/__init__.py <|code_start|>import hashlib import json import os import datetime from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint, \ abort, render_template_string, send_file from passlib.hash import bcrypt_sha256 from sqlalchemy.sql import not_ from sql...
CTFd/admin/__init__.py <|code_start|>import hashlib import json import os import datetime from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint, \ abort, render_template_string, send_file from passlib.hash import bcrypt_sha256 from sqlalchemy.sql import not_ from sql...
Hidden challenges can be answered without being unhidden If attacker obtains the key of Hidden Challenge using some method, attacker can answer Hidden Challenge. It is possible by sending Hidden Challenge's key and id to `/chal`. Hidden Challenge's id is a sequential number, so it can be searched by brute force. ...
CTFd/challenges.py <|code_start|>import json import logging import re import time from flask import render_template, request, redirect, jsonify, url_for, session, Blueprint, abort from sqlalchemy.sql import or_ from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys, Tags, Teams, Awards, Hints, Unlocks...
CTFd/challenges.py <|code_start|>import json import logging import re import time from flask import render_template, request, redirect, jsonify, url_for, session, Blueprint, abort from sqlalchemy.sql import or_ from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys, Tags, Teams, Awards, Hints, Unlocks...
Hints can be unlocked after the end of a CTF for no cost There is a case where if the CTF is frozen/temporarily ended a user can not only access the hints but also "buy" hints for free (regardless of the cost). Steps to reproduce: 1. Have a user login and view the challenges page 2. Use an administrative account t...
CTFd/challenges.py <|code_start|>import json import logging import re import time from flask import render_template, request, redirect, jsonify, url_for, session, Blueprint, abort from sqlalchemy.sql import or_ from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys, Tags, Teams, Awards, Hints, Unlocks...
CTFd/challenges.py <|code_start|>import json import logging import re import time from flask import render_template, request, redirect, jsonify, url_for, session, Blueprint, abort from sqlalchemy.sql import or_ from CTFd.models import db, Challenges, Files, Solves, WrongKeys, Keys, Tags, Teams, Awards, Hints, Unlocks...
Creating a page route starting with a / Creating a page route that begins with a slash causes problems: 1. Content is not saved 2. Page cannot be removed using the /admin/pages interface Text on /admin/pages?mode=create seems to suggest that the route should start with a slash. I suggest stripping any initial...
CTFd/admin/pages.py <|code_start|>from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint from CTFd.utils import admins_only, is_admin, cache from CTFd.models import db, Teams, Solves, Awards, Challenges, WrongKeys, Keys, Tags, Files, Tracking, Pages, Config, DatabaseError ...
CTFd/admin/pages.py <|code_start|>from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint from CTFd.utils import admins_only, is_admin, cache from CTFd.models import db, Teams, Solves, Awards, Challenges, WrongKeys, Keys, Tags, Files, Tracking, Pages, Config, DatabaseError ...
Optimize top10 call https://github.com/CTFd/CTFd/blob/master/CTFd/scoreboard.py#L125-L127 This code seems pretty wasteful and is likely getting hit fairly often. Optimizing this to be a single database query is likely a good idea.
CTFd/scoreboard.py <|code_start|>from flask import render_template, jsonify, Blueprint, redirect, url_for, request from sqlalchemy.sql.expression import union_all from CTFd.models import db, Teams, Solves, Awards, Challenges from CTFd import utils scoreboard = Blueprint('scoreboard', __name__) def get_standings(ad...
CTFd/scoreboard.py <|code_start|>from flask import render_template, jsonify, Blueprint, redirect, url_for, request from sqlalchemy.sql.expression import union_all from CTFd.models import db, Teams, Solves, Awards, Challenges from CTFd import utils scoreboard = Blueprint('scoreboard', __name__) def get_standings(ad...
[Feature] Admin Team List - New Team Admins should be able to create teams quickly for the admin team list page. **TODO:** - [x] MVP https://github.com/deckar01/CTFd/commit/c5df9994cbe61bc4815d71247eaa21ee5ed54d3c - [ ] Fix inline style issue - [ ] Add tests ![screen shot 2017-11-18 at 4 41 31 pm](https://user...
CTFd/admin/teams.py <|code_start|>from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint from CTFd.utils import admins_only, is_admin, cache from CTFd.models import db, Teams, Solves, Awards, Unlocks, Challenges, WrongKeys, Keys, Tags, Files, Tracking, Pages, Config, Datab...
CTFd/admin/teams.py <|code_start|>from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint from CTFd.utils import admins_only, is_admin, cache from CTFd.models import db, Teams, Solves, Awards, Unlocks, Challenges, WrongKeys, Keys, Tags, Files, Tracking, Pages, Config, Datab...
Can't set profile As the results of this build show: https://travis-ci.org/CTFd/CTFd/builds/307409420 #473 does have a point that the profile is unable to be set. I think this is because of the app_context() call. This probably needs to be removed.
CTFd/utils.py <|code_start|>import base64 import datetime import functools import hashlib import json import logging import logging.handlers import mistune import os import re import requests import shutil import six import smtplib import socket import sys import tempfile import time import dataset import datafreeze im...
CTFd/utils.py <|code_start|>import base64 import datetime import functools import hashlib import json import logging import logging.handlers import mistune import os import re import requests import shutil import six import smtplib import socket import sys import tempfile import time import dataset import datafreeze im...
Importing CTFd-exported ZIP gives DateTime error <!-- If this is a bug report please fill out the template below. If this is a feature request please describe the behavior that you'd like to see. --> **Environment**: - CTFd Version/Commit: master - Operating System: Debian Testing - Web Browser and V...
CTFd/utils.py <|code_start|>import base64 import datetime import functools import hashlib import json import logging import logging.handlers import mistune import os import re import requests import shutil import six import smtplib import socket import sys import tempfile import time import dataset import datafreeze im...
CTFd/utils.py <|code_start|>import base64 import datetime import functools import hashlib import json import logging import logging.handlers import mistune import os import re import requests import shutil import six import smtplib import socket import sys import tempfile import time import dataset import datafreeze im...
Importing an export generated prior to 1.1 (with configuration) breaks CTFd **Environment**: - CTFd Version/Commit: 3af98b17d535b6b04aedc385c28771445dab3699 - Operating System: Linux - Web Browser and Version: N/A **What happened?** Import an export containing configuration that was generated prior to 3...
migrations/versions/d5a224bf5862_change_theme_from_original_to_core.py <|code_start|><|code_end|>
migrations/versions/d5a224bf5862_change_theme_from_original_to_core.py <|code_start|>"""Change theme from original to core Revision ID: d5a224bf5862 Revises: c12d2a1b0926 Create Date: 2017-12-13 16:06:51.644187 """ from CTFd.models import db from alembic import op import sqlalchemy as sa from sqlalchemy.dialects impo...
Upgrade to Font Awesome 5 CTFd 1.1 is meant to be a major front end improvement. Font Awesome 5 is out and I think if there's a time to make this change it would be now. https://fontawesome.com/how-to-use/upgrading-from-4
CTFd/views.py <|code_start|>import os import re from flask import current_app as app, render_template, request, redirect, abort, jsonify, url_for, session, Blueprint, Response, send_file from flask.helpers import safe_join from jinja2.exceptions import TemplateNotFound from passlib.hash import bcrypt_sha256 from CTFd...
CTFd/views.py <|code_start|>import os import re from flask import current_app as app, render_template, request, redirect, abort, jsonify, url_for, session, Blueprint, Response, send_file from flask.helpers import safe_join from jinja2.exceptions import TemplateNotFound from passlib.hash import bcrypt_sha256 from CTFd...
Bootstrap Beta v3 https://getbootstrap.com/docs/4.0/migration/#beta-3-changes See if anything needs to be changed to support Bootstrap Betav3. Supposedly there won't be breaking changes between v3 and Stable so this is a good issue to look into.
CTFd/admin/challenges.py <|code_start|>from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint from CTFd.utils import admins_only, is_admin, cache from CTFd.models import db, Teams, Solves, Awards, Challenges, WrongKeys, Keys, Tags, Files, Tracking, Pages, Config, Hints, Un...
CTFd/admin/challenges.py <|code_start|>from flask import current_app as app, render_template, request, redirect, jsonify, url_for, Blueprint from CTFd.utils import admins_only, is_admin, cache from CTFd.models import db, Teams, Solves, Awards, Challenges, WrongKeys, Keys, Tags, Files, Tracking, Pages, Config, Hints, Un...
Wrong behaviour of scoreboard with a draw and 0-points tasks We are currently participating in a CTF where the organizers wanted to add additional tasks worth 0 points to not influence the scoreboard. As we are currently the 1st team, I wanted to double check if that wouldn't cause any problems and it turns out it actu...
CTFd/models.py <|code_start|>import datetime import hashlib import json import netaddr from socket import inet_pton, inet_ntop, AF_INET, AF_INET6 from struct import unpack, pack, error as struct_error from flask_sqlalchemy import SQLAlchemy from passlib.hash import bcrypt_sha256 from sqlalchemy.exc import DatabaseErro...
CTFd/models.py <|code_start|>import datetime import hashlib import json import netaddr from socket import inet_pton, inet_ntop, AF_INET, AF_INET6 from struct import unpack, pack, error as struct_error from flask_sqlalchemy import SQLAlchemy from passlib.hash import bcrypt_sha256 from sqlalchemy.exc import DatabaseErro...
Force update check It looks like CTFd doesn't force check for updates on startup if `next_version_check` time hasn't been reached. This causes users to update CTFd but the banner indicating a new version will still be there. We should probably force update checks on start if update checks arent disabled.
CTFd/__init__.py <|code_start|>import sys import os from distutils.version import StrictVersion from flask import Flask from jinja2 import FileSystemLoader from jinja2.sandbox import SandboxedEnvironment from sqlalchemy.engine.url import make_url from sqlalchemy_utils import database_exists, create_database from six.m...
CTFd/__init__.py <|code_start|>import sys import os from distutils.version import StrictVersion from flask import Flask from jinja2 import FileSystemLoader from jinja2.sandbox import SandboxedEnvironment from sqlalchemy.engine.url import make_url from sqlalchemy_utils import database_exists, create_database from six.m...
Certain templates can be force loaded There are certain templates which are accessible because of the static_html handler. This isn't a vulnerability because it appears like no sensitive information is loaded but it should be fixed. It's possible that the template handler itself should just be entirely removed.
CTFd/views.py <|code_start|>import os import re from flask import current_app as app, render_template, request, redirect, abort, jsonify, url_for, session, Blueprint, Response, send_file from flask.helpers import safe_join from jinja2.exceptions import TemplateNotFound from passlib.hash import bcrypt_sha256 from CTFd...
CTFd/views.py <|code_start|>import os import re from flask import current_app as app, render_template, request, redirect, abort, jsonify, url_for, session, Blueprint, Response, send_file from flask.helpers import safe_join from jinja2.exceptions import TemplateNotFound from passlib.hash import bcrypt_sha256 from CTFd...
Docker startup getting stuck on mysqladmin ping **Environment**: - CTFd Version/Commit: ctfd/ctfd:latest from Docker hub (17 days old) - Operating System: Amazon Linux AMI 2017.09.j x86_64 ECS HVM GP2 - Web Browser and Version: N/A **What happened?** Trying to setup CTFd with AWS ECS and RDS Aurora. I...
wsgi.py <|code_start|>from CTFd import create_app app = create_app() <|code_end|>
wsgi.py <|code_start|><|code_end|>
Error on import: unsupported operand type(s) for +=: 'NoneType' and 'int' **Environment**: - CTFd Version/Commit: 1.1.4 - Operating System: Linux / Docker - Web Browser and Version: Latest Chrome **What happened?** Restoring from backup on the Web silently fails. Restoring from the command-line fails w...
CTFd/utils.py <|code_start|>import base64 import datetime import functools import hashlib import json import logging import logging.handlers import mistune import os import re import requests import shutil import six import smtplib import socket import sys import tempfile import time import dataset import datafreeze im...
CTFd/utils.py <|code_start|>import base64 import datetime import functools import hashlib import json import logging import logging.handlers import mistune import os import re import requests import shutil import six import smtplib import socket import sys import tempfile import time import dataset import datafreeze im...
docker-entrypoint.sh should exit on any error **Environment**: - CTFd Version/Commit: master, but also affects 2.0.0. - Operating System: MacOS X, but using docker so doesn't matter. - Web Browser and Version: N/A **What happened?** An error in ``python manage.py migrate`` will not cause `...
migrations/1_2_0_upgrade_2_0_0.py <|code_start|>import sys import os # This is important to allow access to the CTFd application factory sys.path.append(os.getcwd()) import datetime import hashlib import netaddr from flask_sqlalchemy import SQLAlchemy from passlib.hash import bcrypt_sha256 from sqlalchemy.sql.express...
migrations/1_2_0_upgrade_2_0_0.py <|code_start|>from __future__ import print_function import sys import os # This is important to allow access to the CTFd application factory sys.path.append(os.getcwd()) import datetime import hashlib import netaddr from flask_sqlalchemy import SQLAlchemy from passlib.hash import bcr...
2.0.0: Admin page and Dynamic challenges' delete function error. **Environment**: - CTFd Version/Commit: **Docker ctfd/ctfd:finalize-2.0.0** and **mark-2.0.0** - Operating System: **Ubuntu14.04-Server** - Web Browser and Version: **Chrome 70.0.3538.102 / Microsoft EdgeHTML 17.17134** **What happened?** ...
CTFd/plugins/dynamic_challenges/__init__.py <|code_start|>from __future__ import division # Use floating point for math calculations from CTFd.plugins.challenges import BaseChallenge, CHALLENGE_CLASSES from CTFd.plugins import register_plugin_assets_directory from CTFd.plugins.flags import get_flag_class from CTFd.mod...
CTFd/plugins/dynamic_challenges/__init__.py <|code_start|>from __future__ import division # Use floating point for math calculations from CTFd.plugins.challenges import BaseChallenge, CHALLENGE_CLASSES from CTFd.plugins import register_plugin_assets_directory from CTFd.plugins.flags import get_flag_class from CTFd.mod...
dynamic challenges not work when using user mode **Environment**: - CTFd Version/Commit:`2bd310b5d99f4305f8b61076f9af3b7e3c91ba8f` - Operating System: `ubuntu 16.04` - Web Browser and Version: `Chrome` when using user mode , `solve_count` always get 0 https://github.com/CTFd/CTFd/blob/master/CTFd/pl...
CTFd/plugins/dynamic_challenges/__init__.py <|code_start|>from __future__ import division # Use floating point for math calculations from CTFd.plugins.challenges import BaseChallenge, CHALLENGE_CLASSES from CTFd.plugins import register_plugin_assets_directory from CTFd.plugins.flags import get_flag_class from CTFd.mod...
CTFd/plugins/dynamic_challenges/__init__.py <|code_start|>from __future__ import division # Use floating point for math calculations from CTFd.plugins.challenges import BaseChallenge, CHALLENGE_CLASSES from CTFd.plugins import register_plugin_assets_directory from CTFd.plugins.flags import get_flag_class from CTFd.mod...
Mail Plugin does not work - UnboundLocalError: local variable 'auth' referenced before assignment **Environment**: - CTFd Version/Commit: master - Operating System: Debian - Web Browser and Version: Chrome and Firefox current **What happened?** Setting up an E-Mail server and afterwards registering to ...
CTFd/config.py <|code_start|>import os ''' GENERATE SECRET KEY ''' if not os.getenv('SECRET_KEY'): # Attempt to read the secret from the secret file # This will fail if the secret has not been written try: with open('.ctfd_secret_key', 'rb') as secret: key = secret.read() except (O...
CTFd/config.py <|code_start|>import os ''' GENERATE SECRET KEY ''' if not os.getenv('SECRET_KEY'): # Attempt to read the secret from the secret file # This will fail if the secret has not been written try: with open('.ctfd_secret_key', 'rb') as secret: key = secret.read() except (O...
Not possible to download files as anonymous user **Environment**: - CTFd Version/Commit: 2.0.0 from master - Operating System: Debian Stretch, Ubuntu 18.04, ... - Web Browser and Version: Firefox 63 **What happened?** * In admin, set visibility of challenges to public * Logout * Open challenge view (...
CTFd/api/v1/challenges.py <|code_start|>from flask import session, request, abort from flask_restplus import Namespace, Resource from CTFd.models import ( db, Challenges, Unlocks, HintUnlocks, Tags, Hints, Flags, Solves, Submissions, Fails, ChallengeFiles as ChallengeFilesMod...
CTFd/api/v1/challenges.py <|code_start|>from flask import session, request, abort from flask_restplus import Namespace, Resource from CTFd.models import ( db, Challenges, Unlocks, HintUnlocks, Tags, Hints, Flags, Solves, Submissions, Fails, ChallengeFiles as ChallengeFilesMod...
Not possible to download files as anonymous user **Environment**: - CTFd Version/Commit: 2.0.0 from master - Operating System: Debian Stretch, Ubuntu 18.04, ... - Web Browser and Version: Firefox 63 **What happened?** * In admin, set visibility of challenges to public * Logout * Open challenge view (...
CTFd/__init__.py <|code_start|>import sys import os from distutils.version import StrictVersion from flask import Flask from werkzeug.contrib.fixers import ProxyFix from jinja2 import FileSystemLoader from jinja2.sandbox import SandboxedEnvironment from six.moves import input from CTFd import utils from CTFd.utils.mi...
CTFd/__init__.py <|code_start|>import sys import os from distutils.version import StrictVersion from flask import Flask from werkzeug.contrib.fixers import ProxyFix from jinja2 import FileSystemLoader from jinja2.sandbox import SandboxedEnvironment from six.moves import input from CTFd import utils from CTFd.utils.mi...
Hide flag-submit-box for anonymous users **Environment**: - CTFd Version/Commit: 2.0.1 from master - Operating System: Debian Stretch, Ubuntu 18.04, ... - Web Browser and Version: Firefox 63 **What happened?** * In admin, set visibility of challenges to public * Logout * Open challenge view (`/challe...
CTFd/api/v1/challenges.py <|code_start|>from flask import session, request, abort from flask_restplus import Namespace, Resource from CTFd.models import ( db, Challenges, Unlocks, HintUnlocks, Tags, Hints, Flags, Solves, Submissions, Fails, ChallengeFiles as ChallengeFilesMod...
CTFd/api/v1/challenges.py <|code_start|>from flask import session, request, abort from flask_restplus import Namespace, Resource from CTFd.models import ( db, Challenges, Unlocks, HintUnlocks, Tags, Hints, Flags, Solves, Submissions, Fails, ChallengeFiles as ChallengeFilesMod...
Create admin panel only scripts + stylesheet plugin interfaces ``` def register_script(url): SCRIPTS.append(url) def register_stylesheet(url): STYLESHEETS.append(url) def get_registered_scripts(): return SCRIPTS def get_registered_stylesheets(): return STYLESHEETS ``` The above c...
CTFd/plugins/__init__.py <|code_start|>import glob import importlib import os from collections import namedtuple from flask.helpers import safe_join from flask import current_app as app, send_file, send_from_directory, abort from CTFd.utils.decorators import admins_only as admins_only_wrapper from CTFd.utils.plugins i...
CTFd/plugins/__init__.py <|code_start|>import glob import importlib import os from collections import namedtuple from flask import current_app as app, send_file, send_from_directory, abort from CTFd.utils.decorators import admins_only as admins_only_wrapper from CTFd.utils.plugins import ( override_template as uti...
Can we condense the url_for calls for themes further? url_for for themes files currently doesn't know what theme is being used and so we pass it in. We should probably default it inside the view. But we would need to default the parameters to None and then set it in the function itself.
CTFd/utils/initialization/__init__.py <|code_start|>from flask import Flask, current_app as app, request, session, redirect, url_for, abort, render_template from werkzeug.wsgi import DispatcherMiddleware from CTFd.models import db, Tracking from CTFd.utils import markdown, get_config from CTFd.utils.dates import unix_...
CTFd/utils/initialization/__init__.py <|code_start|>from flask import Flask, current_app as app, request, session, redirect, url_for, abort, render_template from werkzeug.wsgi import DispatcherMiddleware from CTFd.models import db, Tracking from CTFd.utils import markdown, get_config from CTFd.utils.dates import unix_...
init_logs not called, no handlers installed **Environment**: - CTFd Version/Commit: 6e8c7aaa50857fde0be87f694c134ce714e11221 - Operating System: Linux (deployed via Docker) - Web Browser and Version: Firefox **What happened?** Since the 2.0 commit, it appears that `CTFd.utils.logging.init_logs` isn't cal...
CTFd/__init__.py <|code_start|>import sys import os from distutils.version import StrictVersion from flask import Flask, Request from werkzeug.utils import cached_property from werkzeug.contrib.fixers import ProxyFix from jinja2 import FileSystemLoader from jinja2.sandbox import SandboxedEnvironment from six.moves imp...
CTFd/__init__.py <|code_start|>import sys import os from distutils.version import StrictVersion from flask import Flask, Request from werkzeug.utils import cached_property from werkzeug.contrib.fixers import ProxyFix from jinja2 import FileSystemLoader from jinja2.sandbox import SandboxedEnvironment from six.moves imp...
get_config return default get_config(key) should probably be get_config(key, default=None). This helps in some ideas where you want to do different behavior if get_config returns None.
CTFd/__init__.py <|code_start|>import sys import os from distutils.version import StrictVersion from flask import Flask, Request from werkzeug.utils import cached_property from werkzeug.contrib.fixers import ProxyFix from jinja2 import FileSystemLoader from jinja2.sandbox import SandboxedEnvironment from six.moves imp...
CTFd/__init__.py <|code_start|>import sys import os from distutils.version import StrictVersion from flask import Flask, Request from werkzeug.utils import cached_property from werkzeug.contrib.fixers import ProxyFix from jinja2 import FileSystemLoader from jinja2.sandbox import SandboxedEnvironment from six.moves imp...
Imports may need to go through the application factory process again If the CTF has plugins that create tables, those tables may not be re-created when importing/resetting. This might be leading to issues where tables don't exist in the database but are referred to by plugins. Imports may need to go through the applic...
CTFd/utils/exports/__init__.py <|code_start|>from CTFd.utils import get_app_config from CTFd.utils.migrations import get_current_revision, create_database, drop_database, upgrade, stamp from CTFd.utils.uploads import get_uploader from CTFd.models import db from CTFd.cache import cache from datafreeze.format import SERI...
CTFd/utils/exports/__init__.py <|code_start|>from CTFd.utils import get_app_config from CTFd.utils.migrations import get_current_revision, create_database, drop_database, upgrade, stamp from CTFd.utils.uploads import get_uploader from CTFd.models import db from CTFd.cache import cache from datafreeze.format import SERI...
Cannot unset country field **Environment**: - CTFd Version/Commit: tag 2.0.4 - Operating System: Ubuntu 16.04 - Web Browser and Version: Chrome latest **What happened?** I changed my country to "Blank" (`<option></option>`) in settings, hit update, it said success, but refresh showed old country. **Wh...
CTFd/schemas/users.py <|code_start|>from flask import session from sqlalchemy.sql.expression import union_all from marshmallow import fields, post_load from marshmallow import validate, ValidationError, pre_load from marshmallow.decorators import validates_schema from marshmallow_sqlalchemy import field_for from CTFd.m...
CTFd/schemas/users.py <|code_start|>from flask import session from sqlalchemy.sql.expression import union_all from marshmallow import fields, post_load from marshmallow import validate, ValidationError, pre_load from marshmallow.decorators import validates_schema from marshmallow_sqlalchemy import field_for from CTFd.m...
Send email from user management screen <!-- If this is a bug report please fill out the template below. If this is a feature request please describe the behavior that you'd like to see. --> **Environment**: - CTFd Version/Commit: 2.0.4 - Operating System: Ubuntu - Web Browser and Version: Same in any...
CTFd/api/v1/users.py <|code_start|>from flask import session, request, abort from flask_restplus import Namespace, Resource from CTFd.models import db, Users, Solves, Awards, Fails, Tracking, Unlocks, Submissions, Notifications from CTFd.utils.decorators import ( authed_only, admins_only, authed ) from CTFd...
CTFd/api/v1/users.py <|code_start|>from flask import session, request, abort from flask_restplus import Namespace, Resource from CTFd.models import db, Users, Solves, Awards, Fails, Tracking, Unlocks, Submissions, Notifications from CTFd.utils.decorators import ( authed_only, admins_only, authed, rateli...
CTFd permission error by using custom Vagrant **Environment**: - CTFd Version/Commit:master - Operating System: VERSION="16.04.6 LTS (Xenial Xerus)" (vagrant machine) **What happened?** Permission denied **How to reproduce your issue** Create the following Vagrantfile ```ruby # Defines our Vagrant ...
CTFd/utils/initialization/__init__.py <|code_start|>from flask import request, session, redirect, url_for, abort, render_template from werkzeug.wsgi import DispatcherMiddleware from CTFd.models import db, Tracking from CTFd.utils import markdown, get_config from CTFd.utils.dates import unix_time_millis, unix_time, iso...
CTFd/utils/initialization/__init__.py <|code_start|>from flask import request, session, redirect, url_for, abort, render_template from werkzeug.wsgi import DispatcherMiddleware from CTFd.models import db, Tracking from CTFd.utils import markdown, get_config from CTFd.utils.dates import unix_time_millis, unix_time, iso...
Flag submission is not correctly rate-limited when using team mode <!-- If this is a bug report please fill out the template below. If this is a feature request please describe the behavior that you'd like to see. --> **Environment**: - CTFd Version/Commit: 2.1.0 - Operating System: GCP Container-Optimi...
CTFd/api/v1/challenges.py <|code_start|>from flask import session, request, abort, url_for from flask_restplus import Namespace, Resource from CTFd.models import ( db, Challenges, HintUnlocks, Tags, Hints, Flags, Solves, Fails, ChallengeFiles as ChallengeFilesModel, ) from CTFd.plugi...
CTFd/api/v1/challenges.py <|code_start|>from flask import request, abort, url_for from flask_restplus import Namespace, Resource from CTFd.models import ( db, Challenges, HintUnlocks, Tags, Hints, Flags, Solves, Fails, ChallengeFiles as ChallengeFilesModel, ) from CTFd.plugins.challe...
Research cascading deletes in SQLAlchemy SQLAlchemy should be able to detect when foreign keys are deleted and then delete related objects along with it. This is the source of a number of issues. This will need research and some migrations likely: https://docs.sqlalchemy.org/en/latest/orm/cascades.html
CTFd/models/__init__.py <|code_start|>from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow from sqlalchemy.sql.expression import union_all from sqlalchemy.orm import validates, column_property from sqlalchemy.ext.hybrid import hybrid_property from CTFd.utils.crypto import hash_password from...
CTFd/models/__init__.py <|code_start|>from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow from sqlalchemy.sql.expression import union_all from sqlalchemy.orm import validates, column_property from sqlalchemy.ext.hybrid import hybrid_property from CTFd.utils.crypto import hash_password from...
Sphinx Documentation CTFds documentation is lacking and we need a system for it.
docs/conf.py <|code_start|># -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ---------------------------------...
docs/conf.py <|code_start|># -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ---------------------------------...
Exporting always downloads the same zip **Environment**: - CTFd Version/Commit: 2.1.2 - Operating System: Standard docker-compose launch on Linux - Web Browser and Version: Firefox 67.0.3 **What happened?** When exporting the challenges from `/admin/config#backup`, the same zip downloads as the first e...
CTFd/admin/__init__.py <|code_start|>from flask import ( current_app as app, render_template, request, redirect, url_for, Blueprint, abort, render_template_string, send_file, ) from CTFd.utils.decorators import admins_only from CTFd.utils.user import is_admin from CTFd.utils.securit...
CTFd/admin/__init__.py <|code_start|>from flask import ( current_app as app, render_template, request, redirect, url_for, Blueprint, abort, render_template_string, send_file, ) from CTFd.utils.decorators import admins_only from CTFd.utils.user import is_admin from CTFd.utils.securit...
get_place should return None instead of 0 The place, get_place attributes/functions should return None instead of 0 if a user/team has no place.
CTFd/models/__init__.py <|code_start|>from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow from sqlalchemy.orm import validates, column_property from sqlalchemy.ext.hybrid import hybrid_property from CTFd.utils.crypto import hash_password from CTFd.cache import cache import datetime import ...
CTFd/models/__init__.py <|code_start|>from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow from sqlalchemy.orm import validates, column_property from sqlalchemy.ext.hybrid import hybrid_property from CTFd.utils.crypto import hash_password from CTFd.cache import cache import datetime import ...
import will crash ctfd <!-- If this is a bug report please fill out the template below. If this is a feature request please describe the behavior that you'd like to see. --> **Environment**: - CTFd Version/Commit: 2.1.3 - Operating System: ubuntu 18.04 - Web Browser and Version: Opera 60.0.3255.170 ...
migrations/versions/b5551cd26764_add_captain_column_to_teams.py <|code_start|>"""Add captain column to Teams Revision ID: b5551cd26764 Revises: 4e4d5a9ea000 Create Date: 2019-04-12 00:29:08.021141 """ from CTFd.models import db from alembic import op import sqlalchemy as sa from sqlalchemy.sql import text, table, col...
migrations/versions/b5551cd26764_add_captain_column_to_teams.py <|code_start|>"""Add captain column to Teams Revision ID: b5551cd26764 Revises: 4e4d5a9ea000 Create Date: 2019-04-12 00:29:08.021141 """ from CTFd.models import db from alembic import op import sqlalchemy as sa from sqlalchemy.sql import text, table, col...
Feature Request : Search users by IP address It's really hard to search an IP address on the UI now. It'd be nice to have a search feature in `admin/users` search a user by an IP address. CTFd already logs IP addresses of each login so it'll be very useful when wanting to ban certain users for abusing rules.
CTFd/admin/teams.py <|code_start|>from flask import render_template, request from CTFd.utils.decorators import admins_only from CTFd.models import db, Teams, Challenges, Tracking from CTFd.admin import admin from CTFd.utils.helpers import get_errors from sqlalchemy.sql import not_ @admin.route("/admin/teams") @admin...
CTFd/admin/teams.py <|code_start|>from flask import render_template, request from CTFd.utils.decorators import admins_only from CTFd.models import db, Teams, Challenges, Tracking from CTFd.admin import admin from CTFd.utils.helpers import get_errors from sqlalchemy.sql import not_ @admin.route("/admin/teams") @admin...
Info leak of number of solves after freeze **Environment**: - CTFd Version/Commit: 2.1.3 / 75a9a5a6972b7f053a018a0845e0755894729801 - Operating System: Amazon Linux 2 / CTFd running in docker container - Web Browser and Version: Firefox 68 **What happened?** For challenges solved *after* freeze time, u...
CTFd/api/v1/challenges.py <|code_start|>from flask import request, abort, url_for from flask_restplus import Namespace, Resource from CTFd.models import ( db, Challenges, HintUnlocks, Tags, Hints, Flags, Solves, Fails, ChallengeFiles as ChallengeFilesModel, ) from CTFd.plugins.challe...
CTFd/api/v1/challenges.py <|code_start|>from flask import request, abort, url_for from flask_restplus import Namespace, Resource from CTFd.models import ( db, Challenges, HintUnlocks, Tags, Hints, Flags, Solves, Fails, ChallengeFiles as ChallengeFilesModel, ) from CTFd.plugins.challe...
CTFd crash right after install ## Git + python 3.7.2 (3b1b82b9a0fbcb8731d7a3a3bbac99499c466c99) [![asciicast](https://asciinema.org/a/iHDMVNRWSYJDTZUgIy4wIBsOK.svg)](https://asciinema.org/a/iHDMVNRWSYJDTZUgIy4wIBsOK) ## Git + python 2.7.15 (3b1b82b9a0fbcb8731d7a3a3bbac99499c466c99) [![asciicast](https://asciin...
wsgi.py <|code_start|>from gevent import monkey monkey.patch_all() from CTFd import create_app app = create_app() if __name__ == '__main__': app.run(debug=True, threaded=True, host="127.0.0.1", port=4000) <|code_end|>
wsgi.py <|code_start|>import os # Detect if we're running via `flask run` and don't monkey patch if not os.getenv("FLASK_RUN_FROM_CLI"): from gevent import monkey monkey.patch_all() from CTFd import create_app app = create_app() if __name__ == "__main__": app.run(debug=True, threaded=True, host="127.0....
Theme reset from CLI There needs to be a way to reset the theme and other kinds of unrecoverable errors from the CLI. Context: https://community.majorleaguecyber.org/t/ctfd-templatenotfound/51
manage.py <|code_start|>from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from CTFd import create_app from CTFd.models import * app = create_app() manager = Manager(app) manager.add_command('db', MigrateCommand) if __nam...
manage.py <|code_start|>from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from CTFd import create_app from CTFd.utils import get_config as get_config_util, set_config as set_config_util from CTFd.models import * app = crea...
Fails to start when reverse proxy is configured with boolean <!-- If this is a bug report please fill out the template below. If this is a feature request please describe the behavior that you'd like to see. --> **Environment**: - CTFd Version/Commit: 22c1323 - Operating System: Ubuntu 18.04 - Web Br...
CTFd/__init__.py <|code_start|>import datetime import os import sys from distutils.version import StrictVersion from flask import Flask, Request from flask_migrate import upgrade from jinja2 import FileSystemLoader from jinja2.sandbox import SandboxedEnvironment from six.moves import input from werkzeug.middleware.pro...
CTFd/__init__.py <|code_start|>import datetime import os import sys from distutils.version import StrictVersion from flask import Flask, Request from flask_migrate import upgrade from jinja2 import FileSystemLoader from jinja2.sandbox import SandboxedEnvironment from six.moves import input from werkzeug.middleware.pro...
Unable to import backups with ISO 8601 date+time based flags **Environment**: - CTFd Version/Commit: Latest (As of 18/02/2020) - Operating System: Docker (Underlying OS tested on Mac and Google Cloud Run) - Web Browser and Version: Chrome for Mac Version 79.0.3945.130 (Official Build) (64-bit) **What happ...
CTFd/utils/exports/__init__.py <|code_start|>import datetime import json import os import re import tempfile import zipfile import datafreeze import dataset import six from alembic.util import CommandError from datafreeze.format import SERIALIZERS from datafreeze.format.fjson import JSONEncoder, JSONSerializer from fl...
CTFd/utils/exports/__init__.py <|code_start|>import datetime import json import os import re import tempfile import zipfile import datafreeze import dataset import six from alembic.util import CommandError from datafreeze.format import SERIALIZERS from datafreeze.format.fjson import JSONEncoder, JSONSerializer from fl...
Re-enable jinja cache ``` @app.before_request def disable_jinja_cache(): app.jinja_env.cache = {} ``` Explore how we can re-enable the Jinja cache by perhaps storing it on Redis. This may require very custom code.
CTFd/__init__.py <|code_start|>import datetime import os import sys from distutils.version import StrictVersion from flask import Flask, Request from flask_migrate import upgrade from jinja2 import FileSystemLoader from jinja2.sandbox import SandboxedEnvironment from six.moves import input from werkzeug.middleware.pro...
CTFd/__init__.py <|code_start|>import datetime import os import sys import weakref from distutils.version import StrictVersion from flask import Flask, Request from flask_migrate import upgrade from jinja2 import FileSystemLoader from jinja2.sandbox import SandboxedEnvironment from six.moves import input from werkzeug...
log rotation does not works In the file https://github.com/CTFd/CTFd/blob/master/CTFd/utils/initialization/__init__.py#L107 the log handlers `logging.handlers.RotatingFileHandler` are not created with the right parameters (see [RotatingFileHandler](https://docs.python.org/3/library/logging.handlers.html#logging.handle...
CTFd/utils/initialization/__init__.py <|code_start|>import datetime import logging import os import sys from flask import abort, redirect, render_template, request, session, url_for from sqlalchemy.exc import IntegrityError, InvalidRequestError from werkzeug.wsgi import DispatcherMiddleware from CTFd.exceptions impor...
CTFd/utils/initialization/__init__.py <|code_start|>import datetime import logging import os import sys from flask import abort, redirect, render_template, request, session, url_for from sqlalchemy.exc import IntegrityError, InvalidRequestError from werkzeug.wsgi import DispatcherMiddleware from CTFd.exceptions impor...
unlocks api does not check already unlocked hints There is not check in the unlocks api for already unlocked hints in the file [unlocks.py](https://github.com/CTFd/CTFd/blob/master/CTFd/api/v1/unlocks.py) It is possible to unlock multiple times the same hint by just calling the api.
CTFd/api/v1/unlocks.py <|code_start|>from flask import request from flask_restplus import Namespace, Resource from CTFd.cache import clear_standings from CTFd.models import Unlocks, db, get_class_by_tablename from CTFd.schemas.awards import AwardSchema from CTFd.schemas.unlocks import UnlockSchema from CTFd.utils.deco...
CTFd/api/v1/unlocks.py <|code_start|>from flask import request from flask_restplus import Namespace, Resource from CTFd.cache import clear_standings from CTFd.models import Unlocks, db, get_class_by_tablename from CTFd.schemas.awards import AwardSchema from CTFd.schemas.unlocks import UnlockSchema from CTFd.utils.deco...
Bell Curve Graph / Normal Distribution There's some idea in statistics about bell curves and a normal distribution. We should take this idea and apply it to CTF scores. For a given CTF we should take the total score, break this up into brackets and then see how many people are in each score bracket. Then overlay th...
CTFd/admin/statistics.py <|code_start|>from flask import render_template from CTFd.admin import admin from CTFd.models import Challenges, Fails, Solves, Teams, Tracking, Users, db from CTFd.utils.decorators import admins_only from CTFd.utils.modes import get_model from CTFd.utils.updates import update_check @admin.r...
CTFd/admin/statistics.py <|code_start|>from flask import render_template from CTFd.admin import admin from CTFd.models import Challenges, Fails, Solves, Teams, Tracking, Users, db from CTFd.utils.decorators import admins_only from CTFd.utils.modes import get_model from CTFd.utils.updates import update_check @admin.r...
Email cannot be sent if CTF name has an accent <!-- If this is a bug report please fill out the template below. If this is a feature request please describe the behavior that you'd like to see. --> **Environment**: - CTFd Version/Commit: 2.3.2 - Operating System: Debian 10.3, Python 3.7.3 - Web Brows...
CTFd/utils/config/__init__.py <|code_start|>import os import time from flask import current_app as app from CTFd.utils import get_config from CTFd.utils.modes import TEAMS_MODE, USERS_MODE def ctf_name(): name = get_config("ctf_name") return name if name else "CTFd" def user_mode(): return get_config(...
CTFd/utils/config/__init__.py <|code_start|>import os import time from flask import current_app as app from CTFd.utils import get_config from CTFd.utils.modes import TEAMS_MODE, USERS_MODE def ctf_name(): name = get_config("ctf_name") return name if name else "CTFd" def user_mode(): return get_config(...