Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 39
  1. #21
    Untangler
    Join Date
    Dec 2011
    Posts
    69

    Default

    will PM you

  2. #22
    Untangler
    Join Date
    Dec 2011
    Posts
    69

    Default

    Quote Originally Posted by WebFooL View Post
    herot,

    Download the easylist.txt and remove all ** lines in the top.

    Then place the php file and the easylist.txt on a PHP web server

    The PHP File:
    PHP Code:
    <?php
    $Content 
    "./easylist.txt"
    $lines file($Content); 
    $linesSplit array_chunk$lines2000 );
    $badcharacters = array("#",'"'"'""[""]""\n""\t"); 

    $i 0;
    foreach (
    $linesSplit as $inner_array) {
        
    $i++;
        
    $fp fopen('ABimport'.$i.'.json''w');    
        
    $filestart "["
        
    fwrite($fp$filestart);
        while (list(
    $key$value) = each($inner_array))
        {    
            
    $cleanstr str_replace($badcharacters""$value);    
        
    $store '{"enabled":true,"string":"'.$cleanstr.'","javaClass":"com.untangle.uvm.node.GenericRule"},'
        
    fwrite($fp$store);
        } 
        
    $fileend "]"
        
    fwrite($fp$fileend);
        
    fclose($fp);
    }
    ?>
    Then go to the php file in a browser and it will generate the Import files in the same catalog as the php and easylist.txt.

    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).

  3. #23
    Untangle Ninja
    WebFooL's Avatar
    Join Date
    Jan 2009
    Location
    Sweden (Eskilstuna)
    Posts
    4,203

    Default

    Nice.. Glad that you like the script..

    And it will be nice to see how much more it blocks :P

  4. #24
    Untangler
    Join Date
    Nov 2011
    Posts
    37

    Default where to download Easylist.txt

    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.

  5. #25
    Untangle Ninja
    WebFooL's Avatar
    Join Date
    Jan 2009
    Location
    Sweden (Eskilstuna)
    Posts
    4,203

    Default

    Dougfoot,

    Did you open easylist.txt and removed the info lines at the top?

  6. #26
    Untangler
    Join Date
    Nov 2011
    Posts
    37

    Default

    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

  7. #27
    Untangle Ninja
    WebFooL's Avatar
    Join Date
    Jan 2009
    Location
    Sweden (Eskilstuna)
    Posts
    4,203

    Default

    And you are running Untangle 9.2?
    Post the first {} part of your import file.

  8. #28
    Untangler
    Join Date
    Nov 2011
    Posts
    37

    Default

    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.

  9. #29
    Untangle Ninja
    WebFooL's Avatar
    Join Date
    Jan 2009
    Location
    Sweden (Eskilstuna)
    Posts
    4,203

    Default

    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.

  10. #30
    Untangler
    Join Date
    Nov 2011
    Posts
    37

    Default

    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.

Page 3 of 4 FirstFirst 1234 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

SEO by vBSEO 3.6.0 PL2