Skip to main content

Command output changes monitor

Project description

diffs

GitHub version PyPI version

diffs monitors for any changes in arbitrary shell command output between the initial state and the current output.

Installation

pip3 install diffs

Python 3.6 (or newer) is required.

Usage

diffs CMD

The initial CMD output is stored at the beginning. Then the command is run again periodically and the output is compared against the initial output. If there are differences, they are shown in the standard diff format. The unchaged lines are not shown.

Examples

Show how many packets have been sent since the script has been started:

$ diffs ifconfig wlp2s0
-         RX packets 819320  bytes 171114372 (163.1 MiB)
?                     ---                ---      ^
+         RX packets 820098  bytes 171181884 (163.2 MiB)
?                       +++            + ++       ^
-         TX packets 2493955  bytes 3512746768 (3.2 GiB)
?                        ^^^           ^^^  ^^
+         TX packets 2496731  bytes 3516673094 (3.2 GiB)
?                       ++ ^           ^  ^^^^

Find new applications opening network ports (shows only changes between the initial state):

$ diffs netstat -tulpn
# after opening new port:
+ tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      18655/python

Monitor a file for a changes:

$ diffs cat /etc/resolv.conf

Difference between starting date and the current date:

$ diffs date
- nie, 12 maj 2019, 13:41:51 CEST
?                       ^  ^
+ nie, 12 maj 2019, 13:42:52 CEST
?                       ^  ^

Finding lately spawned processes:

$ diffs ps a
-   806 tty7     Ssl+   1:46 /usr/lib/xorg/Xorg :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
?                          ^
+   806 tty7     Ssl+   1:47 /usr/lib/xorg/Xorg :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
?                          ^
- 12521 pts/1    S+     0:00 /bin/sh -c ps a
?    --
+ 12665 pts/1    S+     0:00 /bin/sh -c ps a
?   ++
- 12522 pts/1    R+     0:00 ps a
?   ^^^
+ 12666 pts/1    R+     0:00 ps a
?   ^^^

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for diffs, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size diffs-0.1.0-py3-none-any.whl (4.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size diffs-0.1.0.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page