diff --git a/.gitignore b/.gitignore index 5d381cc..46c008f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ +# Custom + +*.dat +*.asc +*.asc.s + # ---> Python # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/files/strength/common-passwords.txt b/files/strength/common-passwords.txt new file mode 100644 index 0000000..c41c6e5 --- /dev/null +++ b/files/strength/common-passwords.txt @@ -0,0 +1,922 @@ +123456 +password +12345678 +qwerty +123456789 +12345 +1234 +111111 +1234567 +dragon +123123 +baseball +abc123 +football +monkey +letmein +696969 +shadow +master +666666 +qwertyuiop +123321 +mustang +1234567890 +michael +654321 +superman +1qaz2wsx +7777777 +121212 +000000 +qazwsx +123qwe +killer +trustno1 +jordan +jennifer +zxcvbnm +asdfgh +hunter +soccer +harley +batman +andrew +tigger +sunshine +2000 +charlie +robert +thomas +hockey +ranger +daniel +starwars +klaster +112233 +george +computer +michelle +jessica +pepper +1111 +zxcvbn +555555 +11111111 +131313 +freedom +777777 +pass +maggie +159753 +aaaaaa +ginger +princess +joshua +cheese +amanda +summer +love +ashley +6969 +nicole +chelsea +matthew +access +yankees +987654321 +dallas +austin +thunder +taylor +matrix +william +corvette +hello +martin +heather +secret +merlin +diamond +1234qwer +gfhjkm +hammer +silver +222222 +88888888 +anthony +justin +test +bailey +q1w2e3r4t5 +patrick +internet +scooter +orange +11111 +golfer +cookie +richard +samantha +bigdog +guitar +jackson +whatever +mickey +chicken +sparky +snoopy +maverick +phoenix +camaro +peanut +morgan +welcome +falcon +ferrari +samsung +andrea +smokey +steelers +joseph +mercedes +dakota +arsenal +eagles +melissa +boomer +booboo +spider +nascar +monster +tigers +yellow +123123123 +gateway +marina +diablo +bulldog +qwer1234 +compaq +purple +hardcore +banana +junior +hannah +123654 +porsche +lakers +iceman +money +987654 +london +tennis +999999 +ncc1701 +coffee +scooby +0000 +miller +boston +q1w2e3r4 +brandon +yamaha +chester +mother +forever +johnny +edward +333333 +oliver +redsox +player +nikita +knight +fender +barney +midnight +please +brandy +chicago +iwantu +slayer +rangers +charles +angel +flower +bigdaddy +rabbit +wizard +jasper +enter +rachel +chris +steven +winner +adidas +victoria +natasha +1q2w3e4r +jasmine +winter +prince +marine +ghbdtn +fishing +cocacola +casper +james +232323 +raiders +888888 +marlboro +gandalf +asdfasdf +crystal +87654321 +12344321 +8675309 +panther +lauren +angela +thx1138 +angels +madison +winston +shannon +mike +toyota +jordan23 +canada +sophie +Password +apples +tiger +123abc +pokemon +qazxsw +55555 +qwaszx +muffin +johnson +murphy +cooper +jonathan +david +danielle +159357 +jackie +1990 +123456a +789456 +turtle +abcd1234 +scorpion +qazwsxedc +101010 +carlos +password1 +dennis +slipknot +qwerty123 +booger +asdf +1991 +black +startrek +12341234 +cameron +newyork +rainbow +nathan +john +1992 +rocket +viking +redskins +asdfghjkl +1212 +sierra +peaches +gemini +doctor +wilson +sandra +helpme +qwertyui +victor +florida +dolphin +captain +tucker +blue +theman +bandit +dolphins +maddog +packers +jaguar +lovers +nicholas +united +tiffany +maxwell +zzzzzz +nirvana +jeremy +monica +elephant +giants +hotdog +rosebud +success +debbie +mountain +444444 +warrior +1q2w3e4r5t +q1w2e3 +123456q +albert +metallic +lucky +azerty +7777 +alex +bond007 +alexis +1111111 +samson +5150 +willie +scorpio +bonnie +gators +benjamin +voodoo +driver +dexter +2112 +jason +calvin +freddy +212121 +creative +12345a +sydney +rush2112 +1989 +asdfghjk +red123 +bubba +4815162342 +passw0rd +trouble +gunner +happy +gordon +legend +jessie +stella +qwert +eminem +arthur +apple +nissan +bear +america +1qazxsw2 +nothing +parker +4444 +rebecca +qweqwe +garfield +01012011 +beavis +69696969 +jack +asdasd +december +2222 +102030 +252525 +11223344 +magic +apollo +skippy +315475 +kitten +golf +copper +braves +shelby +godzilla +beaver +fred +tomcat +august +buddy +airborne +1993 +1988 +lifehack +qqqqqq +brooklyn +animal +platinum +phantom +online +xavier +darkness +blink182 +power +fish +green +789456123 +voyager +police +travis +12qwaszx +heaven +snowball +lover +abcdef +00000 +pakistan +007007 +walter +blazer +cricket +sniper +donkey +willow +loveme +saturn +therock +redwings +bigboy +pumpkin +trinity +williams +nintendo +digital +destiny +topgun +runner +marvin +guinness +chance +bubbles +testing +fire +november +minecraft +asdf1234 +lasvegas +sergey +broncos +cartman +private +celtic +birdie +little +cassie +donald +beatles +1313 +family +12121212 +school +louise +gabriel +eclipse +fluffy +147258369 +lol123 +explorer +beer +nelson +flyers +spencer +scott +lovely +gibson +doggie +cherry +andrey +snickers +buffalo +pantera +metallica +member +carter +qwertyu +peter +alexande +steve +bronco +paradise +goober +5555 +samuel +montana +mexico +dreams +michigan +carolina +yankee +friends +magnum +surfer +maximus +genius +cool +vampire +lacrosse +asd123 +aaaa +christin +kimberly +speedy +sharon +carmen +111222 +kristina +sammy +racing +ou812 +sabrina +horses +0987654321 +qwerty1 +pimpin +baby +stalker +enigma +147147 +star +poohbear +147258 +simple +12345q +marcus +brian +1987 +qweasdzxc +drowssap +hahaha +caroline +barbara +dave +viper +drummer +action +einstein +genesis +hello1 +scotty +friend +forest +010203 +hotrod +google +vanessa +spitfire +badger +maryjane +friday +alaska +1232323q +tester +jester +jake +champion +billy +147852 +rock +hawaii +chevy +420420 +walker +stephen +eagle1 +bill +1986 +october +gregory +svetlana +pamela +1984 +music +shorty +westside +stanley +diesel +courtney +242424 +kevin +hitman +boobs +mark +12345qwert +reddog +frank +qwe123 +popcorn +patricia +aaaaaaaa +1969 +teresa +mozart +buddha +anderson +paul +melanie +abcdefg +security +lucky1 +lizard +denise +3333 +a12345 +123789 +ruslan +stargate +simpsons +scarface +eagle +123456789a +thumper +olivia +naruto +1234554321 +general +cherokee +a123456 +vincent +spooky +qweasd +free +frankie +douglas +death +1980 +loveyou +kitty +kelly +veronica +suzuki +semperfi +penguin +mercury +liberty +spirit +scotland +natalie +marley +vikings +system +king +allison +marshall +1979 +098765 +qwerty12 +adrian +1985 +vfhbyf +sandman +rocky +leslie +antonio +98765432 +4321 +softball +passion +mnbvcxz +passport +howard +franklin +bigred +alexander +homer +redrum +jupiter +claudia +55555555 +141414 +zaq12wsx +patches +raider +infinity +andre +54321 +galore +college +russia +kawasaki +bishop +77777777 +vladimir +money1 +freeuser +wildcats +francis +disney +budlight +brittany +1994 +00000000 +sweet +oksana +honda +domino +bulldogs +brutus +swordfis +norman +monday +jimmy +ironman +ford +fantasy +9999 +7654321 +PASSWORD +hentai +duncan +cougar +1977 +jeffrey +house +dancer +brooke +timothy +super +marines +justice +digger +connor +patriots +karina +202020 +molly +everton +alicia +rasdzv3 +pearljam +stinky +naughty +colorado +123123a +water +test123 +ncc1701d +motorola +ireland +asdfg +matt +houston +boogie +zombie +accord +vision +bradley +reggie +kermit +froggy +ducati +avalon +6666 +9379992 +sarah +saints +logitech +chopper +852456 +simpson +madonna +juventus +claire +159951 +zachary +yfnfif +wolverin +warcraft +hello123 +extreme +peekaboo +fireman +eugene +brenda +123654789 +russell +panthers +georgia +smith +skyline +jesus +elizabet +spiderma +smooth +pirate +empire +bullet +8888 +virginia +valentin +predator +arizona +134679 +mitchell +alyssa +vegeta +titanic +christ +goblue +fylhtq +wolf +mmmmmm +kirill +indian +hiphop +baxter +awesome +people +danger +roland +mookie +741852963 +1111111111 +dreamer +bambam +arnold +1981 +serega +rolltide +elvis +changeme +simon +1q2w3e +lovelove +denver +tommy +mine +hobbes +happy1 +alison +nemesis +chevelle +cardinal +burton +picard +151515 +tweety +michael1 +147852369 +12312 +windows +turkey +456789 +1974 +vfrcbv +sublime +1975 +galina +bobby +newport +manutd +daddy +american +alexandr +1966 +victory +rooster +qqq111 +madmax +electric +a1b2c3 +wolfpack +spring +phpbb +lalala +spiderman +eric +darkside +classic +raptor +123456789q +hendrix +1982 +wombat +avatar +alpha +zxc123 +crazy +england +brazil +1978 +01011980 +wildcat +polina diff --git a/keyvault.py b/keyvault.py new file mode 100644 index 0000000..b88039c --- /dev/null +++ b/keyvault.py @@ -0,0 +1,152 @@ +import base64 +import pickle +from math import log2 +from password_strength import PasswordStats +from getpass import getpass as gp +from secrets import token_urlsafe +from random import randint as rint, SystemRandom as sr +from atexit import register +from gc import collect +from os import urandom, path, remove +from cryptography.fernet import Fernet, InvalidSignature, InvalidToken +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC + +def encrypt_db(password): + binpass = password.encode() + salt = urandom(16) + kdf = PBKDF2HMAC( + algorithm=hashes.SHA512(), + length=32, + salt=salt, + iterations=1500000, + ) + key = base64.urlsafe_b64encode(kdf.derive(binpass)) + fernet = Fernet(key) + + with open("database/db.dat", "rb") as f: + data = f.read() + + encr = fernet.encrypt(data) + + with open("database/db.asc", "wb") as f: + f.write(encr) + + with open("database/db.s", "wb") as f: + f.write(salt) + +def decrypt_db(password): + with open("database/db.s", "rb") as f: + salt = f.read() + + binpass = password.encode() + kdf = PBKDF2HMAC( + algorithm=hashes.SHA512(), + length=32, + salt=salt, + iterations=1500000, + ) + key = base64.urlsafe_b64encode(kdf.derive(binpass)) + + fernet = Fernet(key) + + with open("database/db.asc", "rb") as f: + encrypted_data = f.read() + + decr = fernet.decrypt(encrypted_data) + + with open("database/db.dat", "wb") as f: + f.write(decr) + + with open("database/db.dat", "rb") as f: + while True: + try: + db = pickle.load(f) + except EOFError: + print("\nDatabase loaded.") + break + shred() + +def shred(): + with open("database/db.dat", "wb") as f: + for _ in range(5): + f.seek(0) + f.write(urandom(path.getsize("database/db.dat"))) + remove("database/db.dat") + +def clearmem(): + db = rint(100000000000000000000000000000000000000000000000000000000000, 999999999999999999999999999999999999999999999999999999999999) + db = None + +def gen(): + while True: + length = int(input("Enter password length (above 8 only): ")) + if length <= 7: + print("The password is too short. Please enter it again.") + else: + break + pool = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`~@#$%^&*()-_=+]}[{\"';:.>,= 0.33 and passstrength < 0.66: + print(f"[PASSWORD STRENGTH]: {passstrength}\n[PASSWORD ENTROPY]: {entropy} bits\nYour password is of fair strength. Please consider changing it to a stronger one.\n") + elif passstrength >= 0.66 and passstrength < 0.80: + print(f"[PASSWORD STRENGTH]: {passstrength}\n[PASSWORD ENTROPY]: {entropy} bits\nYour password is strong.\n") + elif passstrength >= 0.80 and passstrength < 0.9: + print(f"[PASSWORD STRENGTH]: {passstrength}\n[PASSWORD ENTROPY]: {entropy} bits\nYour password is incredibly strong.\n") + else: + print(f"[PASSWORD STRENGTH]: {passstrength}\n[PASSWORD ENTROPY]: {entropy} bits\nYour password is practically uncrackable.\n") + + +global db +register(clearmem) + +with open("files/strength/common-passwords.txt", "r") as f: + common_passwords = f.read() + +print("\nkeyvault initialized.") + +for _ in range(4): + try: + if _ != 3: + password = gp(prompt = "\nEnter your password (hidden for privacy!): ") + decrypt_db(password) + break + else: + print(" You have exceeded the maximum number of tries.") + exit() + except (InvalidSignature, InvalidToken): + print("Incorrect password.", end = '') + +print("keyvault is ready to use! Type 'help' for a list of commands.\n") + +while True: + command = input("> ").lower() + if command == 'help': + print("\nUsage:\n\nls - list entires\nrm - remove entry\ngen - generate a password or username\nstrength - check password strength\nedit - edit an entry\nshow/view - view an entry\nfind/search - open search wizard\nhelp - display this message\nversion - print current version\n") + elif command == 'version': + print("keyvault: v1.0.0") + elif command == 'gen': + gen() + elif command == 'strength': + strength()