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

34 lines
609 B
Python

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