Created
August 28, 2017 04:08
-
-
Save os555/d8b77013dd6c6f5e9c0d1899f1dce7da to your computer and use it in GitHub Desktop.
sql-injection for POC on Python
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