Update server.py
This commit is contained in:
1 parent
4c19b6b053
commit
ed5689fb5a
1 file changed
+3
-2
+3
-2
@@ -1,9 +1,10 @@
|
|||||||
# server.py
|
# server.py
|
||||||
import socket
|
import socket
|
||||||
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
HOST = "0.0.0.0"
|
HOST = "0.0.0.0"
|
||||||
PORT = 5000
|
PORT = 5055
|
||||||
|
|
||||||
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ while True:
|
|||||||
command = conn.recv(65536)
|
command = conn.recv(65536)
|
||||||
# print("Received Grep Command:", command.decode())
|
# print("Received Grep Command:", command.decode())
|
||||||
|
|
||||||
result = subprocess.run(command.decode(), capture_output=True, text=True)
|
result = subprocess.run(shlex.split(command.decode()), capture_output=True, text=True)
|
||||||
conn.sendall(result.stdout.encode())
|
conn.sendall(result.stdout.encode())
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|||||||
Reference in new issue
Block a user