reorganise
This commit is contained in:
@ -1,8 +0,0 @@
|
||||
from pynput.mouse import Button, Controller
|
||||
import time
|
||||
mouse = Controller()
|
||||
|
||||
# Read pointer position
|
||||
while True:
|
||||
print('The current pointer position is {0}'.format(mouse.position))
|
||||
time.sleep(1)
|
@ -1,56 +0,0 @@
|
||||
import socket
|
||||
import os
|
||||
from tkinter import *
|
||||
from pynput import keyboard
|
||||
|
||||
#ipFile = open("IP.txt")
|
||||
#IP = ipFile.read()
|
||||
#ipFile.close()
|
||||
|
||||
|
||||
#window = Tk()
|
||||
#label = Label(window, text= 'What is the IP')
|
||||
#entry = Entry(window, width=200)
|
||||
#entry.insert(END, IP)
|
||||
#label.pack()
|
||||
#entry.pack()
|
||||
|
||||
|
||||
|
||||
SEPARATOR = "<SEPARATOR>"
|
||||
BUFFER_SIZE = 128 # send 4096 bytes each time step
|
||||
|
||||
host = "safe-mask.auto.playit.gg"
|
||||
# the ip address or hostname of the server, the receiver
|
||||
# the port, let's use 5001
|
||||
port = 56926
|
||||
|
||||
# create the client socket
|
||||
s = socket.socket()
|
||||
print(f"[+] Connecting to {host}:{port}")
|
||||
s.connect((host, port))
|
||||
print("[+] Connected.")
|
||||
|
||||
|
||||
#-----------------------------------------------------------
|
||||
|
||||
|
||||
def on_press(key):
|
||||
dataToSend = "P"
|
||||
dataToSend = dataToSend + (('{}'.format(key)).replace("'", ""))
|
||||
dataToSendBytes = dataToSend.encode()
|
||||
s.sendall(dataToSendBytes)
|
||||
|
||||
def on_release(key):
|
||||
dataToSend = "R"
|
||||
dataToSend = dataToSend + (('{}'.format(key)).replace("'", ""))
|
||||
dataToSendBytes = dataToSend.encode()
|
||||
s.sendall(dataToSendBytes)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
with keyboard.Listener(on_press = on_press, on_release = on_release) as listener:
|
||||
listener.join()
|
||||
|
73
Server/mirrorServer.py
Normal file
73
Server/mirrorServer.py
Normal file
@ -0,0 +1,73 @@
|
||||
import socket
|
||||
import os
|
||||
from multiprocessing import Process
|
||||
from tkinter import *
|
||||
from pynput import keyboard
|
||||
from pynput.mouse import Button, Controller
|
||||
from pynput import mouse
|
||||
# ipFile = open("IP.txt")
|
||||
# IP = ipFile.read()
|
||||
# ipFile.close()
|
||||
import threading # https://docs.python.org/3/library/threading.html
|
||||
import queue #
|
||||
|
||||
|
||||
# window = Tk()
|
||||
# label = Label(window, text= 'What is the IP')
|
||||
# entry = Entry(window, width=200)
|
||||
# entry.insert(END, IP)
|
||||
# label.pack()
|
||||
# entry.pack()
|
||||
MOUSE = Controller()
|
||||
dataToSend = ""
|
||||
|
||||
SEPARATOR = "<SEPARATOR>"
|
||||
BUFFER_SIZE = 128 # send 4096 bytes each time step
|
||||
|
||||
host = "safe-mask.auto.playit.gg"
|
||||
# the ip address or hostname of the server, the receiver
|
||||
# the port, let's use 5001
|
||||
port = 56926
|
||||
|
||||
# create the client socket
|
||||
s = socket.socket()
|
||||
print(f"[+] Connecting to {host}:{port}")
|
||||
s.connect((host, port))
|
||||
print("[+] Connected.")
|
||||
|
||||
|
||||
# -----------------------------------------------------------
|
||||
|
||||
|
||||
def on_press(key):
|
||||
dataToSend = "KP"
|
||||
dataToSend = dataToSend + (('{}'.format(key)).replace("'", ""))
|
||||
dataToSendBytes = dataToSend.encode()
|
||||
s.sendall(dataToSendBytes)
|
||||
|
||||
|
||||
def on_release(key):
|
||||
dataToSend = "KR"
|
||||
dataToSend = dataToSend + (('{}'.format(key)).replace("'", ""))
|
||||
dataToSendBytes = dataToSend.encode()
|
||||
s.sendall(dataToSendBytes)
|
||||
|
||||
|
||||
def on_click(x, y, button, pressed):
|
||||
if button == Button.left:
|
||||
dataToSend = ("ML")
|
||||
else:
|
||||
dataToSend = ("MR")
|
||||
|
||||
dataToSend = dataToSend + str(x) + "," + str(y)
|
||||
dataToSendBytes = dataToSend.encode()
|
||||
s.sendall(dataToSendBytes)
|
||||
|
||||
|
||||
def mouseThread():
|
||||
with mouse.Listener(on_click=on_click) as mouseListener:
|
||||
mouseListener.join()
|
||||
threading.Thread(target=mouseThread).start()
|
||||
|
||||
with keyboard.Listener(on_press=on_press, on_release=on_release) as keyListener:
|
||||
keyListener.join()
|
@ -1,58 +0,0 @@
|
||||
import socket
|
||||
import os
|
||||
from pynput import keyboard
|
||||
from pynput.mouse import Button, Controller
|
||||
from pynput import mouse
|
||||
|
||||
MOUSE = Controller()
|
||||
dataToSend = ""
|
||||
|
||||
|
||||
SEPARATOR = "<SEPARATOR>"
|
||||
BUFFER_SIZE = 128 # send 4096 bytes each time step
|
||||
|
||||
host = "4.tcp.ngrok.io"
|
||||
# the ip address or hostname of the server, the receiver
|
||||
# the port, let's use 10002
|
||||
port = 17058
|
||||
# the name of file we want to send, make sure it exists
|
||||
# get the file size
|
||||
|
||||
|
||||
|
||||
# create the client socket
|
||||
s = socket.socket()
|
||||
print(f"[+] Connecting to {host}:{port}")
|
||||
s.connect((host, port))
|
||||
print("[+] Connected.")
|
||||
# send the filename and filesize
|
||||
#s.send(f"{filename}{SEPARATOR}{filesize}".encode())
|
||||
|
||||
|
||||
|
||||
##############################################################################
|
||||
|
||||
|
||||
def on_click(x, y, button, pressed):
|
||||
|
||||
if button == Button.left:
|
||||
dataToSend = ("L")
|
||||
else:
|
||||
dataToSend = ("R")
|
||||
|
||||
dataToSend = dataToSend + str(x) + "," + str(y)
|
||||
dataToSendBytes = dataToSend.encode()
|
||||
s.sendall(dataToSendBytes)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
with mouse.Listener(
|
||||
|
||||
on_click = on_click) as listener:
|
||||
|
||||
listener.join()
|
||||
|
||||
|
||||
###############################################################################
|
Reference in New Issue
Block a user