This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
What is Unravel?
Unravel is born to address a problem with the Web Filter addon of Arista NG Firewall (formerly Untangle or Untangle NG).
Untangle it’s a good software, but it cannot import a list of websites from a TXT or CSV file, only from a JSON file in a custom format.
So I created this small utility that generates JSON files ready to be imported in the Web Filter addon.
Configuration
Unravel comes already configured to pickup sites from a text file where every line is “website;description”. In this case you can just skip the configuration.
Otherwise, keep on reading to understand how to configure Unravel through the unravel.ini
file.
[input]
read_pattern="@site@;@description@"
Adapt this settings to match your file. @site@ and @description@ are just placeholders that will be used to write the output.
Be careful to set the right separator. It can be any character but @.
If you don’t have any description just use read_pattern=”@site@” and fix the corresponding setting in the output configuration.
[output]
keys=blocked,flagged,string,javaClass,name,description,readOnly,id,category,enabled
values=@true@,@true@,@site@*,com.untangle.uvm.app.GenericRule,@null@,@description@,@null@,@id_auto_increment@,@null@,@null@
To understand the Output sections, let’s look at an Untangle JSON export:
[
{
"blocked": true,
"flagged": true,
"string": "www.google.it*",
"javaClass": "com.untangle.uvm.app.GenericRule",
"name": null,
"description": "Google Website",
"readOnly": null,
"id": 1,
"category": null,
"enabled": null
},
{
"blocked": true,
"flagged": true,
"string": "www.lipsum.com*",
"javaClass": "com.untangle.uvm.app.GenericRule",
"name": null,
"description": "Dummy Website",
"readOnly": null,
"id": 2,
"category": null,
"enabled": null
}
]
You can easily see that every website is represented by some keys.
Hopefully Unravel just works without any modification. But if for some reason you notice different keys on your Untangle JSON Export, you can easily add or remove keys using the relative setting.
Same logic applies to values= settings.
Be careful to mantain the same order and same number of keys/values.
In values= you can use:
- “Special” values like @true@, @false@, @null@, @id_auto_increment@
- Placeholders specified in the read_pattern, like @site@ and @description@. You can also append some text to the placeholder, like @site@* will add * to every website.
- Whathever text you like
Of course if you removed @description@ from read_pattern, you have to change to @null@ or whatever the relative value.
Usage
Run unravel from a Command Prompt with the following syntax.
Usage: unravel.exe INPUT_FILE [> OUTFILE]
Options:
INPUT_FILE: Name of the file to import sites from.
OUTFILE : Not required. If specified, the output will be written
to OUTFILE rather than being displayed on console.
Examples:
unravel.exe websites.txt
unravel.exe "filename with spaces.txt" > untangle.json
unravel.exe websites.txt > untangle.json
Download
Unravel runs on all modern version of Windows.
v0.3 2024-03-04 – Updated version, should work better. Write me or drop a comment below if you encounter problems.
unravel_0.3.zip - 1295.64 kb
Hi!
I get error (Windows 7 64bit)
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘PhpNetCore, Version=3.0.0.0, Culture=neutral, Publi
cKeyToken=0a8e8c4c76728c71’ or one of its dependencies. The system cannot find the file specified.
at .Run(String[] )
Sorry man, I forgot some dlls when uploading the file! Try now: the unravel.zip should be 864 kb and contain also PhpNetClassLibrary.dll PhpNetCore.dll. Let me know if it works ;)
help please, do i just click the .exe and then it’ll output the file?
Works like a charm! Thanks so much.