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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with script parameter passing

adammatthews opened this issue · comments

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

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

Quick work, thats amazing thank you!

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