Advertisement
teslariu

inyeccion

Oct 27th, 2021
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Script que simula inyección de código
  5.  
  6. import sqlite3
  7.  
  8. conn = sqlite3.connect("base.sqlite")
  9. cursor = conn.cursor()
  10.  
  11. nombre = input("Ingrese su nombre: ")
  12. edad = int(input("Ingrese su edad: "))
  13.  
  14. cursor.executescript(f"INSERT INTO personas VALUES ('{nombre}',{edad})")
  15. conn.commit()
  16. print("Datos ingresados correctamente...")
  17. conn.close()
  18.  
  19. """
  20. >>> Ingrese su nombre:  Alejandro', 17); DELETE FROM personas;--
  21. >>> Ingrese su edad: 14
  22.  
  23. "INSERT INTO personas VALUES ('Alejandro', 17); DELETE FROM personas;--',14)"
  24.  
  25. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement