will PM you
- Individual Applications
Protect
Filter
Perform
Connect
Add-Ons
- Software Packages
- Complete Appliances
will PM you
The code seems to work great. It generated the files as you said... I have already added several of the files to my filter database. I have done some testing with a pc on the network and it is definitely blocking more ad's than before. I will keep you posted on how it performs during the regular weekly load (Platform scanned 29.39 GB and 3782973 sessions / week).![]()
Nice.. Glad that you like the script..
And it will be nice to see how much more it blocks :P
I've been following along, created the php file (called it export.php) and put it on my web server.
Downloaded easylist.txt file from https://easylist-downloads.adblockplus.org/easylist.txt
Is this the correct file?
I was able to run the PHP file and it created the files ABimport1.json - ABimport9.json
Going to AdBlocker, Settings, Filters, Import and select one of the ABimport files to import, I get the error "Import failed. Settings must be formatted as a JSON Array."
Version of Untangle: Build: 9.2.0~svn20120216r31181release9.2-1lenny
Thanks for your help.
Dougfoot,
Did you open easylist.txt and removed the info lines at the top?
Yes,
I removed the following lines from the top of the easylist.txt file:
[Adblock Plus 1.1]
! Checksum: TfBknpCmvBtG7eKVnCn25A
! ROList and EasyList combination subscription
! Last modified: 25 Mar 2012 12:40 UTC
! Expires: 5 days (update frequency)
! Homepage: http://www.zoso.ro/rolist
!
! *** Fetched from: http://www.zoso.ro/pages/rolist.txt ***
! RO-LIST by MenetZ & Zoso for Adblock Plus (mail@zoso.ro - http://www.zoso.ro/rolist/)
! A more agressive list is here www.zoso.ro/pages/rolist2.txt
!hosts
And you are running Untangle 9.2?
Post the first {} part of your import file.
Looking further into the easylist.txt file I downloaded, it included easylist.txt and easyprivacy.txt.
Once I found the correct file to use, I removed the top lines and ran the php script. The ABimport1.json file would not import.
Comparing the ABimport1.json file to what Untangle exports ala filters.json, the PHP script was leaving the carriage return at the end of the line.
The filters.json file is one long string, where the ABimport1.json is broken up (the carriage return).
I looked at the code, specifically the line "$badcharacters = array("#",'"',"'","[","]","\n","\t");"
I see that you are removing line feeds and tabs ("\n" and "\t"), so thought why not remove the carriage return as well by including "\r" in the list of bad characters.
I changed the line to "$badcharacters = array("#",'"',"'","[","]","\n","\t","\r");" and ran the program.
I am now able to inmport the resulting ABimport files.
Last edited by dougfoot; 03-25-2012 at 10:05 AM.
Glad you got it working..
Hmm strange tho that my easylist.txt don't contains any "carriage returns".
But as you did it is quite easy to manipulate the script to remove bad characters.
I think I know why, it's the source of the easylist.txt file.
I went to https://easylist-downloads.adblockplus.org/easylist.txt to get the file in firefox. I copied the content of the page to a text file and saved it as easylist.txt versus going to the menu, selecting "File", "Safe Page As" and saving the easylist.txt file.
The step I took added the extra carriage returns.