-
Notifications
You must be signed in to change notification settings - Fork 6
/
process-proxy-list.sh
executable file
·53 lines (52 loc) · 1.58 KB
/
process-proxy-list.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#
# 2014-04-29 Sascha Rommelfangen, CIRCL
#
################################################################
#
# Import RT settings
. ./inc_rt.conf
#
################################################################
#
GLOBIGNORE="*"
while true
do
TICKET=""
TICKETID=""
ATTACHMENT=""
ATTACHMENTID=""
date
TICKET=`/opt/rt5/bin/rt ls -i -t ticket -q General "Subject like 'ProxyList for Today' and Status=new and requestor='[email protected]'"|tail -n 1`
ERROR=$?
if [[ $ERROR -eq 0 ]] && [ -n "$TICKET" ]
then
TICKETID=`echo $TICKET | cut -d"/" -f 2 | cut -d " " -f 1 | egrep "[0-9]{5,}"`
if [ -n "$TICKETID" ]
then
echo $TICKETID
ATTACHMENT=`/opt/rt4/bin/rt show ticket/$TICKETID/attachments/ | grep 'application/zip'`
if [ -n "$ATTACHMENT" ]
then
ATTACHMENTID=`echo $ATTACHMENT | cut -d ":" -f 1 | egrep "[0-9]{5,}"`
if [ -n "$TICKETID" ] && [ -n "$ATTACHMENTID" ]
then
echo "$ATTACHMENTID"
/opt/rt4/bin/rt show ticket/$TICKETID/attachments/$ATTACHMENTID/content > /tmp/proxyfile.zip
7z -so x /tmp/proxyfile.zip full_list_nopl/_full_list.txt > /tmp/proxy.txt
echo "127.0.0.1:8123" >> /tmp/proxy.txt
mv /tmp/proxy.txt /var/www/html/upload
if [[ `file -i /var/www/html/upload/proxy.txt | grep 'text/plain; charset=us-ascii'` ]]
then
/opt/rt4/bin/rt resolve $TICKETID
echo "Ticket $TICKETID resolved"
fi
fi
fi
fi
else
echo "No ticket :("
fi
echo "Sleeping 1 hour..."
sleep 3600
done