Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ShyavanS authored Jun 7, 2020
0 parents commit e26af81
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Spy Notify - Linux.py
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions Spy Notify - OSX.py
Original file line number Diff line number Diff line change
@@ -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()
22 changes: 22 additions & 0 deletions Spy Notify - Windows 10.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e26af81

Please sign in to comment.