-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinteractivetest.py
More file actions
executable file
·34 lines (30 loc) · 934 Bytes
/
interactivetest.py
File metadata and controls
executable file
·34 lines (30 loc) · 934 Bytes
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
#!/usr/bin/env python3
"""
Interactive terminal questionnaire.
Asks for:
- System OS
- System architecture
- Hostname
- Kernel
- Supplied password
Run: python3 interactivetest.py
"""
def main() -> None:
print("Interactive system info test\n" + "-" * 32)
answers = {}
try:
answers["System OS"] = input("What is the system OS? ")
answers["System architecture"] = input("What is the system arch? ")
answers["Hostname"] = input("What is the hostname? ")
answers["Kernel"] = input("What is the kernel? ")
answers["Supplied password"] = input("Enter supplied password: ")
except KeyboardInterrupt:
print("\n\nAborted by user.")
return
print("\n\nSummary\n" + "=" * 32)
# compute column width
key_width = max(len(k) for k in answers.keys())
for k, v in answers.items():
print(f"{k:<{key_width}} : {v}")
if __name__ == "__main__":
main()