pynput icon indicating copy to clipboard operation
pynput copied to clipboard

Microsoft Windows Defender reports files implementing pynput as a virus:

Open Triangle4 opened this issue 1 year ago • 0 comments

from pynput.keyboard import Listener as keyListener from pynput.mouse import Listener as mouseListener from maths.vector import *

class Input: alt = False mouseDown = False position = Vector2(0,0) scrollWheelDelta = 0

def Update(self, key, state):
	match key:
		case "alt_l":
			Input.alt = state
def __init__(self):
	self.keyListener = keyListener(on_press = self.on_key_press, on_release = self.on_key_release)
	self.keyListener.start()
	self.mouseListener = mouseListener(on_move = self.on_move,on_click = self.on_mouse_down,on_scroll = self.on_scroll)
	self.mouseListener.start()
	
	
	self.stopped = False

def on_move(self,x,y):
	Input.mousePosition = Vector2(x,y)

def on_mouse_down(self, x, y, button, pressed):
	Input.mouseDown = pressed
	if(self.stopped): return False

def on_scroll(self, x, y, dx, dy):
	Input.scrollWheelDelta = dy
	
def on_key_press(self, key):
	try:
		self.Update(str(key.char).replace("Key.", ""), True)
	except AttributeError:
		self.Update(str(key).replace("Key.", ""), True)


		
def on_key_release(self, key):
	self.Update(str(key).replace("Key.", ""), False)
	if(self.stopped): return False

Put this code into a file, and upload it to virus total, and you will see that microsoft marks this as a virus. It blocks me from saving, copying, zipping and randomly deletes the file, later to be found in the quarantine.

See if you can look into this

Triangle4 avatar Jun 24 '23 18:06 Triangle4