Page 1 of 3 123 LastLast
Results 1 to 10 of 26
  1. #1
    Newbie
    Join Date
    Jan 2021
    Posts
    5

    Exclamation Anyway to import easy list into untangle?

    Yes the AD Blocker for some reason doesn't work as well as my pihole and Im trying to work with it. I literally get zero blocked ads as I stare at a Comcast ad on CNN..... I would like to not run adblocker extension which does get rid of that very ad.

    Is there anyway to get the best out of this AD Blocker by importing easy list into it? I have tried a script someone posted here but that seems to not work now. Also tried some online txt file to json convertor no dice there either. It seems easy list is pretty big.

    Any help would be appreciated as normal.

  2. #2

  3. #3
    Newbie
    Join Date
    Jan 2021
    Posts
    5

    Default

    Yeah that's the one I tried but it didn't work. Powershell no matter what was throwing errors. Also I don't see where it output the file

    At C:\Users\CaraJean\Downloads\UTJSEasyList.ps1:167 char:21
    + Sign up
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
    At C:\Users\CaraJean\Downloads\UTJSEasyList.ps1:194 char:190
    + ... ata-ga-click="(Logged out) Header, go to Features">Features <span cla ...
    + ~
    The '<' operator is reserved for future use.
    At C:\Users\CaraJean\Downloads\UTJSEasyList.ps1:194 char:266
    + ... p-link-symbol float-right text-normal text-gray-light pr-3">&rarr;</s ...
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
    At C:\Users\CaraJean\Downloads\UTJSEasyList.ps1:196 char:159
    + ... d-block link-gray no-underline f5 Bump-link--hover">Mobile <span cla ...
    + ~
    The '<' operator is reserved for future use.
    At C:\Users\CaraJean\Downloads\UTJSEasyList.ps1:196 char:235
    + ... p-link-symbol float-right text-normal text-gray-light pr-3">&rarr;</s ...
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
    At C:\Users\CaraJean\Downloads\UTJSEasyList.ps1:197 char:170
    + ... d-block link-gray no-underline f5 Bump-link--hover">Actions <span cla ...
    + ~
    The '<' operator is reserved for future use.
    At C:\Users\CaraJean\Downloads\UTJSEasyList.ps1:197 char:246
    + ... p-link-symbol float-right text-normal text-gray-light pr-3">&rarr;</s ...
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
    At C:\Users\CaraJean\Downloads\UTJSEasyList.ps1:198 char:176
    + ... lock link-gray no-underline f5 Bump-link--hover">Codespaces <span cla ...
    + ~
    The '<' operator is reserved for future use.
    At C:\Users\CaraJean\Downloads\UTJSEasyList.ps1:198 char:252
    + ... p-link-symbol float-right text-normal text-gray-light pr-3">&rarr;</s ...
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
    At C:\Users\CaraJean\Downloads\UTJSEasyList.ps1:199 char:172
    + ... -block link-gray no-underline f5 Bump-link--hover">Packages <span cla ...
    + ~
    The '<' operator is reserved for future use.
    Not all parse errors were reported. Correct the reported errors and try again.
    + CategoryInfo : ParserError: ( [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : AmpersandNotAllowed

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

    Default

    I'll take a look and see whats wrong.

  5. #5
    Newbie
    Join Date
    Jan 2021
    Posts
    5

    Default

    Quote Originally Posted by WebFooL View Post
    I'll take a look and see whats wrong.
    Thank You! I appreciate you for doing this.

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

    Default

    Looks to run fine at my end.
    The scripts complains on line 167 at your end but there is only 42 lines in the script..
    Do you have a print screen of your powershell windows?

    And try running it in Powershell_ISE

  7. #7

  8. #8
    Newbie
    Join Date
    Jan 2021
    Posts
    5

    Default

    Quote Originally Posted by WebFooL View Post
    Try importing this file:
    I think that will work except the page keeps going unresponsive when I go to save the import... Is this normal? I clicked replace what was there.

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

    Default

    They might have added a limit on the import size.
    I can modify so it creates multiple smaller files.

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

    Default

    Try this (see code below) it should create import files with 5000 lines en each file.
    Importing the first file and relpace current settings.
    Next number of files append.

    Hit save between every time.


    Code:
    ##
    ## Script Create by WebFooL for The Untangle Community
    ##
    $easylistsource = "https://easylist.to/easylist/easylist.txt"
    $Request = Invoke-WebRequest $easylistsource
    $EasyList = $Request.Content
    $filenamejson = "ADImport.json"
    $filenamecsv = "ADImport.csv"
    $easylistsourcecount=($EasyList | Measure-Object –Line).Lines
    $hash = $null
    $counter = 0
    $hash = @'
    string,blocked,javaClass,markedForNew,markedForDelete,enabled
    
    
    '@
    
    
    write-host "Will now work for a while do not panic!"
    ForEach ($line in $($EasyList -split "`n"))
    {
    #Add Nice Progress bar.. 
    Write-Progress -Activity "Processing Easylist" -CurrentOperation $line -PercentComplete (($counter / $easylistsourcecount) * 100)
        #Remove all Commented lines (They all start with !)
        if($line -clike '!*') {
        #Do Nothing
        } elseif($line -eq "[Adblock Plus 2.0]"){
        #Do Nothing
        }elseif($line -eq ""){
        #Do Nothing
        }else {
            #Create Untangle JSON
            $hash += "$line,true,com.untangle.uvm.app.GenericRule,true,false,true`r`n"
            $counter++
        }    
    }
    #Tempstore as CSV
    $hash | Set-Content -Path $filenamecsv
    
    
    function Split-CsvFile {
        param (
            [string]$sourceCSV,
            [int]$size
        )
    
    
        $exportPath = $sourceCSV.Substring(0, $sourceCSV.LastIndexOf('.'))
        $count = (Import-Csv $sourceCSV).count
        $startrow = 0;
        $counter  = 1;
    
    
        while ($startrow -lt $count) {
            $filename = "$($exportPath)_$($counter)"
            Write-host "Filename:" $filename
            Import-CSV $sourceCSV | select-object -skip $startrow -first $size | Export-CSV "$filename.csv" -NoClobber -Encoding UTF8 -NoTypeInformation
            #Convert to Json
            import-csv "$filename.csv" | ConvertTo-Json -Compress | Set-Content -Path "$filename.json"
            if (Test-Path "$filename.csv") {
              Remove-Item "$filename.csv"
            }
            $startrow += $size
            $counter++
        }
    }
    
    
    Split-CsvFile -sourceCSV $filenamecsv -size 5000 
    #import-csv $filenamecsv | ConvertTo-Json -Compress | Set-Content -Path $filenamejson
    #Count lines in the CSV
    $numberoflines = (Import-Csv $filenamecsv | Measure-Object -Property string).Count
    #Write friendly exit message
    Write-Host "Done you now have a few $filenamejson with $numberoflines lines from $easylistsource"

Page 1 of 3 123 LastLast

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