update password module to use standardized interactive interface
This commit is contained in:
parent
e107e28947
commit
772cfc900c
|
@ -1,5 +1,6 @@
|
||||||
from modules.wires import WiresModule
|
from modules.wires import WiresModule
|
||||||
from modules.button import ButtonModule
|
from modules.button import ButtonModule
|
||||||
|
from modules.comp_wires import ComplicatedWiresModule
|
||||||
from modules.password import PasswordModule
|
from modules.password import PasswordModule
|
||||||
|
|
||||||
modules = {
|
modules = {
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
from prompt_toolkit import prompt
|
||||||
|
from prompt_toolkit.completion import WordCompleter
|
||||||
|
|
||||||
class FoundCondition(Exception):
|
class FoundCondition(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -60,7 +63,7 @@ class PasswordModule:
|
||||||
default module execution location
|
default module execution location
|
||||||
|
|
||||||
(hint, default module execution location is where __name__ ==
|
(hint, default module execution location is where __name__ ==
|
||||||
"__main__"
|
"__main__")
|
||||||
|
|
||||||
"""
|
"""
|
||||||
responses = []
|
responses = []
|
||||||
|
@ -71,5 +74,16 @@ class PasswordModule:
|
||||||
obj = cls(responses)
|
obj = cls(responses)
|
||||||
return obj.solve()
|
return obj.solve()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def interactive(cls, state, cmdline):
|
||||||
|
responses = []
|
||||||
|
for i in range(5):
|
||||||
|
print("Enter {}th column of letters:".format(str(i + 1)))
|
||||||
|
response = [*prompt('password> ')]
|
||||||
|
responses.append(response)
|
||||||
|
|
||||||
|
password = cls(responses)
|
||||||
|
print(password.solve())
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(PasswordModule.human_helper())
|
print(PasswordModule.human_helper())
|
||||||
|
|
Loading…
Reference in New Issue