presentations/introduction-to-sql-injection/example/create_db.py

35 lines
643 B
Python

import sqlite3
con = sqlite3.connect("users.db")
cur = con.cursor()
cur.execute("DROP TABLE IF EXISTS users")
cur.execute(
"""
CREATE TABLE users(
user_id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT, password TEXT, notes TEXT
)
"""
)
res = cur.execute(
"""
INSERT INTO users (username, password, notes)
VALUES (
'admin',
's3cur3P455w0rd',
'sqli{66d7724d872da91af56907aea0f6bfb8}'
),
(
'catweasle',
'catweasle_h3xh3x',
'sqli{f91f3b7d41a6a40070ce7112bebfaaab}'
)
"""
)
con.commit()