remove file necesity
This commit is contained in:
		| @@ -6,7 +6,7 @@ from pynput.keyboard import Key, Controller | ||||
| keyboard=Controller() | ||||
|  | ||||
| # device's IP address | ||||
| SERVER_HOST =  "127.0.0.1" #(socket.gethostbyname(socket.gethostname())) | ||||
| SERVER_HOST =  "0.0.0.0" #(socket.gethostbyname(socket.gethostname())) | ||||
| SERVER_PORT = 10001 | ||||
| # receive 4096 bytes each time | ||||
| BUFFER_SIZE = 128 | ||||
| @@ -25,17 +25,6 @@ print(f"[*] Listening as {SERVER_HOST}:{SERVER_PORT}") | ||||
| client_socket, address = s.accept()  | ||||
| # if below code is executed, that means the sender is connected | ||||
| print(f"[+] {address} is connected.") | ||||
| # receive the file infos | ||||
| # receive using client socket, not server socket | ||||
| received = client_socket.recv(BUFFER_SIZE).decode() | ||||
| filename, filesize = received.split(SEPARATOR) | ||||
| # remove absolute path if there is | ||||
| filename = os.path.basename(filename) | ||||
| # convert to integer | ||||
| filesize = int(filesize) | ||||
| # start receiving the file from the socket | ||||
| # and writing to the file stream | ||||
| #with open(filename, "wb") as f: | ||||
|  | ||||
|  | ||||
| def pressRrelease_char(char): | ||||
| @@ -48,14 +37,8 @@ while True: | ||||
|         # nothing is received | ||||
|         # file transmitting is done take another time | ||||
|         break | ||||
|     # write to the file the bytes we just received | ||||
|     f = open(filename, 'wb') | ||||
|     f.write(bytes_read) | ||||
|     # update the progress bar | ||||
|     f.close() | ||||
|  | ||||
|     g = open(filename, 'r') | ||||
|     ge = g.read() | ||||
|     ge = bytes_read.decode() | ||||
|      | ||||
|     print (ge) | ||||
|     try: | ||||
| @@ -143,7 +126,6 @@ while True: | ||||
|             pressRrelease_char((ge)) | ||||
|     except: | ||||
|         print("an error occured with  ", ge) | ||||
|     g.close() | ||||
|  | ||||
|      | ||||
|  | ||||
|   | ||||
| @@ -6,7 +6,7 @@ from pynput.keyboard import Key, Controller | ||||
| keyboard=Controller() | ||||
|  | ||||
| # device's IP address | ||||
| SERVER_HOST =  "127.0.0.1" #(socket.gethostbyname(socket.gethostname())) | ||||
| SERVER_HOST =  "0.0.0.0" #(socket.gethostbyname(socket.gethostname())) | ||||
| SERVER_PORT = 10003 | ||||
| # receive 4096 bytes each time | ||||
| BUFFER_SIZE = 128 | ||||
| @@ -25,17 +25,6 @@ print(f"[*] Listening as {SERVER_HOST}:{SERVER_PORT}") | ||||
| client_socket, address = s.accept()  | ||||
| # if below code is executed, that means the sender is connected | ||||
| print(f"[+] {address} is connected.") | ||||
| # receive the file infos | ||||
| # receive using client socket, not server socket | ||||
| received = client_socket.recv(BUFFER_SIZE).decode() | ||||
| filename, filesize = received.split(SEPARATOR) | ||||
| # remove absolute path if there is | ||||
| filename = os.path.basename(filename) | ||||
| # convert to integer | ||||
| filesize = int(filesize) | ||||
| # start receiving the file from the socket | ||||
| # and writing to the file stream | ||||
| #with open(filename, "wb") as f: | ||||
|  | ||||
|  | ||||
| def pressRrelease_char(char): | ||||
| @@ -48,14 +37,8 @@ while True: | ||||
|         # nothing is received | ||||
|         # file transmitting is done take another time | ||||
|         break | ||||
|     # write to the file the bytes we just received | ||||
|     f = open(filename, 'wb') | ||||
|     f.write(bytes_read) | ||||
|  | ||||
|     f.close() | ||||
|  | ||||
|     g = open(filename, 'r') | ||||
|     ge = g.read() | ||||
|     ge = bytes_read.decode() | ||||
|  | ||||
|     print (ge) | ||||
|     try: | ||||
| @@ -143,7 +126,7 @@ while True: | ||||
|             pressRrelease_char((ge)) | ||||
|     except: | ||||
|         print("an error occured with  ", ge) | ||||
|     g.close() | ||||
|  | ||||
|  | ||||
|          | ||||
|  | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import time | ||||
| mouse=Controller() | ||||
|  | ||||
| # device's IP address | ||||
| SERVER_HOST =  "127.0.0.1" #(socket.gethostbyname(socket.gethostname())) | ||||
| SERVER_HOST =  "0.0.0.0" #(socket.gethostbyname(socket.gethostname())) | ||||
| SERVER_PORT = 10002 | ||||
| # receive 4096 bytes each time | ||||
| BUFFER_SIZE = 128 | ||||
| @@ -27,19 +27,6 @@ print(f"[*] Listening as {SERVER_HOST}:{SERVER_PORT}") | ||||
| client_socket, address = s.accept()  | ||||
| # if below code is executed, that means the sender is connected | ||||
| print(f"[+] {address} is connected.") | ||||
| # receive the file infos | ||||
| # receive using client socket, not server socket | ||||
| received = client_socket.recv(BUFFER_SIZE).decode() | ||||
| filename, filesize = received.split(SEPARATOR) | ||||
| # remove absolute path if there is | ||||
| filename = os.path.basename(filename) | ||||
| # convert to integer | ||||
| filesize = int(filesize) | ||||
| # start receiving the file from the socket | ||||
| # and writing to the file stream | ||||
| #with open(filename, "wb") as f: | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
| while True: | ||||
| @@ -49,15 +36,11 @@ while True: | ||||
|         # nothing is received | ||||
|         # file transmitting is done take another time | ||||
|         break | ||||
|     # write to the file the bytes we just received | ||||
|  | ||||
|     # update the progress bar | ||||
|     f = open(filename, 'wb') | ||||
|     f.write(bytes_read) | ||||
|     f.close() | ||||
|     # read bytes we just received | ||||
|  | ||||
|     ge = bytes_read.decode() | ||||
|      | ||||
|     g = open(filename, 'r') | ||||
|     ge = g.read() | ||||
|     print (ge) | ||||
|      | ||||
|     TrR = ge[0:1] | ||||
| @@ -67,7 +50,6 @@ while True: | ||||
|         y = int(ge[((int(ge.find(',')+1))):]) | ||||
|         x = int(ge[:(int(ge.find(',')))]) | ||||
|          | ||||
|  | ||||
|         print(x) | ||||
|         print(y) | ||||
|         mouse.position = (x,y) | ||||
| @@ -79,13 +61,9 @@ while True: | ||||
|             mouse.click(Button.left, 1) | ||||
|             print (TrR) | ||||
|          | ||||
|          | ||||
|     except: | ||||
|         print ("error") | ||||
|  | ||||
|     g.close() | ||||
|  | ||||
|          | ||||
|  | ||||
| # close the client socket | ||||
| #client_socket.close() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 CactiChameleon9
					CactiChameleon9