Skip to content

Commit

Permalink
Merge pull request #388 from Hari-Nagarajan/development
Browse files Browse the repository at this point in the history
Hotfix for 0.4
  • Loading branch information
DakkJaniels authored Dec 5, 2020
2 parents e6db84a + 3a27ff8 commit 892de41
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ coloredlogs = "*"
apprise = "*"
price-parser = "*"
pypresence = "==4.0.0"

stdiomask = "*"

[requires]
python_version = "3.8"
5 changes: 4 additions & 1 deletion stores/amazon.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import getpass
import json
import stdiomask
import time
import os
import math
Expand Down Expand Up @@ -206,6 +207,8 @@ def __init__(
log.info("No credential file found, let's make one")
credential = self.await_credential_input()
create_encrypted_config(credential, CREDENTIAL_FILE)
self.username = credential["username"]
self.password = credential["password"]

if os.path.exists(AUTOBUY_CONFIG_PATH):
with open(AUTOBUY_CONFIG_PATH) as json_file:
Expand Down Expand Up @@ -253,7 +256,7 @@ def __init__(
@staticmethod
def await_credential_input():
username = input("Amazon login ID: ")
password = getpass.getpass(prompt="Amazon Password: ")
password = stdiomask.getpass(prompt="Amazon Password: ")
return {
"username": username,
"password": password,
Expand Down
2 changes: 1 addition & 1 deletion utils/discord_presence.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
pass

start_time = time.time()
version = "0.4"
version = "0.4.1"


def start_presence(status):
Expand Down
9 changes: 5 additions & 4 deletions utils/encryption.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import getpass
import getpass as getpass
import stdiomask
import json
import os
from base64 import b64encode, b64decode
Expand Down Expand Up @@ -48,8 +49,8 @@ def create_encrypted_config(data, file_path):
data = json.dumps(data)
payload = bytes(data, "utf-8")
log.info("Create a password for the credential file")
cpass = getpass.getpass(prompt="Credential file password: ")
vpass = getpass.getpass(prompt="Verify credential file password: ")
cpass = stdiomask.getpass(prompt="Credential file password: ", mask="*")
vpass = stdiomask.getpass(prompt="Verify credential file password: ", mask="*")
if cpass == vpass:
result = encrypt(payload, cpass)
with open(file_path, "w") as f:
Expand All @@ -68,7 +69,7 @@ def load_encrypted_config(config_path):
data = json_file.read()
try:
if "nonce" in data:
password = getpass.getpass(prompt="Credential file password: ")
password = stdiomask.getpass(prompt="Credential file password: ", mask="*")
decrypted = decrypt(data, password)
return json.loads(decrypted)
else:
Expand Down

0 comments on commit 892de41

Please sign in to comment.