Esempio n. 1
0
 def get(self):
     try:
         Games.load_from_json('save.json')
         self.messages.success("已读取记录中的进度")
     except:
         self.messages.error("没有找到备份文件")
     self.redirect(url_for('admin'))
Esempio n. 2
0
File: game.py Progetto: 5up3rc/myctf
 def get(self):
     self.render(
         nav='game',
         lst=Games.get_lst(),
         score=Games.get_score(self.current_user()),
         solved=Games.get_user_solved(self.current_user()),
         score_board=Games.get_score_board(),
     )
Esempio n. 3
0
    def post(self):
        ret = self.value_valid(None)

        if self.messages.has_error():
            self.render('admin/question_edit.html', question=JsDict(ret), title=u'添加题目', is_new_question=True)
        else:
            Games.game_add(ret)
            self.messages.success(u'添加题目成功')
            self.redirect(url_for('admin_questions'))
Esempio n. 4
0
 def get(self):
     depend_check = lambda x: Games.depend_check(self.current_user(), int(x))
     self.render(
         nav='game',
         lst=Games.get_brief_lst(),
         score=Games.get_score(self.current_user()),
         solved=Games.get_user_solved(self.current_user()),
         score_board=Games.get_score_board(),
         depend_check=depend_check,
     )
Esempio n. 5
0
    def post(self, qid):
        ret = self.value_valid(qid)

        if self.messages.has_error():
            q = Games.data.get(int(qid))
            self.render('admin/question_edit.html', question=JsDict(ret), title=u'编辑:%s' % q['title'])
        else:
            ret['id'] = int(qid)
            Games.game_edit(ret)
            self.messages.success(u'编辑成功')
            self.redirect(url_for('admin_questions'))
Esempio n. 6
0
 def get(self):
     depend_check = lambda x: Games.depend_check(self.current_user(), int(x)
                                                 )
     self.render(
         nav='game',
         lst=Games.get_brief_lst(),
         score=Games.get_score(self.current_user()),
         solved=Games.get_user_solved(self.current_user()),
         score_board=Games.get_score_board(),
         depend_check=depend_check,
     )
Esempio n. 7
0
File: game.py Progetto: 5up3rc/myctf
    def post(self, game_id):
        if not self.current_user():
            self.messages.error('请先登录!')
            return self.redirect(url_for('signin'))

        if Games.is_reach_deadline():
            self.messages.error("答题时间已经结束!")
            return self.redirect(url_for('game'))

        k = self.get_argument('key')
        if Games.solve(self.current_user(), game_id, k):
            self.messages.success("回答正确!")
            self.redirect(url_for('game'))
        else:
            self.messages.error("回答错误或已经回答过!")
            self.render(game=Games.get_without_key(game_id))
Esempio n. 8
0
    def post(self, game_id):
        if not self.current_user():
            self.messages.error('请先登录!')
            return self.redirect(url_for('signin'))

        if Games.is_end:
            self.messages.error("答题时间已经结束!")
            return self.redirect(url_for('game'))

        if not Games.depend_check(self.current_user(), int(game_id)):
            self.messages.error("题目尚未解锁!")
            return self.redirect(url_for('game'))

        k = self.get_argument('key')
        if Games.solve(self.current_user(), int(game_id), k):
            self.messages.success("回答正确!")
            self.redirect(url_for('game'))
        else:
            self.messages.error("回答错误或已经回答过!")
            self.render(game=Games.get_without_key(game_id))
Esempio n. 9
0
    def get(self, game_id):
        if not self.current_user():
            self.messages.error('请先登录!')
            return self.redirect(url_for('signin'))

        g = Games.data[int(game_id)]
        if g and Games.depend_check(self.current_user(), int(game_id)):
            ret = g.copy()
            del ret['key']
            self.render(game=JsDict(ret))
        else:
            self.write_error(404)
Esempio n. 10
0
    def get(self, game_id):
        if not self.current_user():
            self.messages.error('请先登录!')
            return self.redirect(url_for('signin'))

        g = Games.data[int(game_id)]
        if g and Games.depend_check(self.current_user(), int(game_id)):
            ret = g.copy()
            del ret['key']
            self.render(game=JsDict(ret))
        else:
            self.write_error(404)
Esempio n. 11
0
 def get(self):
     self.render('admin/questions.html', lst=Games.get_lst())
Esempio n. 12
0
 def get(self):
     Games.reset()
     self.messages.success('重置完成!')
     self.redirect(url_for('admin'))
Esempio n. 13
0
 def get(self):
     Games.reload_data()
     self.redirect(url_for('admin'))
Esempio n. 14
0
 def get(self):
     Games.save_to_json('save.json')
     self.messages.success("进度已保存")
     self.redirect(url_for('admin'))
Esempio n. 15
0
 def get(self, qid):
     Games.game_rm(int(qid))
     self.messages.success(u'题目%s已经删除!' % qid)
     self.redirect(url_for('admin'))
Esempio n. 16
0
 def get(self):
     Games.save_to_json('save.json')
     self.redirect(url_for('admin'))