-
-
Save icheernoom/b0fbe863b2dfb35a5fcde6f61f8e2042 to your computer and use it in GitHub Desktop.
sql-injection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bottle import route, run, request | |
import MySQLdb | |
# connect | |
db = MySQLdb.connect(host="localhost", user="root", passwd="password", db="testing") | |
cursor = db.cursor() | |
@route('/users') | |
def hello(): | |
id = request.query.get("id") | |
cursor.execute("SELECT * FROM users WHERE id=" + str(id)) | |
return str(cursor.fetchall()) | |
run(host='0.0.0.0', port=8080, debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment