-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·65 lines (52 loc) · 2.18 KB
/
main.py
File metadata and controls
executable file
·65 lines (52 loc) · 2.18 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
# main.py
"""
This is the entry point for the project.
The secondary purpose is to learn how to code in VCS.
"""
import logging
import argparse
# import requests # TESTING ONLY
# import json # TESTING ONLY
from modules.seedwords import SeedWordClass
# initialise logging - INFO, WARNING, ERROR, CRITICAL
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s -%(levelname)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
def main():
"""
main() program entry point.
Returns : none
"""
# Consider seperating arg parsing into its own module and ouside SeedWordClass.
# Parse arguments, unknown language and incorrect number of words ie. != 12 or 24.
logging.info("Program started.")
# import argparse to take
parser = argparse.ArgumentParser(description="Create a 12 or 24 word BIP39 pass phrase.")
parser.add_argument('language', help='Two letter code of the language word list to be used.', type=str)
parser.add_argument('number_of_words', help='The number of seed words. [12|24]', type=int)
args = parser.parse_args()
logging.info(f"\n\nargs : {args}, Language : {args.language}, Number of Words : {args.number_of_words}.\n")
# ... rest of the code
seed_words = SeedWordClass()
seed_words.set_language(args.language)
seed_words.set_bip39_file()
logging.info(f"In main() language file is {seed_words.get_bip39_file()}")
seed_words.set_seed_words(args.number_of_words)
seed_words.set_bip39_array()
# Get 12 or 24 random numbers between 0 and 2047
test = seed_words.get_random_numbers(seed_words.get_seed_words())
# logging.info(f"Seed words are {seed_words.get_random_numbers(seed_words.get_bip39_file())}.")
# logging.info(f"Filename = {seed_words.get_bip39_file()}.")
print(f"test = {test}")
# word_list = seed_words.get_word_list()
# print(f"The first word is : '{word_list[0]}'.")
# # NOTE blank first word in xx seed word file
# print(f"The 256th word is : '{word_list[255]}'.")
# print(f"The last word is : '{word_list[2047]}'.")
logging.info("Program terminated successfully.")
return
if __name__ == "__main__":
main()