Created
June 23, 2017 12:58
-
-
Save jnovikov/4eb4899e6edf63482fb89fbfd16da23c to your computer and use it in GitHub Desktop.
DB for MSHP LETO CTF READY
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
conn = sqlite3.connect('example.db') | |
db = conn.cursor() | |
# query = "CREATE TABLE IF NOT EXISTS users (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, login TEXT,password TEXT)" | |
# db.execute(query) | |
# fake_users = ['krosh','ejik','sovunya','kopatych','barash','pin','losyash','karkarych','nyusha'] | |
# for user in fake_users: | |
# query = "INSERT INTO users (login,password) VALUES ('{}','{}')".format(user,user+'password') | |
# db.execute(query) | |
# query = "INSERT INTO users (login,password) VALUES (\"durov\",'7777777')" | |
# query = "SELECT * FROM users WHERE login = 'durov'" | |
# 'SELECT id FROM <table> //УСЛОВИЕ!!!!!' | |
# db.execute(query) | |
# results = db.fetchall() | |
# for x in results: | |
# print(x) | |
login = input('Login: ') | |
password = input('Password: ') | |
query = "SELECT * FROM users WHERE login='{}' AND password='{}'".format(login,password) | |
db.execute(query) | |
results = db.fetchone() | |
if results: | |
print("Hello,",results[1]) | |
else: | |
print("Sorry. Bad password") | |
conn.commit() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment