├── .gitignore ├── LICENSE ├── README.md ├── dnsminder-new.png ├── dnsminder.png └── dnsminder ├── .deb └── jammy │ ├── dnsminder_0.0.18-0ubuntu1_all.deb │ └── dnsminder_0.0.18-0ubuntu1_all │ ├── DEBIAN │ ├── control │ ├── postinst │ └── postrm │ └── usr │ ├── bin │ └── dnsminder │ └── share │ ├── applications │ └── dnsminder.desktop │ ├── doc │ └── dnsminder │ │ ├── changelog.tar.xz │ │ └── copyright │ ├── icons │ └── hicolor │ │ ├── 128x128 │ │ └── apps │ │ │ └── dnsminder.png │ │ ├── 16x16 │ │ └── apps │ │ │ └── dnsminder.png │ │ ├── 22x22 │ │ └── apps │ │ │ └── dnsminder.png │ │ ├── 256x256 │ │ └── apps │ │ │ └── dnsminder.png │ │ ├── 32x32 │ │ └── apps │ │ │ └── dnsminder.png │ │ ├── 48x48 │ │ └── apps │ │ │ └── dnsminder.png │ │ └── 64x64 │ │ └── apps │ │ └── dnsminder.png │ ├── menu │ └── dnsminder │ └── pixmaps │ └── dnsminder.png ├── .directory ├── .gitignore ├── .hidden ├── CHANGELOG ├── postinst └── postrm ├── .icon.png ├── .project ├── .src ├── FMain.class └── FMain.form ├── .zenity ├── deb │ ├── focal │ │ ├── dnsminder_0.0.1_all.deb │ │ ├── dnsminder_0.0.2_all.deb │ │ ├── dnsminder_0.0.3_all.deb │ │ └── dnsminder_0.0.3_all │ │ │ ├── DEBIAN │ │ │ ├── control │ │ │ └── postinst │ │ │ └── usr │ │ │ ├── bin │ │ │ └── dnsminder │ │ │ └── share │ │ │ ├── applications │ │ │ └── dnsminder.desktop │ │ │ ├── doc │ │ │ └── dnsminder │ │ │ │ ├── changelog.tar.xz │ │ │ │ └── copyright │ │ │ └── pixmaps │ │ │ └── dnsminder.png │ └── jammy │ │ ├── dnsminder_0.0.6_all.deb │ │ └── dnsminder_0.0.6_all │ │ ├── DEBIAN │ │ ├── control │ │ ├── postinst │ │ └── postrm │ │ └── usr │ │ ├── bin │ │ └── dnsminder │ │ └── share │ │ ├── applications │ │ └── dnsminder.desktop │ │ ├── doc │ │ └── dnsminder │ │ │ ├── changelog.tar.xz │ │ │ └── copyright │ │ └── pixmaps │ │ └── dnsminder.png └── release │ ├── focal │ └── dnsminder │ └── jammy │ └── dnsminder ├── dnsminder.png ├── info.png ├── off.png └── on.png /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .idea 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Jereme Hancock 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

DNS Minder

