-
Notifications
You must be signed in to change notification settings - Fork 6
/
get-ms-urls.sh
executable file
·34 lines (30 loc) · 1.18 KB
/
get-ms-urls.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
LOGFILE="/home/rommelfs/ticket-tools/logs/ms-last.log"
. ./inc_rt.conf
. ./inc_xmpp.conf
. ./inc_gpg.conf
cd /opt/rt4/bin/
LAST=`./rt list "Queue='Z_autoreport' and Subject like 'Data report for ccTLD lu' and Requestor.EmailAddress='[email protected]'" -f ticket |tail -n 5`
for tn in $LAST
do
if [ `grep $tn $LOGFILE` ]
then
echo "Ticket #$tn already processed"
else
echo "Processing ticket #$tn"
URLS=`./rt show $tn | gpg --passphrase="$GPGPASSPHRASE" -d --homedir=/opt/rt4/var/gpg|grep hxxp|sort|uniq -w 14`
if [ "$URLS" ]
then
echo -e "New domains from MS (Ticket $RTTICKET$tn):\n$URLS"|sendxmpp -u $XMPPuser -p $XMPPpass -r $XMPPresource -j $XMPPserv -t -c $XMPProom
else
URLS=`./rt show $tn | grep hxxp|sort|uniq -w 14`
if [ "$URLS" ]
then
echo -e "New domains from MS (Ticket $RTTICKET$tn):\n$URLS"|sendxmpp -u $XMPPuser -p $XMPPpass -r $XMPPresource -j $XMPPserv -t -c $XMPProom
else
echo -e "New ticket from MS (Ticket $RTTICKET$tn) without URLs (check content?)"|sendxmpp -u $XMPPuser -p $XMPPpass -r $XMPPresource -j $XMPPserv -t -c $XMPProom
fi
fi
echo $tn >> $LOGFILE
fi
done