#15:12 18/09/2015
#OS: CENTOS:
yum -y install nmap lftp
#SCAN ALIVED HOST:
59 23 * * * /opt/script/nmap-scan-alive-host.sh
root@dc1 ~# cat /opt/script/nmap-scan-alive-host.sh
#16:53 09/09/2015
#/opt/script/nmap-scan-alive-host.sh
####################################
mkdir -p /opt/script/nmap-scan
cd /opt/script/nmap-scan
now="$(date +'%Y.%m.%d-%H.%M.%S.%6N')"
echo "_________ALIVE HOST_____________" > alive-host-$now.nmap.alived
nmap -sP x.x.x.0/24 | grep report >> alive-host-$now.nmap.alived
echo "" >> alive-host-$now.nmap.alived
echo -e "Scan Starting: "$now >> alive-host-$now.nmap.alived
echo -e "Scan Done....: "$(date +'%Y.%m.%d-%H.%M.%S.%6N') >> alive-host-$now.nmap.alived
echo "################################" >> alive-host-$now.nmap.alived
/opt/script/nmap-upload-alived-host.sh
root@dc1 ~# cat /opt/script/nmap-upload-alived-host.sh
#!/bin/bash
#/opt/script/nmap-upload-alived-host.sh
HOST=xxx
USER=yyy
PASS=zzz
SOURCE_FOLDER=/opt/script/nmap-scan/
TARGET_FOLDER=ABC
lftp -f "
open $HOST
user $USER $PASS
lcd $SOURCE_FOLDER
cd $TARGET_FOLDER
mirror -R --newer-than=now-1days --include='alived'
bye
"
No comments:
Post a Comment