script to migrate config into netguard #2288
t-j-b
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
|
@t-j-b I can't even put a rethink config file as input for the script |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I made a script to import the Rethink configurations into Netguard: per-app allow/deny and domain+ip whitelists. This lets you test whether you have a configuration issue or a Rethink bug (Motivated by #2243). Although you can set apps to isolate (i.e. whitelist-only), those apps where you actually need that will unfortunately not work: A handful of domains of in the Rethink settings will become pages and pages of RARP domains in the Netguard settings. Some (simpler) whitelist-only apps will work after you clear their caches in the Android settings.
I did it step-by-step with the help of Chatgpt, here is its summary prompt:
🔧 GOAL
Generate a fully importable NetGuard XML configuration file that reproduces the behavior defined by RethinkDNS SQLite exports, while preserving and integrating any existing manual NetGuard edits.
🧩 INPUT FILES
All RethinkDNS exports come from SQLite
SELECTstatements with known column order:App list
Domain exceptions
IP exceptions
Notes:
gapps-andnogapps-variants; both must be processed.⚙️ SEMANTIC MAPPING (Rethink → NetGuard)
App-level behavior
firewallStatusconnectionStatus2 = bypass_global/3 = bypass_vpn<application>entries →wifi=1 mobile=1 screen_off=15 = filter_by_network_type1wifi=0 mobile=1, plus entries under<screen_wifi>and<screen_other>5 = filter_by_network_type2wifi=1 mobile=0, plus<screen_*>entries5 = filter_by_network_type3wifi=1 mobile=1, plus<screen_*>entries4 = whitelist_only<wifi>/<mobile>entry unless app is whitelisted exception<application>entriesPersistent exceptions (always allowed even if “whitelist_only”)
→ These apps always get
wifi=1 mobile=1 screen_off=1.🌐 DOMAIN & IP EXCEPTIONS
Domain rules (
status)status<rule block="0" dport="0"><rule block="1" dport="0">block="1" dport="0")IP rules (
ruleType)ruleType<rule block="0" dport="0">All rules get:
📁 STRUCTURAL REQUIREMENTS (NetGuard XML)
Start from an existing NetGuard export (to preserve the
<application>and<settings>structure).Update or append sections:
<wifi>,<mobile>,<screen_wifi>,<screen_other>for app-level permissions<filter>for domain/IP rules<notify>: all entries’value="false"(no connection notifications)Preserve any preexisting manual edits or custom rules (e.g., AusweisApp2).
Maintain valid XML header:
Ensure import works (no illegal attributes, integers only where expected, e.g. no “2-65535”).
🧮 MERGING LOGIC
gapps-*andnogapps-*sources.packageName,domain,block,dport).<rule>elements from the NetGuard base file.pkg, thendaddr.<filter>entries.🔕 NOTIFICATION SETTINGS
If
<notify>exists → set all:If absent → create an empty
<notify/>.🧠 OUTPUT RULES
netguard_config.xml(or_final.xml/_silent.xmlvariants).2-65535→ invalid).✅ CHECKLIST FOR COMPLETION
Before delivering:
<filter>.rethink-to-netguard.py
Beta Was this translation helpful? Give feedback.
All reactions