-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathecdhify.py
More file actions
36 lines (26 loc) · 754 Bytes
/
Copy pathecdhify.py
File metadata and controls
36 lines (26 loc) · 754 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
35
36
import sys
from random import choice, randint
from cryptology.utils import read_text, client, server
def main():
ipvfour = input("IPv4: ")
if ipvfour == "":
ipvfour = "127.0.0.100"
portnumber = input("Port: ")
if portnumber == "":
portnumber = 12345
else:
try:
portnumber = int(portnumber)
except TypeError:
sys.exit("Portnumber not a number")
if sys.argv[1] == "h":
infile = input("File to send: ")
if infile != "":
text = read_text(infile)
else:
text = read_text()
server(ipvfour, portnumber, text)
elif sys.argv[1] == "c":
client(ipvfour, portnumber)
if __name__ == "__main__":
main()