2 | 3 | 4 | 5 | This simple GUI allows you to easily set up your system's DNS to use [CleanBrowsing](https://cleanbrowsing.org), [OpenDNS FamilyShield](https://www.opendns.com/setupguide/#familyshield), [1.1.1.1 for Families](https://blog.cloudflare.com/introducing-1-1-1-1-for-families/), or [AdGuard Family DNS](https://adguard-dns.io/en/public-dns.html). 6 | 7 | ## Built for UbuntuCE: 8 | 9 | ### [Check out UbuntuCE](https://ubuntuce.com/) 10 | 11 | ## Disclaimer 12 | 13 | All code is provided as-is without any warranty. 14 | -------------------------------------------------------------------------------- /dnsminder-new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder-new.png -------------------------------------------------------------------------------- /dnsminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder.png -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all.deb -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: dnsminder 2 | Version: 0.0.18-0ubuntu1 3 | Architecture: all 4 | Maintainer: Jereme Hancock 5 | Installed-Size: 119 6 | Depends: gambas3-runtime (>= 3.16), gambas3-runtime (<< 3.99.0), gambas3-gb-image (>= 3.16), gambas3-gb-image (<< 3.99.0), gambas3-gb-form (>= 3.16), gambas3-gb-form (<< 3.99.0), gambas3-gb-term (>= 3.16), gambas3-gb-term (<< 3.99.0), gambas3-gb-form-terminal (>= 3.16), gambas3-gb-form-terminal (<< 3.99.0), gambas3-gb-gtk3-x11, gambas3-gb-gtk3-wayland, gambas3-gb-gui, gambas3-gb-jit, resolvconf 7 | Section: contrib/utils 8 | Priority: optional 9 | Description: Web Content Filtering 10 | -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/DEBIAN/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | # Automatically added by dh_installmenu/13.6ubuntu1 4 | if [ "$1" = "configure" ] && [ -x "`command -v update-menus`" ]; then 5 | update-menus 6 | fi 7 | # End automatically added section 8 | 9 | exit 0 10 | -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/DEBIAN/postrm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | # Automatically added by dh_installmenu/13.6ubuntu1 5 | if [ -x "`command -v update-menus`" ]; then update-menus ; fi 6 | # End automatically added section 7 | 8 | if [ "$1" = "remove" ]; then 9 | sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head 10 | resolvconf -u 11 | systemctl disable --now resolvconf.service 12 | nmcli networking off 13 | nmcli networking on 14 | fi 15 | 16 | exit 0 17 | -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/bin/dnsminder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/bin/dnsminder -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/applications/dnsminder.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Name=DNS Minder 4 | Comment=Web Content Filtering 5 | Exec=dnsminder 6 | Icon=dnsminder 7 | Terminal=false 8 | Type=Application 9 | StartupNotify=true 10 | Categories=System; 11 | -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/doc/dnsminder/changelog.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/doc/dnsminder/changelog.tar.xz -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/doc/dnsminder/copyright: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Jereme Hancock 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/128x128/apps/dnsminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/128x128/apps/dnsminder.png -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/16x16/apps/dnsminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/16x16/apps/dnsminder.png -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/22x22/apps/dnsminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/22x22/apps/dnsminder.png -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/256x256/apps/dnsminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/256x256/apps/dnsminder.png -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/32x32/apps/dnsminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/32x32/apps/dnsminder.png -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/48x48/apps/dnsminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/48x48/apps/dnsminder.png -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/64x64/apps/dnsminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/icons/hicolor/64x64/apps/dnsminder.png -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/menu/dnsminder: -------------------------------------------------------------------------------- 1 | ?package(dnsminder):needs="X11" section="Applications/System/Administration"\ 2 | title="DNS Minder"\ 3 | command="/usr/bin/dnsminder"\ 4 | icon="/usr/share/pixmaps/dnsminder.png" 5 | -------------------------------------------------------------------------------- /dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/pixmaps/dnsminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.deb/jammy/dnsminder_0.0.18-0ubuntu1_all/usr/share/pixmaps/dnsminder.png -------------------------------------------------------------------------------- /dnsminder/.directory: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Icon=./.icon.png 3 | -------------------------------------------------------------------------------- /dnsminder/.gitignore: -------------------------------------------------------------------------------- 1 | #---- Gambas files to ignore (v5) 2 | *.gambas 3 | .lock 4 | *~ 5 | core 6 | core.* 7 | vgcore 8 | vgcore.* 9 | .kdbg* 10 | .*.prof 11 | .lang/*.pot 12 | .gambas/* 13 | .settings 14 | .startup 15 | .list 16 | .info 17 | #---- 18 | -------------------------------------------------------------------------------- /dnsminder/.hidden/CHANGELOG: -------------------------------------------------------------------------------- 1 | * Thu Jun 02 2022 Jereme Hancock 0.0.7 2 | - Version bump 3 | 4 | * Thu Jun 02 2022 Jereme Hancock 0.0.3 5 | - Updated interface 6 | 7 | * Wed Jun 01 2022 Jereme Hancock 0.0.1 8 | - Initial Test 9 | 10 | -------------------------------------------------------------------------------- /dnsminder/.hidden/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | systemctl enable --now resolvconf.service 4 | 5 | DEFAULTS="nameserver 185.228.168.168 6 | nameserver 185.228.169.168" 7 | 8 | sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head 9 | echo "$DEFAULTS" | tee -a /etc/resolvconf/resolv.conf.d/head 10 | 11 | resolvconf -u 12 | nmcli networking off 13 | nmcli networking on 14 | 15 | exit 0 16 | -------------------------------------------------------------------------------- /dnsminder/.hidden/postrm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head 4 | resolvconf -u 5 | systemctl disable --now resolvconf.service 6 | nmcli networking off 7 | nmcli networking on 8 | 9 | exit 0 10 | -------------------------------------------------------------------------------- /dnsminder/.icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.icon.png -------------------------------------------------------------------------------- /dnsminder/.project: -------------------------------------------------------------------------------- 1 | # Gambas Project File 3.0 2 | Title=DNS Minder 3 | Startup=FMain 4 | Icon=dnsminder.png 5 | Version=0.0.13 6 | Component=gb.image 7 | Component=gb.gui 8 | Component=gb.form 9 | Component=gb.term 10 | Component=gb.form.terminal 11 | Description="Web Content Filtering" 12 | TabSize=2 13 | Translate=1 14 | Language=en_US 15 | Maintainer=Jereme Hancock 16 | Address=support@ubuntuce.com 17 | Url=ubuntuce.com 18 | License=General Public License 19 | PackageName=dnsminder-0.0.7 20 | Packager=1 21 | Systems=ubuntu 22 | Menus=ubuntu:"Applications/System/Administration" 23 | Categories=ubuntu:"System" 24 | Groups=ubuntu:"utils" 25 | ExtraDependencies=ubuntu:"gambas3-gb-gtk3-x11\t\t\ngambas3-gb-gtk3-wayland\t\t\ngambas3-gb-gui\t\t\ngambas3-gb-form\t\t\ngambas3-gb-jit\t\t\nresolvconf\t\t" 26 | -------------------------------------------------------------------------------- /dnsminder/.src/FMain.class: -------------------------------------------------------------------------------- 1 | ' Gambas class file 2 | 3 | Public Sub Form_Open() 4 | 5 | status_check() 6 | provider_check() 7 | 8 | End 9 | 10 | Function status_check() As Boolean 11 | 12 | Dim Result As String 13 | 14 | Result = get_provider() 15 | 16 | If InStr(Result, "185.228.168.168") = 1 Or If InStr(Result, "185.228.169.168") = 1 Or If InStr(Result, "208.67.222.123") = 1 Or If InStr(Result, "208.67.220.123") = 1 Or If InStr(Result, "1.1.1.3") = 1 Or If InStr(Result, "1.0.0.3") = 1 Or If InStr(Result, "94.140.14.15") = 1 Or If InStr(Result, "94.140.15.16") = 1 Then 17 | ProvidersPanel.Enabled = True 18 | Status.Text = "ON" 19 | Status.Foreground = Color.DarkGreen 20 | OnButton.Show 21 | OnButton.Enabled = True 22 | OffButton.Hide 23 | Else 24 | ProvidersPanel.Enabled = False 25 | Status.Text = "OFF" 26 | Status.Foreground = Color.Red 27 | OnButton.Hide 28 | OffButton.Show 29 | OffButton.Enabled = True 30 | Endif 31 | 32 | End 33 | 34 | Function get_provider() As String 35 | 36 | Dim Result As String 37 | 38 | Shell ("resolvectl status | grep 'Current DNS Server:' | awk '{print $4}'") To Result 39 | 40 | Return Result 41 | 42 | End 43 | 44 | Sub provider_check() 45 | 46 | Dim Result As String 47 | 48 | Result = get_provider() 49 | 50 | If InStr(Result, "185.228.168.168") = 1 Then 51 | CleanBrowsing.Value = True 52 | Else 53 | CleanBrowsing.Value = False 54 | Endif 55 | 56 | If InStr(Result, "185.228.169.168") = 1 Then 57 | CleanBrowsing.Value = True 58 | Else 59 | CleanBrowsing.Value = False 60 | Endif 61 | 62 | If InStr(Result, "208.67.222.123") = 1 Then 63 | OpenDNS.Value = True 64 | Else 65 | OpenDNS.Value = False 66 | Endif 67 | 68 | If InStr(Result, "208.67.220.123") = 1 Then 69 | OpenDNS.Value = True 70 | Else 71 | OpenDNS.Value = False 72 | Endif 73 | 74 | If InStr(Result, "1.1.1.3") = 1 Then 75 | CloudFlare.Value = True 76 | Else 77 | CloudFlare.Value = False 78 | Endif 79 | 80 | If InStr(Result, "1.0.0.3") = 1 Then 81 | CloudFlare.Value = True 82 | Else 83 | CloudFlare.Value = False 84 | Endif 85 | 86 | If InStr(Result, "94.140.14.15") = 1 Then 87 | AdGuard.Value = True 88 | Else 89 | AdGuard.Value = False 90 | Endif 91 | 92 | If InStr(Result, "94.140.15.16") = 1 Then 93 | AdGuard.Value = True 94 | Else 95 | AdGuard.Value = False 96 | Endif 97 | 98 | End 99 | 100 | Sub enable(provider As String, Optional providerTitle As String) 101 | 102 | Dim EnableProcess As Process 103 | 104 | Dim DNS1 As String 105 | Dim DNS2 As String 106 | 107 | Dim MessageString As String 108 | 109 | If provider = "CleanBrowsing" Then 110 | DNS1 = "nameserver 185.228.168.168" 111 | DNS2 = "nameserver 185.228.169.168" 112 | Else If provider = "OpenDNS" Then 113 | DNS1 = "nameserver 208.67.222.123" 114 | DNS2 = "nameserver 208.67.220.123" 115 | Else If provider = "CloudFlare" Then 116 | DNS1 = "nameserver 1.1.1.3" 117 | DNS2 = "nameserver 1.0.0.3" 118 | Else If provider = "AdGuard" Then 119 | DNS1 = "nameserver 94.140.14.15" 120 | DNS2 = "nameserver 94.140.15.16" 121 | Endif 122 | 123 | If providerTitle Then 124 | MessageString = "\nAre you sure you want to enable " & providerTitle & "?" 125 | Else 126 | MessageString = "\nAre you sure?" 127 | Endif 128 | 129 | If Message.Question(MessageString) = 1 Then 130 | If providerTitle Then 131 | ProgressBar.Show 132 | OffSpinner.Hide 133 | Else 134 | ProgressBar.Hide 135 | OffSpinner.Show 136 | OffSpinner.Start 137 | Endif 138 | ProvidersPanel.Enabled = False 139 | OnButton.Enabled = False 140 | OffButton.Enabled = False 141 | EnableProcess = TerminalView.Shell("pkexec sh -c 'systemctl enable --now resolvconf.service && sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head && echo " & DNS1 & " >> /etc/resolvconf/resolv.conf.d/head && echo " & DNS2 & " >> /etc/resolvconf/resolv.conf.d/head && resolvconf -u && nmcli networking off && nmcli networking on'") 142 | 143 | Do 144 | Try Wait 0.5 145 | Loop Until EnableProcess.State = 0 146 | 147 | EnableProcess = Null 148 | 149 | status_check() 150 | provider_check() 151 | ProgressBar.Hide 152 | OffSpinner.Stop 153 | OffSpinner.Hide 154 | OnButton.Enabled = True 155 | OffButton.Enabled = True 156 | 157 | Endif 158 | 159 | End 160 | 161 | Sub disable() 162 | 163 | Dim DisableProcess As Process 164 | 165 | If Message.Question("\nAre you sure?") = 1 Then 166 | OnSpinner.Show 167 | OnSpinner.Start 168 | ProvidersPanel.Enabled = False 169 | OnButton.Enabled = False 170 | DisableProcess = TerminalView.Shell("pkexec sh -c 'sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head && resolvconf -u && systemctl disable --now resolvconf.service && nmcli networking off && nmcli networking on'") 171 | 172 | Do 173 | Try Wait 0.5 174 | Loop Until DisableProcess.State = 0 175 | 176 | DisableProcess = Null 177 | 178 | status_check() 179 | provider_check() 180 | OnSpinner.Stop 181 | OnSpinner.Hide 182 | 183 | Endif 184 | 185 | End 186 | 187 | Public Sub DisableButton_Click() 188 | 189 | disable() 190 | 191 | End 192 | 193 | Public Sub EnableButton_Click() 194 | 195 | enable("CleanBrowsing") 196 | 197 | End 198 | 199 | Public Sub CleanBrowsing_MouseDown() 200 | 201 | If CleanBrowsing.Value == False Then 202 | enable("CleanBrowsing", "CleanBrowsing") 203 | Endif 204 | 205 | End 206 | 207 | Public Sub OpenDNS_MouseDown() 208 | 209 | If OpenDNS.Value == False Then 210 | enable("OpenDNS", "OpenDNS FamilyShield") 211 | Endif 212 | 213 | End 214 | 215 | Public Sub CloudFlare_MouseDown() 216 | 217 | If CloudFlare.Value == False Then 218 | enable("CloudFlare", "1.1.1.1. for Families") 219 | Endif 220 | 221 | End 222 | 223 | Public Sub AdGuard_MouseDown() 224 | 225 | If AdGuard.Value == False Then 226 | enable("AdGuard", "AdGuard Family DNS") 227 | Endif 228 | 229 | End 230 | 231 | Public Sub LearnMore_Click() 232 | 233 | Shell "xdg-open 'https://github.com/jeremehancock/dnsminder'" 234 | 235 | End 236 | 237 | Public Sub CleanBrowsingInfo_MouseDown() 238 | 239 | Shell "xdg-open 'https://cleanbrowsing.org/'" 240 | 241 | End 242 | 243 | Public Sub CleanBrowsingInfo2_MouseDown() 244 | 245 | Shell "xdg-open 'https://www.opendns.com/setupguide/#familyshield'" 246 | 247 | End 248 | 249 | Public Sub CleanBrowsingInfo3_MouseDown() 250 | 251 | Shell "xdg-open 'https://blog.cloudflare.com/introducing-1-1-1-1-for-families/'" 252 | 253 | End 254 | 255 | Public Sub CleanBrowsingInfo4_MouseDown() 256 | 257 | Shell "xdg-open 'https://adguard-dns.io/en/public-dns.html'" 258 | 259 | End 260 | 261 | Public Sub OffButton_MouseDown() 262 | 263 | enable("CleanBrowsing") 264 | 265 | End 266 | 267 | Public Sub OnButton_MouseDown() 268 | 269 | disable() 270 | 271 | End 272 | -------------------------------------------------------------------------------- /dnsminder/.src/FMain.form: -------------------------------------------------------------------------------- 1 | # Gambas Form File 3.0 2 | 3 | { Form Form 4 | MoveScaled(0,0,50,49) 5 | Utility = True 6 | { CurrentProvider Label 7 | MoveScaled(2,12,26,4) 8 | Font = Font["+2"] 9 | Text = ("Current Provider") 10 | } 11 | { ProvidersPanel Panel 12 | MoveScaled(2,16,46,22) 13 | Border = Border.Plain 14 | { AdGuard RadioButton 15 | MoveScaled(5,17,22,2.625) 16 | Mouse = Mouse.Pointing 17 | Text = ("AdGuard Family DNS") 18 | } 19 | { CleanBrowsing RadioButton 20 | MoveScaled(5,2,17,2.625) 21 | Mouse = Mouse.Pointing 22 | Text = ("CleanBrowsing") 23 | Value = True 24 | } 25 | { CleanBrowsingInfo2 PictureBox 26 | MoveScaled(1,7,2.625,2.625) 27 | Mouse = Mouse.Pointing 28 | ToolTip = ("Learn More") 29 | Picture = Picture["info.png"] 30 | Stretch = True 31 | } 32 | { CleanBrowsingInfo3 PictureBox 33 | MoveScaled(1,12,2.625,2.625) 34 | Mouse = Mouse.Pointing 35 | ToolTip = ("Learn More") 36 | Picture = Picture["info.png"] 37 | Stretch = True 38 | } 39 | { CleanBrowsingInfo4 PictureBox 40 | MoveScaled(1,17,2.625,2.625) 41 | Mouse = Mouse.Pointing 42 | ToolTip = ("Learn More") 43 | Picture = Picture["info.png"] 44 | Stretch = True 45 | } 46 | { CloudFlare RadioButton 47 | MoveScaled(5,12,21,2.625) 48 | Mouse = Mouse.Pointing 49 | Text = ("1.1.1.1 for Families") 50 | } 51 | { OpenDNS RadioButton 52 | MoveScaled(5,7,24,2.625) 53 | Mouse = Mouse.Pointing 54 | Text = ("OpenDNS FamilyShield") 55 | } 56 | { CleanBrowsingInfo PictureBox 57 | MoveScaled(1,2,2.625,2.625) 58 | Mouse = Mouse.Pointing 59 | ToolTip = ("Learn More") 60 | Picture = Picture["info.png"] 61 | Stretch = True 62 | } 63 | } 64 | { TerminalView TerminalView 65 | MoveScaled(2,1,16,3) 66 | Visible = False 67 | } 68 | { StatusLabel Label 69 | MoveScaled(2,5,11,3) 70 | Font = Font["+4"] 71 | Text = ("Status:") 72 | } 73 | { Status Label 74 | MoveScaled(13,5,12,3) 75 | Font = Font["+4"] 76 | } 77 | { LearnMore Button 78 | MoveScaled(2,42,14,4) 79 | Mouse = Mouse.Pointing 80 | Text = ("Learn More") 81 | } 82 | { DNSMinderLogo PictureBox 83 | MoveScaled(36,2,11.875,11.875) 84 | Picture = Picture["dnsminder.png"] 85 | Stretch = True 86 | } 87 | { OnButton PictureBox 88 | MoveScaled(38,42,10,4.5) 89 | Visible = False 90 | Mouse = Mouse.Pointing 91 | ToolTip = ("Turn OFF") 92 | Picture = Picture["on.png"] 93 | Stretch = True 94 | } 95 | { OffButton PictureBox 96 | MoveScaled(38,42,10,4.5) 97 | Mouse = Mouse.Pointing 98 | ToolTip = ("Turn ON") 99 | Picture = Picture["off.png"] 100 | Stretch = True 101 | } 102 | { OffSpinner Spinner 103 | MoveScaled(39,42.75,3,3) 104 | Visible = False 105 | Type = Spinner.Circle 106 | } 107 | { OnSpinner Spinner 108 | MoveScaled(44,42.75,3,3) 109 | Visible = False 110 | Type = Spinner.Circle 111 | } 112 | { ProgressBar ProgressBar 113 | MoveScaled(-1,48,51,1) 114 | Visible = False 115 | Label = False 116 | Border = False 117 | Pulse = True 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/focal/dnsminder_0.0.1_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.zenity/deb/focal/dnsminder_0.0.1_all.deb -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/focal/dnsminder_0.0.2_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.zenity/deb/focal/dnsminder_0.0.2_all.deb -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/focal/dnsminder_0.0.3_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.zenity/deb/focal/dnsminder_0.0.3_all.deb -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/focal/dnsminder_0.0.3_all/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: dnsminder 2 | Version: 0.0.3 3 | Section: web 4 | Priority: optional 5 | Architecture: all 6 | Maintainer: Jereme Hancock 7 | Installed-Size: 51.7 8 | Depends: zenity, resolvconf 9 | Description: DNS Minder 10 | 11 | -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/focal/dnsminder_0.0.3_all/DEBIAN/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | systemctl enable --now resolvconf.service 4 | 5 | exit 0 6 | -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/focal/dnsminder_0.0.3_all/usr/bin/dnsminder: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2021 Jereme Hancock 3 | 4 | # MIT License 5 | 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | 24 | APP_TITLE="DNS Minder" 25 | 26 | check_status() { 27 | DNS=$(systemd-resolve --status | grep "Current DNS Server:" | awk '{print $4}') 28 | if [[ $DNS == "185.228.168.168"* ]] || [[ $DNS == "185.228.169.168"* ]] || [[ $DNS == "208.67.222.123"* ]] || [[ $DNS == "208.67.220.123"* ]] || [[ $DNS == "1.1.1.3"* ]] || [[ $DNS == "1.0.0.3"* ]] 29 | then 30 | echo "ON" 31 | else 32 | echo "OFF" 33 | fi 34 | } 35 | 36 | get_toggle() { 37 | STATUS=$(check_status) 38 | if [[ $STATUS == *"ON"* ]] 39 | then 40 | echo "OFF" 41 | else 42 | echo "ON" 43 | fi 44 | } 45 | 46 | get_status_color() { 47 | STATUS=$(check_status) 48 | if [[ $STATUS == *"ON"* ]] 49 | then 50 | echo "#228B22" 51 | else 52 | echo "#CC0000" 53 | fi 54 | } 55 | 56 | get_provider() { 57 | PROVIDER=$(systemd-resolve --status | grep "Current DNS Server:" | awk '{print $4}') 58 | if [[ $PROVIDER == "185.228.168.168"* ]] || [[ $PROVIDER == "185.228.169.168"* ]] 59 | then 60 | echo "CleanBrowsing" 61 | elif [[ $PROVIDER == "208.67.222.123"* ]] || [[ $PROVIDER == "208.67.220.123"* ]] 62 | then 63 | echo "OpenDNS FamilyShield" 64 | elif [[ $PROVIDER == "1.1.1.3"* ]] || [[ $PROVIDER == "1.0.0.3"* ]] 65 | then 66 | echo "1.1.1.1 for Families" 67 | else 68 | echo "None" 69 | fi 70 | } 71 | 72 | settings() { 73 | STATUS=$(check_status) 74 | STATUS_COLOR=$(get_status_color) 75 | TOGGLE=$(get_toggle) 76 | PROVIDER=$(get_provider) 77 | 78 | if [[ $STATUS == "ON" ]] 79 | then 80 | UPDATE="Change Provider" 81 | HELP="What's DNS Minder?" 82 | else 83 | UPDATE="What's DNS Minder?" 84 | HELP="" 85 | fi 86 | 87 | SWITCH=$(zenity --window-icon=/usr/share/pixmaps/dnsminder.png --list --title="$APP_TITLE: Settings" --width=400 --height=275 --text="Status: $STATUS\n\nCurrent Provider: $PROVIDER\n" --column= --hide-header "Turn $TOGGLE" "$UPDATE" "$HELP") 88 | case $SWITCH in 89 | 90 | "Turn ON") 91 | select_provider fresh 92 | ;; 93 | 94 | "Turn OFF") 95 | revert_dns 96 | ;; 97 | 98 | "Change Provider") 99 | select_provider 100 | ;; 101 | 102 | "What's DNS Minder?") 103 | xdg-open "https://github.com/jeremehancock/dnsminder#readme" 104 | settings 105 | ;; 106 | 107 | *) 108 | exit 1 109 | ;; 110 | esac 111 | } 112 | 113 | select_provider() { 114 | if [[ $1 == "fresh" ]] 115 | then 116 | zenity --window-icon=/usr/share/pixmaps/dnsminder.png --info --title "$APP_TITLE" --width=450 --text $"\nThis tool will be modifying your network settings.\n\nIt will be making changes to your system and should be USED AT YOUR OWN RISK!\n\nIt is recommended that you have system backups." 117 | fi 118 | STATUS=$(check_status) 119 | STATUS_COLOR=$(get_status_color) 120 | PROVIDER=$(get_provider) 121 | SELECT=$(zenity --window-icon=/usr/share/pixmaps/dnsminder.png --list --radiolist --title="$APP_TITLE: Settings" --width=400 --height=275 --text="Status: $STATUS\n\nCurrent Provider: $PROVIDER\n\nSelect Provider" --column "" --column "" --hide-header FALSE CleanBrowsing FALSE "OpenDNS FamilyShield" FALSE "1.1.1.1 for Families") 122 | case $SELECT in 123 | 124 | "CleanBrowsing") 125 | update_dns CleanBrowsing 126 | ;; 127 | 128 | "OpenDNS FamilyShield") 129 | update_dns "OpenDNS FamilyShield" 130 | ;; 131 | 132 | "1.1.1.1 for Families") 133 | update_dns "1.1.1.1 for Families" 134 | ;; 135 | 136 | *) 137 | settings 138 | ;; 139 | esac 140 | } 141 | 142 | confirm() { 143 | if 144 | zenity --window-icon=/usr/share/pixmaps/dnsminder.png --question --title "$APP_TITLE" --no-wrap --text="\nAre you sure?" 145 | then 146 | return 147 | else 148 | settings 149 | fi 150 | } 151 | 152 | general_failure() { 153 | zenity --window-icon=/usr/share/pixmaps/dnsminder.png --error --title "$APP_TITLE" --no-wrap --text="\nSomething went wrong!" 154 | } 155 | 156 | update_dns() { 157 | confirm 158 | cleanbrowsing1="nameserver 185.228.168.168" 159 | cleanbrowsing2="nameserver 185.228.169.168" 160 | 161 | opendns1="nameserver 208.67.222.123" 162 | opendns2="nameserver 208.67.220.123" 163 | 164 | cloudflare1="nameserver 1.1.1.3" 165 | cloudflare2="nameserver 1.0.0.3" 166 | 167 | if [[ $1 == "CleanBrowsing" ]] 168 | then 169 | LIST="${cleanbrowsing1}$'\n'${cleanbrowsing2}" 170 | elif [[ $1 == "OpenDNS FamilyShield" ]] 171 | then 172 | LIST="${opendns1}$'\n'${opendns2}" 173 | elif [[ $1 == "1.1.1.1 for Families" ]] 174 | then 175 | LIST="${cloudflare1}$'\n'${cloudflare2}" 176 | else 177 | LIST="" 178 | fi 179 | ( 180 | echo "# \nEnabling ${1}\n" 181 | sleep 2 182 | pkexec bash -c " 183 | echo '# \nEnabling resolvconf\n' 184 | sleep 2 185 | systemctl enable --now resolvconf.service 186 | 187 | echo '# \nRemoving previous entries\n' 188 | sleep 2 189 | sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head 190 | 191 | echo '# \nAdding new entries\n' 192 | sleep 2 193 | echo $LIST >> /etc/resolvconf/resolv.conf.d/head 194 | 195 | echo '# \nRestarting network\n' 196 | sleep 2 197 | resolvconf -u 198 | systemctl restart network-manager.service 199 | 200 | echo '# \nAll finished\n' 201 | sleep 2 202 | " 203 | ) | 204 | zenity --progress \ 205 | --title="$APP_TITLE: Progress" \ 206 | --width=400 \ 207 | --height=100 \ 208 | --percentage=0 \ 209 | --auto-close \ 210 | --auto-kill \ 211 | --no-cancel \ 212 | --pulsate \ 213 | --window-icon=/usr/share/pixmaps/dnsminder.png 214 | 215 | (($? != 0)) && general_failure 216 | 217 | settings 218 | } 219 | 220 | revert_dns() { 221 | PROVIDER=$(get_provider) 222 | confirm 223 | 224 | ( 225 | echo "# \nDisabling ${PROVIDER}\n" 226 | sleep 2 227 | pkexec bash -c " 228 | echo '# \nRemoving DNS entries\n' 229 | sleep 2 230 | sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head 231 | resolvconf -u 232 | 233 | echo '# \nDisabling resolvconf\n' 234 | sleep 2 235 | systemctl disable --now resolvconf.service 236 | 237 | echo '# \nRestarting network\n' 238 | sleep 2 239 | systemctl restart network-manager.service 240 | 241 | echo '# \nAll finished\n' 242 | sleep 2 243 | " 244 | ) | 245 | zenity --progress \ 246 | --title="$APP_TITLE: Progress" \ 247 | --width=400 \ 248 | --height=100 \ 249 | --percentage=0 \ 250 | --auto-close \ 251 | --auto-kill \ 252 | --no-cancel \ 253 | --pulsate \ 254 | --window-icon=/usr/share/pixmaps/dnsminder.png 255 | 256 | (($? != 0)) && zenity --window-icon=/usr/share/pixmaps/dnsminder.png --error --text="Error in zenity command." 257 | 258 | settings 259 | } 260 | 261 | settings fresh 262 | -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/focal/dnsminder_0.0.3_all/usr/share/applications/dnsminder.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Encoding=UTF-8 4 | Name=DNS Minder 5 | Comment=A graphical tool to setup CleanBrowsing or OpenDNS FamilyShield. 6 | Exec=dnsminder 7 | Icon=dnsminder.png 8 | Terminal=false 9 | Type=Application 10 | StartupNotify=true 11 | Categories=Application;System;Settings; 12 | Name[en_US]=DNS Minder 13 | -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/focal/dnsminder_0.0.3_all/usr/share/doc/dnsminder/changelog.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.zenity/deb/focal/dnsminder_0.0.3_all/usr/share/doc/dnsminder/changelog.tar.xz -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/focal/dnsminder_0.0.3_all/usr/share/doc/dnsminder/copyright: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Jereme Hancock 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/focal/dnsminder_0.0.3_all/usr/share/pixmaps/dnsminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.zenity/deb/focal/dnsminder_0.0.3_all/usr/share/pixmaps/dnsminder.png -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/jammy/dnsminder_0.0.6_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.zenity/deb/jammy/dnsminder_0.0.6_all.deb -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/jammy/dnsminder_0.0.6_all/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: dnsminder 2 | Version: 0.0.6 3 | Section: web 4 | Priority: optional 5 | Architecture: all 6 | Maintainer: Jereme Hancock 7 | Installed-Size: 51.7 8 | Depends: zenity, resolvconf 9 | Description: DNS Minder 10 | 11 | -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/jammy/dnsminder_0.0.6_all/DEBIAN/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | systemctl enable --now resolvconf.service 4 | 5 | DEFAULTS="nameserver 185.228.168.168 6 | nameserver 185.228.169.168" 7 | 8 | sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head 9 | echo "$DEFAULTS" | tee -a /etc/resolvconf/resolv.conf.d/head 10 | 11 | resolvconf -u 12 | nmcli networking off 13 | nmcli networking on 14 | 15 | exit 0 16 | -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/jammy/dnsminder_0.0.6_all/DEBIAN/postrm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head 4 | resolvconf -u 5 | systemctl disable --now resolvconf.service 6 | nmcli networking off 7 | nmcli networking on 8 | 9 | exit 0 10 | -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/jammy/dnsminder_0.0.6_all/usr/bin/dnsminder: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2021 Jereme Hancock 3 | 4 | # MIT License 5 | 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | 24 | # Jammy Jellyfish Release 25 | 26 | APP_TITLE="DNS Minder" 27 | 28 | check_status() { 29 | DNS=$(resolvectl status | grep "Current DNS Server:" | awk '{print $4}') 30 | if [[ $DNS == "185.228.168.168"* ]] || [[ $DNS == "185.228.169.168"* ]] || 31 | [[ $DNS == "208.67.222.123"* ]] || [[ $DNS == "208.67.220.123"* ]] || 32 | [[ $DNS == "1.1.1.3"* ]] || [[ $DNS == "1.0.0.3"* ]] || 33 | [[ $DNS == "94.140.14.15"* ]] || [[ $DNS == "94.140.15.16"* ]] 34 | then 35 | echo "ON" 36 | else 37 | echo "OFF" 38 | fi 39 | } 40 | 41 | get_toggle() { 42 | STATUS=$(check_status) 43 | if [[ $STATUS == *"ON"* ]] 44 | then 45 | echo "OFF" 46 | else 47 | echo "ON" 48 | fi 49 | } 50 | 51 | get_status_color() { 52 | STATUS=$(check_status) 53 | if [[ $STATUS == *"ON"* ]] 54 | then 55 | echo "#228B22" 56 | else 57 | echo "#CC0000" 58 | fi 59 | } 60 | 61 | get_provider() { 62 | PROVIDER=$(resolvectl status | grep "Current DNS Server:" | awk '{print $4}') 63 | if [[ $PROVIDER == "185.228.168.168"* ]] || [[ $PROVIDER == "185.228.169.168"* ]] 64 | then 65 | echo "CleanBrowsing" 66 | elif [[ $PROVIDER == "208.67.222.123"* ]] || [[ $PROVIDER == "208.67.220.123"* ]] 67 | then 68 | echo "OpenDNS FamilyShield" 69 | elif [[ $PROVIDER == "1.1.1.3"* ]] || [[ $PROVIDER == "1.0.0.3"* ]] 70 | then 71 | echo "1.1.1.1 for Families" 72 | elif [[ $PROVIDER == "94.140.14.15"* ]] || [[ $PROVIDER == "94.140.15.16"* ]] 73 | then 74 | echo "AdGuard Family DNS" 75 | else 76 | echo "None" 77 | fi 78 | } 79 | 80 | settings() { 81 | STATUS=$(check_status) 82 | STATUS_COLOR=$(get_status_color) 83 | TOGGLE=$(get_toggle) 84 | PROVIDER=$(get_provider) 85 | 86 | if [[ $STATUS == "ON" ]] 87 | then 88 | UPDATE="Change Provider" 89 | HELP="What's DNS Minder?" 90 | else 91 | UPDATE="What's DNS Minder?" 92 | HELP="" 93 | fi 94 | 95 | SWITCH=$(zenity --window-icon=/usr/share/pixmaps/dnsminder.png --list --title="$APP_TITLE: Settings" --width=400 --height=275 --text="Status: $STATUS\n\nCurrent Provider: $PROVIDER\n" --column= --hide-header "Turn $TOGGLE" "$UPDATE" "$HELP") 96 | case $SWITCH in 97 | 98 | "Turn ON") 99 | select_provider fresh 100 | ;; 101 | 102 | "Turn OFF") 103 | revert_dns 104 | ;; 105 | 106 | "Change Provider") 107 | select_provider 108 | ;; 109 | 110 | "What's DNS Minder?") 111 | xdg-open "https://github.com/jeremehancock/dnsminder#readme" 112 | settings 113 | ;; 114 | 115 | *) 116 | exit 1 117 | ;; 118 | esac 119 | } 120 | 121 | select_provider() { 122 | if [[ $1 == "fresh" ]] 123 | then 124 | zenity --window-icon=/usr/share/pixmaps/dnsminder.png --info --title "$APP_TITLE" --width=450 --text $"\nThis tool will be modifying your network settings.\n\nIt will be making changes to your system and should be USED AT YOUR OWN RISK!\n\nIt is recommended that you have system backups." 125 | fi 126 | STATUS=$(check_status) 127 | STATUS_COLOR=$(get_status_color) 128 | PROVIDER=$(get_provider) 129 | SELECT=$(zenity --window-icon=/usr/share/pixmaps/dnsminder.png --list --radiolist --title="$APP_TITLE: Settings" --width=400 --height=275 --text="Status: $STATUS\n\nCurrent Provider: $PROVIDER\n\nSelect Provider" --column "" --column "" --hide-header FALSE CleanBrowsing FALSE "OpenDNS FamilyShield" FALSE "1.1.1.1 for Families" FALSE "AdGuard Family DNS") 130 | case $SELECT in 131 | 132 | "CleanBrowsing") 133 | update_dns CleanBrowsing 134 | ;; 135 | 136 | "OpenDNS FamilyShield") 137 | update_dns "OpenDNS FamilyShield" 138 | ;; 139 | 140 | "1.1.1.1 for Families") 141 | update_dns "1.1.1.1 for Families" 142 | ;; 143 | 144 | "AdGuard Family DNS") 145 | update_dns "AdGuard Family DNS" 146 | ;; 147 | *) 148 | settings 149 | ;; 150 | esac 151 | } 152 | 153 | confirm() { 154 | if 155 | zenity --window-icon=/usr/share/pixmaps/dnsminder.png --question --title "$APP_TITLE" --no-wrap --text="\nAre you sure?" 156 | then 157 | return 158 | else 159 | settings 160 | fi 161 | } 162 | 163 | general_failure() { 164 | zenity --window-icon=/usr/share/pixmaps/dnsminder.png --error --title "$APP_TITLE" --no-wrap --text="\nSomething went wrong!" 165 | } 166 | 167 | update_dns() { 168 | confirm 169 | cleanbrowsing1="nameserver 185.228.168.168" 170 | cleanbrowsing2="nameserver 185.228.169.168" 171 | 172 | opendns1="nameserver 208.67.222.123" 173 | opendns2="nameserver 208.67.220.123" 174 | 175 | cloudflare1="nameserver 1.1.1.3" 176 | cloudflare2="nameserver 1.0.0.3" 177 | 178 | adguard1="nameserver 94.140.14.15" 179 | adguard2="nameserver 94.140.15.16" 180 | 181 | if [[ $1 == "CleanBrowsing" ]] 182 | then 183 | LIST="${cleanbrowsing1}$'\n'${cleanbrowsing2}" 184 | elif [[ $1 == "OpenDNS FamilyShield" ]] 185 | then 186 | LIST="${opendns1}$'\n'${opendns2}" 187 | elif [[ $1 == "1.1.1.1 for Families" ]] 188 | then 189 | LIST="${cloudflare1}$'\n'${cloudflare2}" 190 | elif [[ $1 == "AdGuard Family DNS" ]] 191 | then 192 | LIST="${adguard1}$'\n'${adguard2}" 193 | else 194 | LIST="" 195 | fi 196 | ( 197 | echo "# \nEnabling ${1}\n" 198 | sleep 2 199 | pkexec bash -c " 200 | echo '# \nEnabling resolvconf\n' 201 | sleep 2 202 | systemctl enable --now resolvconf.service 203 | 204 | echo '# \nRemoving previous entries\n' 205 | sleep 2 206 | sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head 207 | 208 | echo '# \nAdding new entries\n' 209 | sleep 2 210 | echo $LIST >> /etc/resolvconf/resolv.conf.d/head 211 | 212 | echo '# \nRestarting network\n' 213 | sleep 2 214 | resolvconf -u 215 | nmcli networking off 216 | nmcli networking on 217 | 218 | echo '# \nAll finished\n' 219 | sleep 2 220 | " 221 | ) | 222 | zenity --progress \ 223 | --title="$APP_TITLE: Progress" \ 224 | --width=400 \ 225 | --height=100 \ 226 | --percentage=0 \ 227 | --auto-close \ 228 | --auto-kill \ 229 | --no-cancel \ 230 | --pulsate \ 231 | --window-icon=/usr/share/pixmaps/dnsminder.png 232 | 233 | (($? != 0)) && general_failure 234 | 235 | settings 236 | } 237 | 238 | revert_dns() { 239 | PROVIDER=$(get_provider) 240 | confirm 241 | 242 | ( 243 | echo "# \nDisabling ${PROVIDER}\n" 244 | sleep 2 245 | pkexec bash -c " 246 | echo '# \nRemoving DNS entries\n' 247 | sleep 2 248 | sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head 249 | resolvconf -u 250 | 251 | echo '# \nDisabling resolvconf\n' 252 | sleep 2 253 | systemctl disable --now resolvconf.service 254 | 255 | echo '# \nRestarting network\n' 256 | sleep 2 257 | nmcli networking off 258 | nmcli networking on 259 | 260 | echo '# \nAll finished\n' 261 | sleep 2 262 | " 263 | ) | 264 | zenity --progress \ 265 | --title="$APP_TITLE: Progress" \ 266 | --width=400 \ 267 | --height=100 \ 268 | --percentage=0 \ 269 | --auto-close \ 270 | --auto-kill \ 271 | --no-cancel \ 272 | --pulsate \ 273 | --window-icon=/usr/share/pixmaps/dnsminder.png 274 | 275 | (($? != 0)) && zenity --window-icon=/usr/share/pixmaps/dnsminder.png --error --text="Error in zenity command." 276 | 277 | settings 278 | } 279 | 280 | settings fresh 281 | -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/jammy/dnsminder_0.0.6_all/usr/share/applications/dnsminder.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Encoding=UTF-8 4 | Name=DNS Minder 5 | Comment=A graphical tool to setup CleanBrowsing or OpenDNS FamilyShield. 6 | Exec=dnsminder 7 | Icon=dnsminder.png 8 | Terminal=false 9 | Type=Application 10 | StartupNotify=true 11 | Categories=Application;System;Settings; 12 | Name[en_US]=DNS Minder 13 | -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/jammy/dnsminder_0.0.6_all/usr/share/doc/dnsminder/changelog.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.zenity/deb/jammy/dnsminder_0.0.6_all/usr/share/doc/dnsminder/changelog.tar.xz -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/jammy/dnsminder_0.0.6_all/usr/share/doc/dnsminder/copyright: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Jereme Hancock 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dnsminder/.zenity/deb/jammy/dnsminder_0.0.6_all/usr/share/pixmaps/dnsminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/.zenity/deb/jammy/dnsminder_0.0.6_all/usr/share/pixmaps/dnsminder.png -------------------------------------------------------------------------------- /dnsminder/.zenity/release/focal/dnsminder: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2021 Jereme Hancock 3 | 4 | # MIT License 5 | 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | 24 | # Focal Fossa Release 25 | 26 | APP_TITLE="DNS Minder" 27 | 28 | check_status() { 29 | DNS=$(systemd-resolve --status | grep "Current DNS Server:" | awk '{print $4}') 30 | if [[ $DNS == "185.228.168.168"* ]] || [[ $DNS == "185.228.169.168"* ]] || [[ $DNS == "208.67.222.123"* ]] || [[ $DNS == "208.67.220.123"* ]] || [[ $DNS == "1.1.1.3"* ]] || [[ $DNS == "1.0.0.3"* ]] 31 | then 32 | echo "ON" 33 | else 34 | echo "OFF" 35 | fi 36 | } 37 | 38 | get_toggle() { 39 | STATUS=$(check_status) 40 | if [[ $STATUS == *"ON"* ]] 41 | then 42 | echo "OFF" 43 | else 44 | echo "ON" 45 | fi 46 | } 47 | 48 | get_status_color() { 49 | STATUS=$(check_status) 50 | if [[ $STATUS == *"ON"* ]] 51 | then 52 | echo "#228B22" 53 | else 54 | echo "#CC0000" 55 | fi 56 | } 57 | 58 | get_provider() { 59 | PROVIDER=$(systemd-resolve --status | grep "Current DNS Server:" | awk '{print $4}') 60 | if [[ $PROVIDER == "185.228.168.168"* ]] || [[ $PROVIDER == "185.228.169.168"* ]] 61 | then 62 | echo "CleanBrowsing" 63 | elif [[ $PROVIDER == "208.67.222.123"* ]] || [[ $PROVIDER == "208.67.220.123"* ]] 64 | then 65 | echo "OpenDNS FamilyShield" 66 | elif [[ $PROVIDER == "1.1.1.3"* ]] || [[ $PROVIDER == "1.0.0.3"* ]] 67 | then 68 | echo "1.1.1.1 for Families" 69 | else 70 | echo "None" 71 | fi 72 | } 73 | 74 | settings() { 75 | STATUS=$(check_status) 76 | STATUS_COLOR=$(get_status_color) 77 | TOGGLE=$(get_toggle) 78 | PROVIDER=$(get_provider) 79 | 80 | if [[ $STATUS == "ON" ]] 81 | then 82 | UPDATE="Change Provider" 83 | HELP="What's DNS Minder?" 84 | else 85 | UPDATE="What's DNS Minder?" 86 | HELP="" 87 | fi 88 | 89 | SWITCH=$(zenity --window-icon=/usr/share/pixmaps/dnsminder.png --list --title="$APP_TITLE: Settings" --width=400 --height=275 --text="Status: $STATUS\n\nCurrent Provider: $PROVIDER\n" --column= --hide-header "Turn $TOGGLE" "$UPDATE" "$HELP") 90 | case $SWITCH in 91 | 92 | "Turn ON") 93 | select_provider fresh 94 | ;; 95 | 96 | "Turn OFF") 97 | revert_dns 98 | ;; 99 | 100 | "Change Provider") 101 | select_provider 102 | ;; 103 | 104 | "What's DNS Minder?") 105 | xdg-open "https://github.com/jeremehancock/dnsminder#readme" 106 | settings 107 | ;; 108 | 109 | *) 110 | exit 1 111 | ;; 112 | esac 113 | } 114 | 115 | select_provider() { 116 | if [[ $1 == "fresh" ]] 117 | then 118 | zenity --window-icon=/usr/share/pixmaps/dnsminder.png --info --title "$APP_TITLE" --width=450 --text $"\nThis tool will be modifying your network settings.\n\nIt will be making changes to your system and should be USED AT YOUR OWN RISK!\n\nIt is recommended that you have system backups." 119 | fi 120 | STATUS=$(check_status) 121 | STATUS_COLOR=$(get_status_color) 122 | PROVIDER=$(get_provider) 123 | SELECT=$(zenity --window-icon=/usr/share/pixmaps/dnsminder.png --list --radiolist --title="$APP_TITLE: Settings" --width=400 --height=275 --text="Status: $STATUS\n\nCurrent Provider: $PROVIDER\n\nSelect Provider" --column "" --column "" --hide-header FALSE CleanBrowsing FALSE "OpenDNS FamilyShield" FALSE "1.1.1.1 for Families") 124 | case $SELECT in 125 | 126 | "CleanBrowsing") 127 | update_dns CleanBrowsing 128 | ;; 129 | 130 | "OpenDNS FamilyShield") 131 | update_dns "OpenDNS FamilyShield" 132 | ;; 133 | 134 | "1.1.1.1 for Families") 135 | update_dns "1.1.1.1 for Families" 136 | ;; 137 | 138 | *) 139 | settings 140 | ;; 141 | esac 142 | } 143 | 144 | confirm() { 145 | if 146 | zenity --window-icon=/usr/share/pixmaps/dnsminder.png --question --title "$APP_TITLE" --no-wrap --text="\nAre you sure?" 147 | then 148 | return 149 | else 150 | settings 151 | fi 152 | } 153 | 154 | general_failure() { 155 | zenity --window-icon=/usr/share/pixmaps/dnsminder.png --error --title "$APP_TITLE" --no-wrap --text="\nSomething went wrong!" 156 | } 157 | 158 | update_dns() { 159 | confirm 160 | cleanbrowsing1="nameserver 185.228.168.168" 161 | cleanbrowsing2="nameserver 185.228.169.168" 162 | 163 | opendns1="nameserver 208.67.222.123" 164 | opendns2="nameserver 208.67.220.123" 165 | 166 | cloudflare1="nameserver 1.1.1.3" 167 | cloudflare2="nameserver 1.0.0.3" 168 | 169 | if [[ $1 == "CleanBrowsing" ]] 170 | then 171 | LIST="${cleanbrowsing1}$'\n'${cleanbrowsing2}" 172 | elif [[ $1 == "OpenDNS FamilyShield" ]] 173 | then 174 | LIST="${opendns1}$'\n'${opendns2}" 175 | elif [[ $1 == "1.1.1.1 for Families" ]] 176 | then 177 | LIST="${cloudflare1}$'\n'${cloudflare2}" 178 | else 179 | LIST="" 180 | fi 181 | ( 182 | echo "# \nEnabling ${1}\n" 183 | sleep 2 184 | pkexec bash -c " 185 | echo '# \nEnabling resolvconf\n' 186 | sleep 2 187 | systemctl enable --now resolvconf.service 188 | 189 | echo '# \nRemoving previous entries\n' 190 | sleep 2 191 | sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head 192 | 193 | echo '# \nAdding new entries\n' 194 | sleep 2 195 | echo $LIST >> /etc/resolvconf/resolv.conf.d/head 196 | 197 | echo '# \nRestarting network\n' 198 | sleep 2 199 | resolvconf -u 200 | systemctl restart network-manager.service 201 | 202 | echo '# \nAll finished\n' 203 | sleep 2 204 | " 205 | ) | 206 | zenity --progress \ 207 | --title="$APP_TITLE: Progress" \ 208 | --width=400 \ 209 | --height=100 \ 210 | --percentage=0 \ 211 | --auto-close \ 212 | --auto-kill \ 213 | --no-cancel \ 214 | --pulsate \ 215 | --window-icon=/usr/share/pixmaps/dnsminder.png 216 | 217 | (($? != 0)) && general_failure 218 | 219 | settings 220 | } 221 | 222 | revert_dns() { 223 | PROVIDER=$(get_provider) 224 | confirm 225 | 226 | ( 227 | echo "# \nDisabling ${PROVIDER}\n" 228 | sleep 2 229 | pkexec bash -c " 230 | echo '# \nRemoving DNS entries\n' 231 | sleep 2 232 | sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head 233 | resolvconf -u 234 | 235 | echo '# \nDisabling resolvconf\n' 236 | sleep 2 237 | systemctl disable --now resolvconf.service 238 | 239 | echo '# \nRestarting network\n' 240 | sleep 2 241 | systemctl restart network-manager.service 242 | 243 | echo '# \nAll finished\n' 244 | sleep 2 245 | " 246 | ) | 247 | zenity --progress \ 248 | --title="$APP_TITLE: Progress" \ 249 | --width=400 \ 250 | --height=100 \ 251 | --percentage=0 \ 252 | --auto-close \ 253 | --auto-kill \ 254 | --no-cancel \ 255 | --pulsate \ 256 | --window-icon=/usr/share/pixmaps/dnsminder.png 257 | 258 | (($? != 0)) && zenity --window-icon=/usr/share/pixmaps/dnsminder.png --error --text="Error in zenity command." 259 | 260 | settings 261 | } 262 | 263 | settings fresh 264 | -------------------------------------------------------------------------------- /dnsminder/.zenity/release/jammy/dnsminder: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2021 Jereme Hancock 3 | 4 | # MIT License 5 | 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | 24 | # Jammy Jellyfish Release 25 | 26 | APP_TITLE="DNS Minder" 27 | 28 | check_status() { 29 | DNS=$(resolvectl status | grep "Current DNS Server:" | awk '{print $4}') 30 | if [[ $DNS == "185.228.168.168"* ]] || [[ $DNS == "185.228.169.168"* ]] || 31 | [[ $DNS == "208.67.222.123"* ]] || [[ $DNS == "208.67.220.123"* ]] || 32 | [[ $DNS == "1.1.1.3"* ]] || [[ $DNS == "1.0.0.3"* ]] || 33 | [[ $DNS == "94.140.14.15"* ]] || [[ $DNS == "94.140.15.16"* ]] 34 | then 35 | echo "ON" 36 | else 37 | echo "OFF" 38 | fi 39 | } 40 | 41 | get_toggle() { 42 | STATUS=$(check_status) 43 | if [[ $STATUS == *"ON"* ]] 44 | then 45 | echo "OFF" 46 | else 47 | echo "ON" 48 | fi 49 | } 50 | 51 | get_status_color() { 52 | STATUS=$(check_status) 53 | if [[ $STATUS == *"ON"* ]] 54 | then 55 | echo "#228B22" 56 | else 57 | echo "#CC0000" 58 | fi 59 | } 60 | 61 | get_provider() { 62 | PROVIDER=$(resolvectl status | grep "Current DNS Server:" | awk '{print $4}') 63 | if [[ $PROVIDER == "185.228.168.168"* ]] || [[ $PROVIDER == "185.228.169.168"* ]] 64 | then 65 | echo "CleanBrowsing" 66 | elif [[ $PROVIDER == "208.67.222.123"* ]] || [[ $PROVIDER == "208.67.220.123"* ]] 67 | then 68 | echo "OpenDNS FamilyShield" 69 | elif [[ $PROVIDER == "1.1.1.3"* ]] || [[ $PROVIDER == "1.0.0.3"* ]] 70 | then 71 | echo "1.1.1.1 for Families" 72 | elif [[ $PROVIDER == "94.140.14.15"* ]] || [[ $PROVIDER == "94.140.15.16"* ]] 73 | then 74 | echo "AdGuard Family DNS" 75 | else 76 | echo "None" 77 | fi 78 | } 79 | 80 | settings() { 81 | STATUS=$(check_status) 82 | STATUS_COLOR=$(get_status_color) 83 | TOGGLE=$(get_toggle) 84 | PROVIDER=$(get_provider) 85 | 86 | if [[ $STATUS == "ON" ]] 87 | then 88 | UPDATE="Change Provider" 89 | HELP="What's DNS Minder?" 90 | else 91 | UPDATE="What's DNS Minder?" 92 | HELP="" 93 | fi 94 | 95 | SWITCH=$(zenity --window-icon=/usr/share/pixmaps/dnsminder.png --list --title="$APP_TITLE: Settings" --width=400 --height=275 --text="Status: $STATUS\n\nCurrent Provider: $PROVIDER\n" --column= --hide-header "Turn $TOGGLE" "$UPDATE" "$HELP") 96 | case $SWITCH in 97 | 98 | "Turn ON") 99 | select_provider fresh 100 | ;; 101 | 102 | "Turn OFF") 103 | revert_dns 104 | ;; 105 | 106 | "Change Provider") 107 | select_provider 108 | ;; 109 | 110 | "What's DNS Minder?") 111 | xdg-open "https://github.com/jeremehancock/dnsminder#readme" 112 | settings 113 | ;; 114 | 115 | *) 116 | exit 1 117 | ;; 118 | esac 119 | } 120 | 121 | select_provider() { 122 | if [[ $1 == "fresh" ]] 123 | then 124 | zenity --window-icon=/usr/share/pixmaps/dnsminder.png --info --title "$APP_TITLE" --width=450 --text $"\nThis tool will be modifying your network settings.\n\nIt will be making changes to your system and should be USED AT YOUR OWN RISK!\n\nIt is recommended that you have system backups." 125 | fi 126 | STATUS=$(check_status) 127 | STATUS_COLOR=$(get_status_color) 128 | PROVIDER=$(get_provider) 129 | SELECT=$(zenity --window-icon=/usr/share/pixmaps/dnsminder.png --list --radiolist --title="$APP_TITLE: Settings" --width=400 --height=275 --text="Status: $STATUS\n\nCurrent Provider: $PROVIDER\n\nSelect Provider" --column "" --column "" --hide-header FALSE CleanBrowsing FALSE "OpenDNS FamilyShield" FALSE "1.1.1.1 for Families" FALSE "AdGuard Family DNS") 130 | case $SELECT in 131 | 132 | "CleanBrowsing") 133 | update_dns CleanBrowsing 134 | ;; 135 | 136 | "OpenDNS FamilyShield") 137 | update_dns "OpenDNS FamilyShield" 138 | ;; 139 | 140 | "1.1.1.1 for Families") 141 | update_dns "1.1.1.1 for Families" 142 | ;; 143 | 144 | "AdGuard Family DNS") 145 | update_dns "AdGuard Family DNS" 146 | ;; 147 | *) 148 | settings 149 | ;; 150 | esac 151 | } 152 | 153 | confirm() { 154 | if 155 | zenity --window-icon=/usr/share/pixmaps/dnsminder.png --question --title "$APP_TITLE" --no-wrap --text="\nAre you sure?" 156 | then 157 | return 158 | else 159 | settings 160 | fi 161 | } 162 | 163 | general_failure() { 164 | zenity --window-icon=/usr/share/pixmaps/dnsminder.png --error --title "$APP_TITLE" --no-wrap --text="\nSomething went wrong!" 165 | } 166 | 167 | update_dns() { 168 | confirm 169 | cleanbrowsing1="nameserver 185.228.168.168" 170 | cleanbrowsing2="nameserver 185.228.169.168" 171 | 172 | opendns1="nameserver 208.67.222.123" 173 | opendns2="nameserver 208.67.220.123" 174 | 175 | cloudflare1="nameserver 1.1.1.3" 176 | cloudflare2="nameserver 1.0.0.3" 177 | 178 | adguard1="nameserver 94.140.14.15" 179 | adguard2="nameserver 94.140.15.16" 180 | 181 | if [[ $1 == "CleanBrowsing" ]] 182 | then 183 | LIST="${cleanbrowsing1}$'\n'${cleanbrowsing2}" 184 | elif [[ $1 == "OpenDNS FamilyShield" ]] 185 | then 186 | LIST="${opendns1}$'\n'${opendns2}" 187 | elif [[ $1 == "1.1.1.1 for Families" ]] 188 | then 189 | LIST="${cloudflare1}$'\n'${cloudflare2}" 190 | elif [[ $1 == "AdGuard Family DNS" ]] 191 | then 192 | LIST="${adguard1}$'\n'${adguard2}" 193 | else 194 | LIST="" 195 | fi 196 | ( 197 | echo "# \nEnabling ${1}\n" 198 | sleep 2 199 | pkexec bash -c " 200 | echo '# \nEnabling resolvconf\n' 201 | sleep 2 202 | systemctl enable --now resolvconf.service 203 | 204 | echo '# \nRemoving previous entries\n' 205 | sleep 2 206 | sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head 207 | 208 | echo '# \nAdding new entries\n' 209 | sleep 2 210 | echo $LIST >> /etc/resolvconf/resolv.conf.d/head 211 | 212 | echo '# \nRestarting network\n' 213 | sleep 2 214 | resolvconf -u 215 | nmcli networking off 216 | nmcli networking on 217 | 218 | echo '# \nAll finished\n' 219 | sleep 2 220 | " 221 | ) | 222 | zenity --progress \ 223 | --title="$APP_TITLE: Progress" \ 224 | --width=400 \ 225 | --height=100 \ 226 | --percentage=0 \ 227 | --auto-close \ 228 | --auto-kill \ 229 | --no-cancel \ 230 | --pulsate \ 231 | --window-icon=/usr/share/pixmaps/dnsminder.png 232 | 233 | (($? != 0)) && general_failure 234 | 235 | settings 236 | } 237 | 238 | revert_dns() { 239 | PROVIDER=$(get_provider) 240 | confirm 241 | 242 | ( 243 | echo "# \nDisabling ${PROVIDER}\n" 244 | sleep 2 245 | pkexec bash -c " 246 | echo '# \nRemoving DNS entries\n' 247 | sleep 2 248 | sed -i '/^nameserver/d' /etc/resolvconf/resolv.conf.d/head 249 | resolvconf -u 250 | 251 | echo '# \nDisabling resolvconf\n' 252 | sleep 2 253 | systemctl disable --now resolvconf.service 254 | 255 | echo '# \nRestarting network\n' 256 | sleep 2 257 | nmcli networking off 258 | nmcli networking on 259 | 260 | echo '# \nAll finished\n' 261 | sleep 2 262 | " 263 | ) | 264 | zenity --progress \ 265 | --title="$APP_TITLE: Progress" \ 266 | --width=400 \ 267 | --height=100 \ 268 | --percentage=0 \ 269 | --auto-close \ 270 | --auto-kill \ 271 | --no-cancel \ 272 | --pulsate \ 273 | --window-icon=/usr/share/pixmaps/dnsminder.png 274 | 275 | (($? != 0)) && zenity --window-icon=/usr/share/pixmaps/dnsminder.png --error --text="Error in zenity command." 276 | 277 | settings 278 | } 279 | 280 | settings fresh 281 | -------------------------------------------------------------------------------- /dnsminder/dnsminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/dnsminder.png -------------------------------------------------------------------------------- /dnsminder/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/info.png -------------------------------------------------------------------------------- /dnsminder/off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/off.png -------------------------------------------------------------------------------- /dnsminder/on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/dnsminder/dfa8915897a316fd76fe3aff2a155e5af39e10aa/dnsminder/on.png --------------------------------------------------------------------------------