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

35 lines
643 B
Python
Raw Permalink Normal View History

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