GithubHelp home page GithubHelp logo

pyusbalarm's Introduction

pyusbalarm

Monitor USB devices and trigger an action when any of them is unplugged. The action is defined by a Python function (payload).

This program is still under development and by this time it only provides a very limited functionality.

Licensing

BSD License

Requirements

List of required Python modules

  • pyusb
  • pygame

Features

  • Check attached USB devices
  • Perform an action when any device is unplugged
  • Command line interface

Example of use

You must have root privileges to run this script (accessing usb info requires it)

bluesman@diego-workstation:~/workspace/pyusbalarm$ sudo python alarm.py 
* Exploring devices
USB Laser Mouse
24G Wireless Touchpad Keyboard
===================
Monitoring USB devices... (Press CTRL+C for exit)
Playing sound
Playing sound
^CYou Pressed CTRL+C

The example included in alarm.py first explores the attached USB devices. Then the program enters into an infinite loop to check if any device has been unplugged, if so, the payload will be called and the loop will continue checking all devices again after the payload execution. CTRL+C must be pressed to finish the program.

TODO

  • PyQT4 GUI
  • Implement something to configure alarms (read a config file or GUI)
  • Add new payloads

pyusbalarm's People

Contributors

dnmellen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pyusbalarm's Issues

ValueError: The device has no langid

When I execute the script this is the error I get:

File "/usr/local/lib/python3.6/site-packages/usb/util.py", line 314, in get_string
    raise ValueError("The device has no langid")
ValueError: The device has no langid

(I adapted the code to python3)

Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.