objective-see / OverSight

OverSight monitors a mac's mic and webcam, alerting the user when the internal mic is activated, or whenever a process accesses the webcam.
GNU General Public License v3.0
512 stars 39 forks source link

Issue with script parameter passing #39

Closed adammatthews closed 1 year ago

adammatthews commented 1 year ago

I've been testing calling a script, and in order to get started I pulled in the params that are being passed.

1) The app UI says the device param is "-d", but this is being sent as "-device" 2) When you enable camera, it says Microphone on. And when you disable the microphone, it says Camera off.

Essentially, whatever you do, the script app the same params into the script.

Testing script:

#!/bin/bash

syslog -s -l error "OverSight Log: Started"
syslog -s -l error "$0" 

params=$@

syslog -s -l error "$params"

# Parse the arguments
while [ $# -gt 0 ]; do
  case "$1" in
    -device)
      device="$2"
      shift 2
      ;;
    -event)
      event="$2"
      shift 2
      ;;
    -process)
      process="$2"
      shift 2
      ;;
    *)
      echo "Error: invalid option $1"
      exit 1
      ;;
  esac
done

echo "Device: $device"
echo "Event: $event"
echo "Process: $process"

syslog -s -l error "OverSight Log: ${device}, ${event}, ${process}" 

Syslog output when enabling either microphone OR camera.

image
objective-see commented 1 year ago

Thanks @adammatthews for the bug report and script to repo - super helpful 🙏🏽

Found and fixed the bug (and updated the UI to reflect -device). Pushing out a new build/version first thing tomorrow, but local testing of the new version looks good:

image

adammatthews commented 1 year ago

Quick work, thats amazing thank you!

objective-see commented 1 year ago

Just released v2.1.5 that contains a fix for this issue: https://github.com/objective-see/OverSight/releases/tag/v2.1.5