Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

ScreamLock #33

Open
1989gironimo opened this issue Jan 9, 2019 · 6 comments
Open

ScreamLock #33

1989gironimo opened this issue Jan 9, 2019 · 6 comments
Labels
Custom Command Not officially supported

Comments

@1989gironimo
Copy link

Shamelessly stolen from @PowerPress via github/usbkill:
Have the app monitor the decibels coming from the microphone and let the user set a threshold. If the threshold is passed shut down the PC. Example being prevented from touching your PC but by screaming or a loud noise would trigger the shutdown allowing a hands free system.

@Lvl4Sword
Copy link
Owner

I had responded to that issue, and I'll reiterate more in-depth here.
Killer is designed with being a tamper detector first and foremost. Anything that can be put into an untrusted state while your computer is locked, should be secured against. Including but not limited to, your:

  • CD/DVD/BluRay disk drive being opened/removed
  • Laptop battery being removed
  • Laptop's AC power being disconnected
  • Bluetooth device being connected/disconnected
  • USB device being connected/removed
  • SDD/HDD disks being added/removed
  • Ethernet cord being connected/disconnected.

These are physical things on your system, or in the case of Bluetooth, devices connecting to your system. While right now I don't believe that detecting audio levels is all that important, I don't have a problem examining this when the project is in a more feature complete state. Currently, detections are done by running a program in a constant loop with a specified sleep at the end, and checking the return status of the program if it's not what the user wants. In order to implement audio level checking there would need to be a program constantly running and that's not something that is currently possible with how the project is setup.

@GhostofGoes
Copy link
Contributor

This would definitely be a cool feature to have, and I think it would be doable with a bit of work.

@GhostofGoes
Copy link
Contributor

One approach off the top of my head is to have a worker process that monitors the decibel levels (however that is done for the given platform), by sampling at regular intervals. When the main killer process wakes up and checks everything, it can query the worker for the audio history since it last checked. If the history exceeded the threashold, it then calls the normal exit routines.

Another approach might be to register a callback for "kill the system" with the worker. As soon as it sees the audio level exceeded, it calls back, and the callback method handles the usual notification and shutdown.

@Lvl4Sword Lvl4Sword added Custom Command Not officially supported and removed Feature Request labels Mar 16, 2019
@Lvl4Sword
Copy link
Owner

I labeled this "Custom Commands", as this'll be something that will be a lot easier to setup when custom commands are done.
Any custom commands won't be officially supported, so any issues with them won't be addressed.

@Lvl4Sword Lvl4Sword changed the title Feature Request: ScreamLock ScreamLock Apr 4, 2019
@M47H3W
Copy link

M47H3W commented Jul 13, 2019

I believe that the following python code is able to achieve this. I have tested it and can confirm that it works on macOS and Windows. I've not had the time to test it on Linux.

It is worth noting is that this will probably not work correctly if the script is sleeping. The program will not be able to capture the noise level if it's when the sleep is sleeping.

import sounddevice as sd
import numpy as np


def print_sound(indata, outdata, frames, time, status):
    volume_norm = np.linalg.norm(indata)*10
    level = int(volume_norm)

    if(level > 750): # Threshold
     print("Too much!")
     exit()
    else:
    	print(level)

with sd.Stream(callback=print_sound):
    sd.sleep(60 * 1000)

@Lvl4Sword
Copy link
Owner

@M47H3W While I appreciate your contribution, custom commands are not planned until 2.0 and the project has yet to release 1.0. If you'd like more information, please check out #47

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Custom Command Not officially supported
Projects
None yet
Development

No branches or pull requests

4 participants