Tags: python sqlite3 

Rating:

file BB-inDu57rY-P0W3R-L34k3r2.db returns the following: BB-inDu57rY-P0W3R-L34k3r2.db: SQLite 3.x database, last written using SQLite version 3033000

so we know we're dealing with an sqlite3 database.

sqlite3 BB-inDu57rY-P0W3R-L34k3r2.db
.tables # show tables, only one table found: personal
.schema personal # shows table column names and data type
select password from personal;
sqlite3 BB-inDu57rY-P0W3R-L34k3r2.db "select password from personal;" > passwords.txt

Then I simply wrote a python script.

passwords = open("passwords.txt").read().splitlines()

flag = ""
flag += str(len(passwords))
unique = []
bcrypt = 0
for p in passwords:
    if p.startswith("$2b$"):
        bcrypt += 1
    if p not in unique:
        unique.append(p)
    else:
        flag+="_"+p

flag+="_"+str(bcrypt)

print(flag)

flag: 376_mah6geiVoo_21