-
Notifications
You must be signed in to change notification settings - Fork 0
/
securedrop.py
47 lines (42 loc) · 1.48 KB
/
securedrop.py
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
#!/usr/bin/env python3
import sys
import registration
import login
import contacts
from broadcast import start_networking, print_online_contacts
import send_file
def get_user_input():
try:
while(action := input()):
if action == "help":
options =\
"""
\"add\"\t-> Add a new contact
\"list\"\t-> List all online contacts
\"send\"\t-> Transfer file to contact
\"exit\"\t-> Exit SecureDrop
"""
print(options)
elif action == "add":
contacts.main();
elif action == "list":
print("Current contacts online:")
print_online_contacts()
elif action.split()[0] == "send":
# begin sending packets
# call send func with arg 1 and 2 which are contact's email and filepath
send_file.main(action.split()[1], action.split()[2])
print('initiating file transfer')
elif action == "exit":
sys.exit("Exited SecureDrop")
else:
print("Command not Recognized")
except KeyboardInterrupt:
sys.exit("Exited SecureDrop")
def main():
registration.main()
login.main()
start_networking()
get_user_input()
if __name__ == '__main__':
main()