def challenges(): if not ctftime(): return redirect('/') if can_view_challenges(): return render_template('chals.html') else: return redirect(url_for('login', next="challenges"))
def challenges(): if not ctftime(): return redirect("/") if can_view_challenges(): return render_template("chals.html") else: return redirect(url_for("login", next="challenges"))
def challenges(): if not is_admin() and not ctftime_view(): return redirect('/') if can_view_challenges(): return render_template('chals.html', ctftime=ctftime_submit()) else: return redirect(url_for('login', next="challenges"))
def chals(): if not ctftime(): return redirect('/') if can_view_challenges(): chals = Challenges.query.add_columns( 'id', 'name', 'value', 'description', 'category').order_by(Challenges.value).all() json = {'game': []} for x in chals: files = [ str(f.location) for f in Files.query.filter_by(chal=x.id).all() ] json['game'].append({ 'id': x[1], 'name': x[2], 'value': x[3], 'description': x[4], 'category': x[5], 'files': files }) db.session.close() return jsonify(json) else: db.session.close() return redirect('/login')
def chals_per_solves(): if can_view_challenges(): solves = Solves.query.join(Teams, Solves.teamid == Teams.id).filter(Teams.banned==None).add_columns(db.func.count(Solves.chalid)).group_by(Solves.chalid).all() json = {} for chal, count in solves: json[chal.chal.name] = count return jsonify(json) return redirect(url_for('auth.login', next='chals/solves'))
def chals_per_solves(): if can_view_challenges(): solves = Solves.query.add_columns(db.func.count(Solves.chalid)).group_by(Solves.chalid).all() json = {} for chal, count in solves: json[chal.chal.name] = count return jsonify(json) return redirect(url_for('login', next="/chals/solves"))
def chals_per_solves(): if can_view_challenges(): solves = Solves.query.add_columns(db.func.count(Solves.chalid)).group_by(Solves.chalid).all() json = {} for chal, count in solves: json[chal.chal.name] = count return jsonify(json) return redirect('/login')
def challenges_view(): if not is_admin(): if not ctftime(): if view_after_ctf(): pass else: return redirect('/') if can_view_challenges(): return render_template('chals.html', ctftime=ctftime()) else: return redirect(url_for('login', next="challenges"))
def chals_per_solves(): if can_view_challenges(): solves_sub = db.session.query(Solves.chalid, db.func.count(Solves.chalid).label('solves')).join(Teams, Solves.teamid == Teams.id).filter(Teams.banned == False).group_by(Solves.chalid).subquery() solves = db.session.query(solves_sub.columns.chalid, solves_sub.columns.solves, Challenges.name) \ .join(Challenges, solves_sub.columns.chalid == Challenges.id).all() json = {} for chal, count, name in solves: json[name] = count db.session.close() return jsonify(json) return redirect(url_for('auth.login', next='chals/solves'))
def challenges_view(): if not is_admin(): if not ctftime(): if view_after_ctf(): pass else: return redirect('/') if can_view_challenges(): return render_template('chals.html', ctftime=ctftime()) else: return redirect(url_for('auth.login', next='challenges'))
def challenges_view(): if not is_admin(): if not ctftime(): if view_after_ctf(): pass else: return redirect(url_for('views.static_html')) if get_config('verify_emails') and not is_verified(): return redirect(url_for('auth.confirm_user')) if can_view_challenges(): return render_template('chals.html', ctftime=ctftime()) else: return redirect(url_for('auth.login', next='challenges'))
def challenges_view(): if not is_admin(): if not ctftime(): if view_after_ctf(): pass else: return redirect('/') if get_config('verify_emails') and not is_verified(): return redirect(url_for('auth.confirm_user')) if can_view_challenges(): return render_template('chals.html', ctftime=ctftime()) else: return redirect(url_for('auth.login', next='challenges'))
def chals_per_solves(): if can_view_challenges(): solves_sub = db.session.query( Solves.chalid, db.func.count(Solves.chalid).label('solves')).join( Teams, Solves.teamid == Teams.id).filter( Teams.banned == False).group_by(Solves.chalid).subquery() solves = db.session.query(solves_sub.columns.chalid, solves_sub.columns.solves, Challenges.name) \ .join(Challenges, solves_sub.columns.chalid == Challenges.id).all() json = {} for chal, count, name in solves: json[name] = count db.session.close() return jsonify(json) return redirect(url_for('auth.login', next='chals/solves', _external=True))
def chals(): if not is_admin() and not ctftime_view(): return redirect('/') if can_view_challenges(): chals = Challenges.query.add_columns('id', 'name', 'value', 'description', 'category').order_by(Challenges.value).all() json = {'game':[]} for x in chals: files = [ str(f.location) for f in Files.query.filter_by(chal=x.id).all() ] json['game'].append({'id':x[1], 'name':x[2], 'value':x[3], 'description':x[4], 'category':x[5], 'files':files}) db.session.close() return jsonify(json) else: db.session.close() return redirect('/login')
def chals(): if not is_admin(): if not ctftime(): if view_after_ctf(): pass else: return redirect(url_for('views.static_html')) if can_view_challenges(): chals = Challenges.query.filter(or_(Challenges.hidden != True, Challenges.hidden == None)).add_columns('id', 'name', 'value', 'description', 'category').order_by(Challenges.value).all() json = {'game':[]} for x in chals: tags = [tag.tag for tag in Tags.query.add_columns('tag').filter_by(chal=x[1]).all()] files = [ str(f.location) for f in Files.query.filter_by(chal=x.id).all() ] json['game'].append({'id':x[1], 'name':x[2], 'value':x[3], 'description':x[4], 'category':x[5], 'files':files, 'tags':tags}) db.session.close() return jsonify(json) else: db.session.close() return redirect(url_for('auth.login', next='chals'))
def chals(): if not is_admin(): if not ctftime(): if view_after_ctf(): pass else: return redirect('/') if can_view_challenges(): chals = Challenges.query.filter(or_(Challenges.hidden != True, Challenges.hidden == None)).add_columns('id', 'name', 'value', 'description', 'category').order_by(Challenges.value).all() json = {'game':[]} for x in chals: tags = [tag.tag for tag in Tags.query.add_columns('tag').filter_by(chal=x[1]).all()] files = [ str(f.location) for f in Files.query.filter_by(chal=x.id).all() ] json['game'].append({'id':x[1], 'name':x[2], 'value':x[3], 'description':x[4], 'category':x[5], 'files':files, 'tags':tags}) db.session.close() return jsonify(json) else: db.session.close() return redirect(url_for('auth.login', next='chals'))
def chals(): if not ctftime(): return redirect("/") if can_view_challenges(): chals = ( Challenges.query.add_columns("id", "name", "value", "description", "category") .order_by(Challenges.value) .all() ) json = {"game": []} for x in chals: files = [str(f.location) for f in Files.query.filter_by(chal=x.id).all()] json["game"].append( {"id": x[1], "name": x[2], "value": x[3], "description": x[4], "category": x[5], "files": files} ) db.session.close() return jsonify(json) else: db.session.close() return redirect("/login")