Skip to content

Instantly share code, notes, and snippets.

@yeukhon
Created December 5, 2013 20:00
Show Gist options
  • Save yeukhon/7812840 to your computer and use it in GitHub Desktop.
Save yeukhon/7812840 to your computer and use it in GitHub Desktop.
sql-injection
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