basedir
This commit is contained in:
parent
f8d54304b6
commit
1a9ba885e8
9
nmail.sh
9
nmail.sh
@ -13,8 +13,9 @@
|
|||||||
#
|
#
|
||||||
###
|
###
|
||||||
|
|
||||||
|
basedir=$(dirname "$0")
|
||||||
targets="192.168.0.0/24"
|
targets="192.168.0.0/24"
|
||||||
path=.
|
path=$basedir
|
||||||
mailto=mail@address.com
|
mailto=mail@address.com
|
||||||
message="Send by nmail.sh"
|
message="Send by nmail.sh"
|
||||||
|
|
||||||
@ -23,11 +24,13 @@ then
|
|||||||
mv -f "$path/new_scan.xml" "$path/prev_scan.xml"
|
mv -f "$path/new_scan.xml" "$path/prev_scan.xml"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nmap $targets -oX "$path/new_scan.xml"
|
nmap $targets -T4 -oX "$path/new_scan.xml"
|
||||||
|
|
||||||
if [ -f "$path/prev_scan.xml" ]
|
if [ -f "$path/prev_scan.xml" ]
|
||||||
then
|
then
|
||||||
ndiff --xml "$path/prev_scan.xml" "$path/new_scan.xml" | xsltproc nmail.xsl - | while read -r line
|
ndiff --xml "$path/prev_scan.xml" "$path/new_scan.xml" | \
|
||||||
|
xsltproc "$basedir\nmail.xsl" - | \
|
||||||
|
while read -r line
|
||||||
do
|
do
|
||||||
echo $message | mail $mailto -s "$line"
|
echo $message | mail $mailto -s "$line"
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user