Advertisement
teslariu

SQLinjection

Jul 7th, 2022
917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # SQL Injection:
  5. # >>> Ingrese el nombre: Ale',25);DELETE FROM personas;--
  6. # >>> Ingrese la edad: 25
  7.  
  8. import sqlite3
  9.  
  10. conn = sqlite3.connect("database.sqlite")
  11.  
  12. cursor = conn.cursor()
  13.  
  14.  
  15. nombre = input("Ingrese el nombre: ")
  16. edad = int(input("Ingrese la edad: "))
  17.  
  18. cursor.executescript(f"INSERT INTO personas VALUES ('{nombre}',{edad})")
  19. conn.commit()
  20.  
  21. conn.close()
  22.  
  23. # analisis de la SQL Injection
  24. # INSERT INTO personas VALUES ('Ale',25);
  25. # DELETE FROM personas;
  26. # --',25)"
  27.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement