XSS Catcher
When do we need it
Database handling example
import sqlite3
import os
# filename to store databse in
dbfile = "sqlite.db"
# drops the database if it is not blank
if os.path.exists(dbfile):
os.remove(dbfile)
# create the database
conn = sqlite3.connect(dbfile) # connection to database (file)
cursor = conn.cursor() # lets you execute the queries
# create table in the database
query = "CREATE TABLE IF NOT EXISTS data (id INTEGER PRIMARY KEY AUTOINCREMENT, token TEXT)"
cursor.execute(query)
conn.commit()
# insert data
text = "123"
query = "INSERT INTO data (token) values (\"{}\")".format(text)
cursor.execute(query)
conn.commit()
# get data
query = "SELECT * FROM data"
rows = cursor.execute(query)
data = rows.fetchall()
print(data)
Quick API Example
Last updated