Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A command-line tool to run shell commands whenever the active window focus changes
I use it to prevent too many idling virtualbox guests from surreptitiously stealing cpu cycles.
With node.js installed on the target X11 box:
$ npm install -g xawt # might need to prefix with sudo
$ xawt
You should see echo
commands run whenever the window focus changes.
On its first run xawt copies the default configuration file to
$XDG_CONFIG_HOME/xawt.conf
which defaults to
$HOME/.config/xawt.conf
. Edit this leanconf file with one or more rules:
/regex/:
in: action
out: action
regex
:
a unique JavaScript regular expression
in:
:
(optional) action to perform when regex matches the title of a window receiving focus (activating).
out:
:
(optional) action to perform when regex matches the title of a window losing focus (de-activating).
action
:
either the shell command to run immediately, or
command: shell-command
delay: delay-secs
retry: retry-secs
delay:
: (optional) number of seconds to wait before running the shell
command, as long as the window's focus remains unchanged.
If not supplied, a value of 0 is used.retry:
: (optional) number of seconds to wait before retrying a failed
shell command. If not supplied, a failed command is never retried.Commands can include parenthesised substring matches by the $
symbol where
$1
is the first submatch, $2
the second, etc.
# xawt.conf example configuration
# freeze Firefox (after 10 seconds) unless it has the focus
/- (Mozilla Firefox|Vimperator)$/:
in: pkill -CONT firefox
out:
command: pkill -STOP firefox
delay: 10
# unpause any virtualbox guest immediately on gaining focus
/^(\w+) \[Paused\] - Oracle VM VirtualBox$/:
in: vboxmanage controlvm $1 resume
# unconditionally pause virtualbox guest 30 seconds after losing focus
/^(HERBERT|SANDPIT) \[Running\] - Oracle VM VirtualBox$/:
out:
command: vboxmanage controlvm $1 pause
delay: 30
# pause virtualbox guest 60 seconds after losing focus unless vlc is running,
# in which case keep retrying every 90 seconds until vlc closes.
/^(SWEEP) \[Running\] - Oracle VM VirtualBox$/:
out:
command: (! vboxmanage guestcontrol $1 run --wait-stdout --exe /bin/pgrep -- arg0 vlc) && vboxmanage controlvm $1 pause
delay: 60
retry: 90
$ xawt --help
Usage: xawt [Options]
Options:
-h, --help output usage information
-V, --version output the version number
-c, --config-path [path] path to configuration file (default:~/.config/xawt.conf)
-d, --dry-run trace commands without executing
-v, --verbose emit detailed trace for debugging
$ git clone --branch=dev https://github.com/dizzib/xawt.git
$ cd xawt
$ npm install # install dependencies
$ npm test # build all and run tests
$ npm start # start the task runner and dry-run xawt
FAQs
A command-line tool to run shell commands whenever the active window focus changes
The npm package xawt receives a total of 1 weekly downloads. As such, xawt popularity was classified as not popular.
We found that xawt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.