Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- import sqlite3
- conn = sqlite3.connect("personas.sqlite")
- cursor = conn.cursor()
- cursor.execute("CREATE TABLE personas(nombre TEXT,edad NUMERIC)")
- conn.commit()
- nombre = input("Ingrese su nombre: ")
- edad = int(input("Ingrese su edad: "))
- # consulta vulnerable a SQL injection
- cursor.executescript(f"INSERT INTO personas VALUES ('{nombre}', {edad})")
- conn.commit()
- print("Datos ingresados correctamente")
- """
- Si ingreso:
- >> nombre: Carlos', 30); DELETE FROM personas;--
- >> edad: 30
- cursor.execute(f"INSERT INTO personas VALUES ('Carlos', 30); DELETE FROM personas;-- , 30)")
- """
Advertisement
Add Comment
Please, Sign In to add comment