aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md (renamed from README.markdown)4
-rw-r--r--VERSION2
-rwxr-xr-xnwatch (renamed from bin/nwatch)16
-rw-r--r--nwatch.1 (renamed from share/man/man1/nwatch.1)7
4 files changed, 20 insertions, 9 deletions
diff --git a/README.markdown b/README.md
index f1c5a3a..3df5148 100644
--- a/README.markdown
+++ b/README.md
@@ -13,8 +13,8 @@ Example with root privileges:
# nwatch /etc/nwatch.mynet /var/cache/nwatch/mynet
-Prints the results of an `ndiff(1)` call against the last known scan to stdout;
-intended to be called from `cron(8)`:
+Prints the filtered results of an `ndiff(1)` call against the last
+known scan to stdout; intended to be called from `cron(8)`:
0 0 * * 0 nwatch /etc/nwatch.mynet /var/cache/nwatch/mynet
diff --git a/VERSION b/VERSION
index 3eefcb9..227cea2 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.0
+2.0.0
diff --git a/bin/nwatch b/nwatch
index eb28a52..c981fbc 100755
--- a/bin/nwatch
+++ b/nwatch
@@ -71,6 +71,18 @@ done
# Write diff to stdout if it exists (not an error if it doesn't)
if [[ -r $diff ]] ; then
- cat -- "$diff"
+ awk '/^[-+]Not shown: / { next }
+/^[-+]/ { diff = 1 }
+NF { lines[++l] = $0 }
+function write() {
+ if (diff) {
+ for (l in lines)
+ print lines[l]
+ print ""
+ }
+ diff = l = 0
+}
+!NF { write() }
+END { write() }
+' -- "$diff"
fi
-
diff --git a/share/man/man1/nwatch.1 b/nwatch.1
index 109d891..d35d469 100644
--- a/share/man/man1/nwatch.1
+++ b/nwatch.1
@@ -1,4 +1,4 @@
-.TH NWATCH 1 "May 2014" "Manual page for nwatch"
+.TH NWATCH 1 "July 2018" "Manual page for nwatch"
.SH NAME
.B nwatch
\- slightly nicer Nmap ndiff(1) wrapper
@@ -18,8 +18,8 @@ and runs an nmap(1) command suitable for running through ndiff(1) against those
hosts. It caches the scan output in plain text, greppable, and XML formats in
.I CACHEDIR
and then runs ndiff(1) between the last scan it can find and the current scan,
-storing the output in CACHEDIR and printing it to stdout. This makes it useful
-for running from cron(8):
+storing the output in CACHEDIR and printing it to stdout, after an attempt at
+some intelligent filtering. This makes it useful for running from cron(8):
.PP
0 0 * * 0 nwatch /etc/nwatch.mynet /var/cache/nwatch/mynet
.PP
@@ -34,4 +34,3 @@ privileges.
nmap(1), ndiff(1), runcrypt(1), Mail::Run::Crypt(3)
.SH AUTHOR
Tom Ryder <tom@sanctum.geek.nz>
-