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.

Source Distribution

diffs-0.1.0.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

diffs-0.1.0-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page