#2839 return seedwords and add6x4 in new function

This commit is contained in:
openoms 2021-12-23 17:25:17 +00:00
parent 2f244429aa
commit 9da44ea593
No known key found for this signature in database
GPG Key ID: 5BFB77609B081B65
2 changed files with 10 additions and 5 deletions

View File

@ -7,6 +7,7 @@ from mnemonic import Mnemonic
if len(sys.argv) <= 1 or sys.argv[1] == "-h" or sys.argv[1] == "help":
print("tool for seed words")
print("blitz.mnemonic.py generate")
print("blitz.mnemonic.py add6x4 \"[SEEDWORDS-SPACE-SEPERATED]\"")
print("blitz.mnemonic.py test \"[SEEDWORDS-SPACE-SEPERATED]\"")
sys.exit(1)
@ -23,8 +24,11 @@ def generate():
seedwords = mnemo.generate(strength=256)
print("seedwords='" + seedwords + "'")
return seedwords
# add a 6x4 formatted version to the output
def add6x4(seedwords):
# add a 6x4 formatted version to the output
wordlist = list(seedwords.split(" "))
seed_words_6x4 = ""
for i in range(0, len(wordlist)):
@ -36,7 +40,6 @@ def generate():
seed_words_6x4 = seed_words_6x4 + single_word
print("seedwords6x4='" + seed_words_6x4 + "'")
#######################
# TEST SEED WORDS
#######################
@ -50,11 +53,11 @@ def test(words):
def main():
if sys.argv[1] == "generate":
generate()
add6x4(generate())
elif sys.argv[1] == "add6x4":
add6x4(sys.argv[2])
elif sys.argv[1] == "test":
test(sys.argv[2])
else:
# UNKNOWN PARAMETER
print("error='unknown parameter'")

View File

@ -218,6 +218,8 @@ if [ "$1" = "new" ] || [ "$1" = "new-force" ] || [ "$1" = "seed" ] || [ "$1" = "
elif [ "$1" = "seed" ] || [ "$1" = "seed-force" ]; then
#TODO get seedwords from cl.backup.sh seed-import-gui [$RESULTFILE]
seedwords="$3"
# get seedwords6x4
source <(python /home/admin/config.scripts/blitz.mnemonic.py add6x4 "${seedwords}")
seedpassword="$4"
fi