Update handlers: move cmd execution to :listen_command method

pull/24/head
xyzkab 2020-01-08 23:44:41 +07:00
parent 9f620d4f33
commit 3d737a7e72
1 changed files with 9 additions and 0 deletions

View File

@ -26,6 +26,15 @@ class Handler(threading.Thread):
print("\n{}\nShell > $ ".format(response.decode('utf_8', 'ignore').strip()), end='')
response = self.client.recv(255)
def listen_command(self):
if self.connected == True:
cmd = input("Shell> $ ")
if cmd == "exit":
self.kill()
print("BYE !")
exit()
self.send_command(cmd+"\n\n")
def send_command(self, cmd):
self.client.sendall(cmd.encode())