diff --git a/Spy Notify - Linux.py b/Spy Notify - Linux.py new file mode 100644 index 0000000..cc320bb --- /dev/null +++ b/Spy Notify - Linux.py @@ -0,0 +1,33 @@ +import notify2 +from subprocess import check_output, STDOUT, CalledProcessError +import os +os.environ["PBR_VERSION"] = "4.0.2" +from tendo import singleton +me = singleton.SingleInstance() +notify2.init("Spy Notify") +while True: + cmd = "fuser /dev/video0" + try: + usage = check_output(cmd, stderr=STDOUT, shell=True) + returncode = 0 + except CalledProcessError as ex: + usage = ex.output + returncode = ex.returncode + if returncode != 1: + raise + if returncode == 0: + img_path = "/opt/Spy Notify/image1.ico" + notify2.Notification("Webcam in Use", message="Your webcam is being used! Is this you?", icon=img_path).show() + use = True + while use == True: + try: + usage = check_output(cmd, stderr=STDOUT, shell=True) + returncode = 0 + except CalledProcessError as ex: + usage = ex.output + returncode = ex.returncode + if returncode != 1: + raise + if returncode != 0: + use = False + break diff --git a/Spy Notify - OSX.py b/Spy Notify - OSX.py new file mode 100644 index 0000000..f749c9d --- /dev/null +++ b/Spy Notify - OSX.py @@ -0,0 +1,38 @@ +import cv2 +from subprocess import check_output, STDOUT, CalledProcessError, call +cap = cv2.VideoCapture(0) +try: + cam1 = check_output("lsof | grep AppleCamera", stderr=STDOUT, shell=True) + returncode1 = 0 +except CalledProcessError as ex: + cam1 = ex.output + returncode1 = ex.returncode + if returncode1 != 1: + raise +try: + cam2 = check_output("lsof | grep iSight", stderr=STDOUT, shell=True) + returncode2 = 0 +except CalledProcessError as ex: + cam2 = ex.output + returncode2 = ex.returncode + if returncode2 != 1: + raise +try: + cam3 = check_output("lsof | grep VDC", stderr=STDOUT, shell=True) + returncode3 = 0 +except CalledProcessError as ex: + cam3 = ex.output + returncode3 = ex.returncode + if returncode3 != 1: + raise +if cam1 == cam2: + cmd = "lsof | grep VDC" +elif cam1 == cam3: + cmd = "lsof | grep iSight" +elif cam2 == cam3: + cmd = "lsof | grep AppleCamera" +settings = open("/Library/Spy Notify/settings.txt","w") +settings.write(cmd) +settings.close() +call("open -a Spy-Notify", shell=True) +exit() diff --git a/Spy Notify - Windows 10.py b/Spy Notify - Windows 10.py new file mode 100644 index 0000000..a519477 --- /dev/null +++ b/Spy Notify - Windows 10.py @@ -0,0 +1,22 @@ +from win10toast import ToastNotifier +import cv2 +import os +os.environ["PBR_VERSION"] = "4.0.2" +from tendo import singleton +me = singleton.SingleInstance() +while True: + notify = ToastNotifier() + cap = cv2.VideoCapture(0) + if cap.read() == (False, None): + var = True + else: + var = False + cap.release() + if var != False: + notify.show_toast("Webcam in Use","Your webcam is being used! Is this you?",icon_path="image1.ico",duration=10) + use = True + while use == True: + cap = cv2.VideoCapture(0) + if cap.read() != (False, None): + use = False + break \ No newline at end of file