Skip to content

Instantly share code, notes, and snippets.

@icheernoom
Forked from yeukhon/server.py
Created August 5, 2016 08:49
Show Gist options
  • Save icheernoom/b0fbe863b2dfb35a5fcde6f61f8e2042 to your computer and use it in GitHub Desktop.
Save icheernoom/b0fbe863b2dfb35a5fcde6f61f8e2042 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