# -*- coding: utf-8 -*-
import sys, os
from tabulate import tabulate
from random import SystemRandom
from base64 import b64encode as encode
from base64 import b64decode as decode
def deca():
global fathers
global pfathers
global user
global passwd
global name
fathers = []
pfathers = []
user = []
passwd = []
name = []
def clearf():
for father in fathers:
fathers.remove(father)
for pfather in pfathers:
pfathers.remove(pfather)
for usr in user:
user.remove(usr)
for passw in passwd:
passwd.remove(passw)
for na in name:
name.remove(na)
class more:
INFO = "[#] "
CORRECT = "[*] "
ERROR = "[!ERROR] "
SPOTIFY = ('''
_____ __ _ ____
/ ___/____ ____ / /_(_) __/_ __
\__ \/ __ \/ __ \/ __/ / /_/ / / /
___/ / /_/ / /_/ / /_/ / __/ /_/ /
/____/ .___/\____/\__/_/_/ \__, /
/_/ /____/
''')
def clear():
syst = sys.platform
if str(syst) == 'win32':
os.system('cls')
else:
os.system('clear')
def deconfuse(data):
data = str(data).replace('β', '=').replace('≡', '?').replace('∑', "W").replace("∂", "c").replace("◊", "H").replace("€", "T").replace("•", "5")
return data
def confuse(data):
data = str(data).replace('=', 'β').replace('?', '≡').replace('W', "∑").replace("c", "∂").replace("H", "◊").replace("T", "€").replace("5", "•")
return data
def decryptdb(db):
reader = open(db, "r")
data = reader.read()
if str(data).find("DaRpa") == -1:
print more.ERROR + "The db is not encrypted"
main()
data = str(data).replace("DaRpa", "").rstrip(" ")
data = deconfuse(data)
data = decode(data)
reader.close()
writer = open(db, "w")
writer.write(data)
writer.close()
def encryptdb(db):
reader = open(db, "r")
data = encode(reader.read())
data = "DaRpa" + confuse(data)
reader.close()
writer = open(db, "w")
writer.write(data)
writer.close()
def edit_account(db, email, password, nombre, nemail, npassword, nnombre, father, pfather, nfather, npfather):
reader = open(db, "r")
data = reader.read()
data = str(data).replace(email+":"+password+":"+nombre+":"+father+":"+pfather, nemail+":"+npassword+":"+nnombre+":"+nfather+":"+npfather)
reader.close()
writer = open(db, "w")
writer.write(data)
writer.close()
def delete_account(db, email, password, nombre, father, pfather):
reader = open(db, "r")
data = reader.read()
data = str(data).replace("{0}:{1}:{2}:{3}:{4}", "").rstrip("\n").format(email,password, nombre, father, pfather)
reader.close()
writer = open(db, "w")
writer.write(data)
writer.close()
def add_account(db, email, password, nombre, father, pfather):
reader = open(db, "r")
data = reader.read()
data = str(data)+"\n{0}:{1}:{2}:{3}:{4}\n".rstrip("\n").format(email, password, nombre, father, pfather)
reader.close()
writer = open(db, "w")
writer.write(data)
writer.close()
def random(long, opt):
if opt == "Mm1":
abc = "a0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
elif opt == "Mm":
abc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
elif opt == "m":
abc = "abcdefghijklmnopqrstuvwxyz"
gen = SystemRandom()
rand = ""
while long > 0:
rand = rand + gen.choice(abc)
long -= 1
return rand
def generate():
print more.INFO + "Generating an account..."
mail = random(7, "m")
password = random(5, "Mm1")
print "YopMail: "+mail+"@yopmail.com"
print "PassWord: "+password
print "Name: Not Set"
print "Father: Not Set"
print "PassWord: Not Set"
print ""
raw_input("Press enter to continue")
add_account("spotify.db", mail+"@yopmail.com", password, "unset", "unset", "unset")
print more.CORRECT + "Account Created"
main()
def opendb(db):
clearf()
file = open(db, "r")
data = file.readlines()
for lines in data:
if not lines == "":
info = str(lines).split(":")
user.append(info[0])
passwd.append(info[1])
name.append(info[2])
fathers.append(info[3])
pfathers.append(info[4])
file.close()
def statusdb(db):
file = open(db, "r")
data = file.read()
if not str(data).find("DaRpa") == -1:
print "DB Status: Encrypted!"
else:
print "DB Status: Decrypted!"
def make_table():
if len(user) > 1:
datau = ""
datap = ""
datae = ""
dataf = ""
datapf = ""
for usr in user:
datau += "\n" + usr + "\n".rstrip("\n")
for passw in passwd:
datap += "\n" + passw + "\n".rstrip("\n")
for na in name:
datae += "\n" + na + "\n".rstrip("\n")
for father in fathers:
dataf += "\n" + father + "\n".rstrip("\n")
for passw in pfathers:
datapf += passw + "\n".rstrip("\n")
table = [['Email', 'Password', 'Father', 'Password', 'Name'],
[datau, datap, dataf, datapf, datae]]
print(tabulate(table, headers='firstrow'))
print ""
raw_input("Press enter to continue")
clearf()
del datau
del datap
del datae
del dataf
del datapf
main()
else:
main()
def main():
print ""
statusdb("spotify.db")
print "Spotify Manager By Sentex"
print "--Select Option--------------------"
print " 1._ Open DB"
print " 2._ Delete account"
print " 3._ Add account"
print " 4._ Edit account"
print " 5._ Encrypt DB"
print " 6._ Decrypt DB"
print " 7._ Show DB"
print " 8._ Generate"
print " 9._ Exit"
opt = raw_input(">")
if opt == "":
print more.ERROR + "Wrong command"
main()
if int(opt) == 1:
print more.INFO + "Loading DB..."
opendb("spotify.db")
print more.CORRECT + "DB Loaded!"
main()
elif int(opt) == 2:
print "Email"
email = raw_input(">")
print "Password"
password = raw_input(">")
print "Name"
nombre = raw_input(">")
print "Father"
father = raw_input(">")
print "Password"
pfather = raw_input(">")
print more.INFO + "Removing Account..."
delete_account("spotify.db", email,password, nombre, father, pfather)
print more.CORRECT + "Account Deleted!"
main()
elif int(opt) == 3:
print "Email"
email = raw_input(">")
print "Password"
password = raw_input(">")
print "Name"
nombre = raw_input(">")
print "Father"
father = raw_input(">")
print "Password"
pfather = raw_input(">")
print more.INFO + "Creating new account..."
add_account("spotify.db", email, password, nombre, father, pfather)
print more.CORRECT + "Account Created!"
main()
elif int(opt) == 4:
print "Email"
email = raw_input(">")
print "Password"
password = raw_input(">")
print "Name"
nombre = raw_input(">")
print "Father"
father = raw_input(">")
print "Password"
pfather = raw_input(">")
print "New Email"
nemail = raw_input(">")
print "New Password"
npassword = raw_input(">")
print "New Name"
nnombre = raw_input(">")
print "New Father"
nfather = raw_input(">")
print "New Password"
npfather = raw_input(">")
print more.INFO + "Editing Account"
if nemail == "":
nemail = str(email)
elif npassword == "":
npassword = str(password)
elif nnombre == "":
nnombre = str(nombre)
if nfather == "":
nfather = str(father)
if npfather == "":
npfather = str(pfather)
edit_account("spotify.db", email, password, nombre, nemail, npassword, nnombre, father, pfather, nfather, npfather)
print more.CORRECT + "Account Edited"
main()
elif int(opt) == 5:
print more.INFO + "Encrypting DB..."
encryptdb("spotify.db")
print more.CORRECT + "DB Encrypted!"
main()
elif int(opt) == 6:
print more.INFO + "Decrypting DB..."
decryptdb("spotify.db")
print more.CORRECT + "DB Decrypted!"
main()
elif int(opt) == 7:
make_table()
elif int(opt) == 8:
generate()
elif int(opt) == 9:
print more.INFO + "Encrypting the db"
f = open("spotify.db", "r")
data = f.read()
if str(data).find("DaRpa") == -1:
encryptdb("spotify.db")
print more.CORRECT + "Encrypted!"
print "Bye!"
sys.exit()
else:
print more.ERROR + "Wrong command"
main()
deca()
clear()
print SPOTIFY
main()