def__eq__(self, other): returntype(other) is Animal and self.name == other.name and self.category == other.category
defread(filename, encoding='utf-8'): withopen(filename, 'r', encoding=encoding) as fin: return fin.read()
@app.route('/', methods=['GET', 'POST']) defindex(): if request.args.get('source'): return Response(read(__file__), mimetype='text/plain')
if request.method == 'POST': try: pickle_data = request.form.get('data') ifb'R'in base64.b64decode(pickle_data): return'No... I don\'t like R-things. No Rabits, Rats, Roosters or RCEs.' else: result = pickle.loads(base64.b64decode(pickle_data)) iftype(result) isnot Animal: return'Are you sure that is an animal???' correct = (result == Animal(favorite.name, favorite.category)) return render_template('unpickle_result.html', result=result, pickle_data=pickle_data, giveflag=correct) except Exception as e: return'something wrong...'
defread(filename, encoding='utf-8'): withopen(filename, 'r', encoding=encoding) as fin: return fin.read()
@app.route('/', methods=['GET', 'POST']) defindex(): if request.args.get('source'): return Response(read(__file__), mimetype='text/plain')
if request.method == 'POST': try: pickle_data = request.form.get('data') ifb'R'in base64.b64decode(pickle_data): return'No... I don\'t like R-things. No Rabits, Rats, Roosters or RCEs.' else: result = restricted_loads(base64.b64decode(pickle_data)) iftype(result) isnot Animal: return'Are you sure that is an animal???' correct = (result == Animal(favorite.name, favorite.category)) return render_template('unpickle_result.html', result=result, pickle_data=pickle_data, giveflag=correct) except Exception as e: print(repr(e)) return"Something wrong"