Thank you very much for this script! I am using EFW 2.3 and had the same issues as ragr91279. Running the script as:
python ./blacklist_updater.py
worked!
Some research turned up why a python was needed in front of the script. I clicked on the original link and then copied the text into notepad (windows). The dos format puts cr and lf (^M) into the file which causes the program to not run correctly. I went back and right clicked on the link and selected save as, saved the file (did not open in notepad), transferred the file and then
./blacklist_updater.py
worked!!
I trying to run this script to run automatically. I tried to put the script in the /var/cron.minutely (will move it to cron.weekly after testing). It looks like it is working because /var/log/messages is not showing the script exiting error I was getting before (see below)
Job [ -x /bin/run-parts ] && run-parts --report /etc/cron.minutely terminated (exit status: 1)
Oh yea based on the following kb I dropped the .py from the name and put the permissions to 0700:
http://kb.endian.com/entry/43/If I was dreaming I would ask for help putting the code below into your python script. The script adds a date updated to your file and then is read by the html to be displayed on the content filter page.
http://efwsupport.com/index.php?topic=4.15I was able to do the following:
In /home/httpd/cgi-bin/dansguardian.cgi find:
openbox('100%', 'left', _('URL Blacklist: Filter pages known to have content of the following categories.'), "blacklist");
Replace with this:
$output = `cat /etc/dansguardian/blacklists/updated`;
$output = &cleanhtml($output,"y");
openbox('100%', 'left', _("URL Blacklist: Filter pages known to have content of the following categories. Update Date: $output"), "blacklist");
Ended up doing the following in dansguardian.cgi, which worked correctly. I moved the $output lines up a few more lines higher in the file than they recommended, as the output statement did would not work around the get_folding.
get_category("phrase_$cat", _(ucfirst($catname)), $allchecked, \%subcategories, \%conf_phraselist);
$count++;
$output = `cat /etc/dansguardian/blacklists/updated`;
$output = &cleanhtml($output,"y");
}
printf <<EOF
</tr></table></td></tr></table>
%s
%s
EOF
,
get_folding(),
get_folding("BLACKLIST", "start", _("Filter pages known to have content of the following categories. (URL Blacklist) Update Date: $output")),
;
I am not good with scripting and the problem I was having was I can not figure out how to add the following to the python script (don't know if you can mix python and sh script). Perhaps the sh script could be converted to python script:
code that needs to be converted:
#!/bin/sh
date > /etc/dansguardian/blacklists/updated
exit 0
So to be clear, I have been able to get the date updated to display correctly by modifying the dansguardian.cgi file. I can execute the
date > /etc/dansguardian/blacklists/updated
at the # prompt (using putty). And it displays the date properly in the EFW gui. But I can not get date >... code to work correctly in the python script so that the date is updated when the script runs successfully.
Please help! Thanks
p.s.
I am a newbie in regards to scripting and linux so if I am way off base please forgive me in advance.