@ebest/

Secure Storage

Python

No description

fork
loading
Files
  • main.py
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import json_store_client
from getpass import getpass
from Crypto.Cipher import AES
from hashlib import sha512

client = json_store_client.Client(
    '2a92320f57f6bfffabd91fea9f7b788d290e6d1cd274ce6c16237aa3df1c4bd8')
sr = input("Store or Retrive? (s or r) ")
if sr == "s":
	message = input("Message to store? ")
	key = input("Key? (must be 16 charactors long) (type d for defalt)")
	if key == "d":
		eobj = AES.new("!aI9*7McU*opdCI8", AES.MODE_CFB, 'PodUd4D49&#(Pom4')
	else:
		eobj = AES.new(key, AES.MODE_CFB, 'PodUd4D49&#(Pom4')
	ciphertext = eobj.encrypt(message)
	password = getpass("Password? ")
	cpassword = getpass("Comfirm password?")
	while password != cpassword:
		password = getpass("Your passwords don't match. Please try again.")
		cpassword = getpass("Comfirm password?")
	salt = "3d987fbc3c8146c1a4903e5d198512c9"
	hashed_password = sha512(password.encode() + salt.encode()).hexdigest()
	stuffs = client.retrieve("Msg platform")
	print(hashed_password)
	stuffs[hashed_password] = ciphertext
	client.store("Msg platform", stuffs)
if sr == "r":
	key = input("Key? (d for defalt) ")
	if key == "d":
		dobj = AES.new("!aI9*7McU*opdCI8", AES.MODE_CFB, 'PodUd4D49&#(Pom4')
	else:
		dobj = AES.new(key, AES.MODE_CFB, 'PodUd4D49&#(Pom4')
	stuff = client.retrieve("Msg platform")
	password = getpass("Password? ")
	salt = "3d987fbc3c8146c1a4903e5d198512c9"
	hashed_password = sha512(password.encode() + salt.encode()).hexdigest()
	message = stuff.get(hashed_password)
	if message == None:
		print("Nothing here!")
	else:
		fmessage = dobj.decrypt(message)
		print(fmessage.decode())
if sr == "reset":
	client.store("Msg platform", {})