| Line 27... |
Line 27... |
| 27 |
TMP_SQL="/tmp/log_sql.csv"
|
27 |
TMP_SQL="/tmp/log_sql.csv"
|
| 28 |
TMP_USERS="/tmp/log_users"
|
28 |
TMP_USERS="/tmp/log_users"
|
| 29 |
TMP_HTML="$DIR/log_nf.html"
|
29 |
TMP_HTML="$DIR/log_nf.html"
|
| 30 |
TMP_PDF="$DIR/imputabilities_logs-$(date +%F).pdf"
|
30 |
TMP_PDF="$DIR/imputabilities_logs-$(date +%F).pdf"
|
| 31 |
PASSWD_FILE="/root/ALCASAR-passwords.txt"
|
31 |
PASSWD_FILE="/root/ALCASAR-passwords.txt"
|
| - |
|
32 |
DB_ROOT_PW=$(grep '^db_root=' $PASSWD_FILE | cut -d'=' -f 2-)
|
| 32 |
ARCHIVE_LOCATION="$DIR/imputabilities_logs.zip"
|
33 |
ARCHIVE_LOCATION="$DIR/imputabilities_logs.zip"
|
| 33 |
|
34 |
|
| 34 |
|
35 |
|
| 35 |
if [ $nb_args -eq 1 ]
|
36 |
if [ $nb_args -eq 1 ]
|
| 36 |
then
|
37 |
then
|
| Line 79... |
Line 80... |
| 79 |
rm $ARCHIVE_LOCATION
|
80 |
rm $ARCHIVE_LOCATION
|
| 80 |
fi
|
81 |
fi
|
| 81 |
|
82 |
|
| 82 |
|
83 |
|
| 83 |
#get log information for each users
|
84 |
#get log information for each users
|
| 84 |
mysql -D radius -u root -p$(cat $PASSWD_FILE | grep "root /" | rev | cut -d' ' -f1 | rev) -e "$QUERY"
|
85 |
mysql -u root -p"$DB_ROOT_PW" -D radius -e "$QUERY"
|
| 85 |
|
86 |
|
| 86 |
#Create HTML document which contains every informations about users
|
87 |
#Create HTML document which contains every informations about users
|
| 87 |
echo "<!DOCTYPE html>" > $TMP_HTML
|
88 |
echo "<!DOCTYPE html>" > $TMP_HTML
|
| 88 |
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" >> $TMP_HTML
|
89 |
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" >> $TMP_HTML
|
| 89 |
echo "<TITLE>ALCASAR Report</TITLE>" >> $TMP_HTML
|
90 |
echo "<TITLE>ALCASAR Report</TITLE>" >> $TMP_HTML
|
| Line 155... |
Line 156... |
| 155 |
echo "</body>" >> $TMP_HTML
|
156 |
echo "</body>" >> $TMP_HTML
|
| 156 |
echo "</HTML>" >> $TMP_HTML
|
157 |
echo "</HTML>" >> $TMP_HTML
|
| 157 |
|
158 |
|
| 158 |
#inform users about that by setting the fourth bit of Filter-Id at 1.
|
159 |
#inform users about that by setting the fourth bit of Filter-Id at 1.
|
| 159 |
QUERY="SELECT username from radreply INTO OUTFILE '$TMP_USERS' FIELDS TERMINATED BY ',' ENCLOSED BY '' LINES TERMINATED BY '\n';"
|
160 |
QUERY="SELECT username from radreply INTO OUTFILE '$TMP_USERS' FIELDS TERMINATED BY ',' ENCLOSED BY '' LINES TERMINATED BY '\n';"
|
| 160 |
mysql -D radius -u root -p$(cat $PASSWD_FILE | grep "root /" | rev | cut -d' ' -f1 | rev) -e "$QUERY"
|
161 |
mysql -u root -p"$DB_ROOT_PW" -D radius -e "$QUERY"
|
| 161 |
|
162 |
|
| 162 |
if [ -e $TMP_USERS ] && [ $(cat $TMP_USERS | wc -l) -gt 0 ]
|
163 |
if [ -e $TMP_USERS ] && [ $(cat $TMP_USERS | wc -l) -gt 0 ]
|
| 163 |
then
|
164 |
then
|
| 164 |
for user in $(cat $TMP_USERS)
|
165 |
for user in $(cat $TMP_USERS)
|
| 165 |
do
|
166 |
do
|
| 166 |
QUERY="set @CurrentFilter=(SELECT value from radreply where username='$user');set @CurrentFilterLeft=(SELECT LEFT(@CurrentFilter,3));set @CurrentFilterRight=(SELECT RIGHT(@CurrentFilter,4));UPDATE radreply SET value = CONCAT((@CurrentFilterLeft),'1', (@CurrentFilterRight)) WHERE username='$user' ;"
|
167 |
QUERY="set @CurrentFilter=(SELECT value from radreply where username='$user');set @CurrentFilterLeft=(SELECT LEFT(@CurrentFilter,3));set @CurrentFilterRight=(SELECT RIGHT(@CurrentFilter,4));UPDATE radreply SET value = CONCAT((@CurrentFilterLeft),'1', (@CurrentFilterRight)) WHERE username='$user' ;"
|
| 167 |
mysql -D radius -u root -p$(cat $PASSWD_FILE | grep "root /" | rev | cut -d' ' -f1 | rev) -e "$QUERY"
|
168 |
mysql -u root -p"$DB_ROOT_PW" -D radius -e "$QUERY"
|
| 168 |
done
|
169 |
done
|
| 169 |
fi
|
170 |
fi
|
| 170 |
rm $TMP_USERS
|
171 |
rm $TMP_USERS
|
| 171 |
|
172 |
|
| 172 |
|
173 |
|