├── .gitignore ├── LICENSE ├── README.md ├── deb ├── focal │ ├── hostminder_0.0.1_all.deb │ ├── hostminder_0.0.2_all.deb │ ├── hostminder_0.0.3_all.deb │ ├── hostminder_0.0.4_all.deb │ ├── hostminder_0.0.5_all.deb │ └── hostminder_0.0.5_all │ │ ├── DEBIAN │ │ ├── control │ │ └── postinst │ │ └── usr │ │ ├── bin │ │ └── hostminder │ │ └── share │ │ ├── applications │ │ └── hostminder.desktop │ │ ├── doc │ │ └── hostminder │ │ │ ├── changelog.tar.xz │ │ │ └── copyright │ │ └── pixmaps │ │ └── hostminder.png └── jammy │ ├── hostminder_0.0.8_all.deb │ └── hostminder_0.0.8_all │ ├── DEBIAN │ ├── control │ └── postinst │ └── usr │ ├── bin │ └── hostminder │ └── share │ ├── applications │ └── hostminder.desktop │ ├── doc │ └── hostminder │ │ ├── changelog.tar.xz │ │ └── copyright │ └── pixmaps │ └── hostminder.png ├── hostminder-job.png ├── hostminder.png └── release ├── focal └── hostminder └── jammy └── hostminder /.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 |

Host Minder

2 | 3 | 4 | 5 | This simple GUI allows you to easily update your `/etc/hosts` file to one of four consolidated hosts files 6 | from [StevenBlack/hosts](https://github.com/StevenBlack/hosts). 7 | 8 | These consolidated hosts files allow you to block websites from various categories such as Ads, Porn, Gambling, Social, 9 | and Fake News. 10 | 11 | Host Minder has them setup into four Protection Levels. 12 | 13 | * Low 14 | * Ads / Porn 15 | * Medium 16 | * Ads / Porn / Gambling 17 | * High 18 | * Ads / Porn / Gambling / Social 19 | * Max 20 | * Ads / Porn / Gambling / Social / Fake News 21 | 22 | When you enable Host Minder your existing `/etc/hosts` entries are added to the downloaded `hosts` file inside a special 23 | section. 24 | 25 | Example: 26 | 27 | ``` 28 | # Custom host records are listed here. 29 | 127.0.0.1 localhost 30 | 127.0.1.1 your-laptop 31 | ::1 localhost ip6-localhost ip6-loopback 32 | ff02::1 ip6-allnodes 33 | ff02::2 ip6-allrouters 34 | # End of custom host records. 35 | ``` 36 | 37 | If you need to add additional entries simply add them to this section between `# Custom host records are listed here.` 38 | and `# End of custom host records.` 39 | 40 | If you decide to turn off Host Minder the entries in this section will be used to create your `/etc/hosts` file. 41 | 42 | All protection levels also include enabling Google Safe Search. 43 | 44 | There is an `Allow List` option. This is handy if you find that a particular Protection Level is blocking a domain that you need access to. 45 | 46 | Host Minder automatically updates your selected Protection Level once a week. 47 | 48 | ## Built for UbuntuCE: 49 | 50 | ### [Check out UbuntuCE](https://ubuntuce.com/) 51 | 52 | ## Disclaimer 53 | 54 | All code is provided as-is without any warranty. 55 | -------------------------------------------------------------------------------- /deb/focal/hostminder_0.0.1_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/hostminder/82ca8d23602fab775dc99390fe48d6d80d56bd59/deb/focal/hostminder_0.0.1_all.deb -------------------------------------------------------------------------------- /deb/focal/hostminder_0.0.2_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/hostminder/82ca8d23602fab775dc99390fe48d6d80d56bd59/deb/focal/hostminder_0.0.2_all.deb -------------------------------------------------------------------------------- /deb/focal/hostminder_0.0.3_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/hostminder/82ca8d23602fab775dc99390fe48d6d80d56bd59/deb/focal/hostminder_0.0.3_all.deb -------------------------------------------------------------------------------- /deb/focal/hostminder_0.0.4_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/hostminder/82ca8d23602fab775dc99390fe48d6d80d56bd59/deb/focal/hostminder_0.0.4_all.deb -------------------------------------------------------------------------------- /deb/focal/hostminder_0.0.5_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/hostminder/82ca8d23602fab775dc99390fe48d6d80d56bd59/deb/focal/hostminder_0.0.5_all.deb -------------------------------------------------------------------------------- /deb/focal/hostminder_0.0.5_all/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: hostminder 2 | Version: 0.0.5 3 | Section: web 4 | Priority: optional 5 | Architecture: all 6 | Maintainer: Jereme Hancock 7 | Installed-Size: 51.7 8 | Depends: zenity 9 | Description: Host Minder 10 | 11 | -------------------------------------------------------------------------------- /deb/focal/hostminder_0.0.5_all/DEBIAN/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir /opt/hostminder 4 | touch /opt/hostminder/allow 5 | echo $'# Host Minder Allow List\n# Add one domain per line below (Do not include http:// or https://)' > /opt/hostminder/allow 6 | 7 | exit 0 8 | -------------------------------------------------------------------------------- /deb/focal/hostminder_0.0.5_all/usr/bin/hostminder: -------------------------------------------------------------------------------- 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="Host Minder" 25 | 26 | check_status() { 27 | HOSTS=$(head /etc/hosts | grep "GENERATED BY $APP_TITLE" | awk '{print $0}') 28 | STEVEN=$(head /etc/hosts | grep "Title: StevenBlack/hosts" | awk '{print $0}') 29 | if [[ $HOSTS == "# GENERATED BY $APP_TITLE"* ]] || [[ $STEVEN == "# Title: StevenBlack/hosts"* ]] 30 | then 31 | echo "ON" 32 | else 33 | echo "OFF" 34 | fi 35 | } 36 | 37 | get_toggle() { 38 | STATUS=$(check_status) 39 | if [[ $STATUS == *"ON"* ]] 40 | then 41 | echo "OFF" 42 | else 43 | echo "ON" 44 | fi 45 | } 46 | 47 | get_status_color() { 48 | STATUS=$(check_status) 49 | if [[ $STATUS == *"ON"* ]] 50 | then 51 | echo "#228B22" 52 | else 53 | echo "#CC0000" 54 | fi 55 | } 56 | 57 | get_level() { 58 | LEVEL=$(head /etc/hosts | grep "GENERATED BY $APP_TITLE" | awk '{print $6}') 59 | if [[ $LEVEL ]] 60 | then 61 | echo "\n\nCurrent Protection Level: $LEVEL" 62 | fi 63 | } 64 | 65 | get_total_domains() { 66 | DOMAINS=$(head /etc/hosts | grep "# Number of unique domains" | awk '{print $6}') 67 | if [[ $DOMAINS ]] 68 | then 69 | echo "\n\nTotal Unique Domains: $DOMAINS" 70 | fi 71 | } 72 | 73 | check_safe_searchstatus() { 74 | STATUS=$(grep "# Google Safe Search - Host Minder" /etc/hosts | awk '{print $0}') 75 | if [[ $STATUS ]] 76 | then 77 | echo "ENABLED" 78 | else 79 | echo "DISABLED" 80 | fi 81 | } 82 | 83 | get_safe_searchstatus_color() { 84 | STATUS=$(check_safe_searchstatus) 85 | if [[ $STATUS == *"ENABLED"* ]] 86 | then 87 | echo "#228B22" 88 | else 89 | echo "#CC0000" 90 | fi 91 | } 92 | 93 | settings() { 94 | STATUS=$(check_status) 95 | STATUS_COLOR=$(get_status_color) 96 | TOGGLE=$(get_toggle) 97 | LEVEL=$(get_level) 98 | DOMAINS=$(get_total_domains) 99 | SAFESEARCH_STATUS=$(check_safe_searchstatus) 100 | SAFESEARCH_STATUS_COLOR=$(get_safe_searchstatus_color) 101 | if [[ $STATUS == "ON" ]] 102 | then 103 | UPDATE="Change/Update Protection Level" 104 | ALLOW="Edit Allow List" 105 | HELP="What's Host Minder?" 106 | else 107 | UPDATE="What's Host Minder?" 108 | ALLOW="" 109 | HELP="" 110 | fi 111 | SWITCH=$(zenity --window-icon=/usr/share/pixmaps/hostminder.png --list --title="$APP_TITLE: Settings" --width=400 --height=350 --text="Status: $STATUS$LEVEL$DOMAINS\n\nGoogle Safe Search: $SAFESEARCH_STATUS\n" --column= --hide-header "Turn $TOGGLE" "$UPDATE" "$ALLOW" "$HELP") 112 | case $SWITCH in 113 | 114 | "Turn ON") 115 | select_level fresh 116 | ;; 117 | 118 | "Turn OFF") 119 | revert_hosts 120 | ;; 121 | 122 | "Change/Update Protection Level") 123 | select_level 124 | ;; 125 | 126 | "Edit Allow List") 127 | cp /opt/hostminder/allow /tmp/hostminder.allow 128 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --info --title "$APP_TITLE" --width=500 --text $"\nThe Allow List only affects domains blocked by Host Minder.\n\nKeep in mind that DNS Minder may still be blocking the domain." 129 | gedit -w /tmp/hostminder.allow 130 | sed -i '/^[[:space:]]*$/d' /tmp/hostminder.allow 131 | confirm_save_allow_list 132 | settings 133 | ;; 134 | 135 | "What's Host Minder?") 136 | xdg-open "https://github.com/mhancoc7/hostminder#readme" 137 | settings 138 | ;; 139 | 140 | *) 141 | exit 1 142 | ;; 143 | esac 144 | } 145 | 146 | select_level() { 147 | if [[ $1 == "fresh" ]] 148 | then 149 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --info --title "$APP_TITLE" --width=450 --text $"\nThis tool will download and setup a new /etc/hosts file.\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." 150 | fi 151 | STATUS=$(check_status) 152 | STATUS_COLOR=$(get_status_color) 153 | LEVEL=$(get_level) 154 | DOMAINS=$(get_total_domains) 155 | SAFESEARCH_STATUS=$(check_safe_searchstatus) 156 | SAFESEARCH_STATUS_COLOR=$(get_safe_searchstatus_color) 157 | SELECT=$(zenity --window-icon=/usr/share/pixmaps/hostminder.png --list --title="$APP_TITLE: Settings" --width=400 --height=350 --text="Status: $STATUS$LEVEL$DOMAINS\n\nGoogle Safe Search: $SAFESEARCH_STATUS\n\nSelect Protection Level" --column=Name --column=Description Max "Ads / Porn / Gambling / Social / Fake News" High "Ads / Porn / Gambling / Social" Medium "Ads / Porn / Gambling" Low "Ads / Porn") 158 | case $SELECT in 159 | 160 | "Max") 161 | update_hosts max 162 | ;; 163 | 164 | "High") 165 | update_hosts high 166 | ;; 167 | 168 | "Medium") 169 | update_hosts medium 170 | ;; 171 | 172 | "Low") 173 | update_hosts low 174 | ;; 175 | 176 | *) 177 | settings 178 | ;; 179 | esac 180 | } 181 | 182 | confirm() { 183 | if 184 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --question --title "$APP_TITLE" --no-wrap --text="\nAre you sure?" 185 | then 186 | return 187 | else 188 | settings 189 | fi 190 | } 191 | 192 | confirm_save_allow_list() { 193 | if 194 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --question --title "$APP_TITLE" --no-wrap --text="\nSave & Apply Allow List?" 195 | then 196 | if [[ "$LEVEL" == "\n\nCurrent Protection Level: (Max):" ]] 197 | then 198 | update_hosts max auto allow 199 | elif [[ "$LEVEL" == "\n\nCurrent Protection Level: (High):" ]] 200 | then 201 | update_hosts high auto allow 202 | elif [[ "$LEVEL" == "\n\nCurrent Protection Level: (Medium):" ]] 203 | then 204 | update_hosts medium auto allow 205 | elif [[ "$LEVEL" == "\n\nCurrent Protection Level: (Low):" ]] 206 | then 207 | update_hosts low auto allow 208 | else 209 | return 210 | fi 211 | else 212 | settings 213 | fi 214 | } 215 | 216 | general_failure() { 217 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --error --title "$APP_TITLE" --no-wrap --text="\nSomething went wrong!" 218 | } 219 | 220 | wget_failure() { 221 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --error --title "$APP_TITLE" --no-wrap --text="\nCould not download hosts file.\n\nPlease check your internet connection!" 222 | } 223 | 224 | FALLBACK="127.0.0.1 localhost 225 | 127.0.0.1 localhost.localdomain 226 | 127.0.0.1 local 227 | 255.255.255.255 broadcasthost 228 | ::1 localhost 229 | ::1 ip6-localhost 230 | ::1 ip6-loopback 231 | fe80::1%lo0 localhost 232 | ff00::0 ip6-localnet 233 | ff00::0 ip6-mcastprefix 234 | ff02::1 ip6-allnodes 235 | ff02::2 ip6-allrouters 236 | ff02::3 ip6-allhosts 237 | 0.0.0.0 0.0.0.0 238 | " 239 | 240 | update_hosts() { 241 | if [ "$2" != "auto" ] 242 | then 243 | confirm 244 | fi 245 | 246 | if [[ "$1" == "max" ]] 247 | then 248 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts" 249 | elif [[ "$1" == "high" ]] 250 | then 251 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn-social/hosts" 252 | elif [[ "$1" == "medium" ]] 253 | then 254 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn/hosts" 255 | elif [[ "$1" == "low" ]] 256 | then 257 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn/hosts" 258 | else 259 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn/hosts" 260 | fi 261 | ( 262 | echo "# \nGetting new hosts file (${1^})\n" 263 | sleep 2 264 | if wget -q "$LIST" -O /tmp/bad.host.list.hostminder.txt 265 | then 266 | echo "# \nApplying Allow List\n" 267 | sleep 2 268 | 269 | if [ -f /tmp/hostminder.allow ] 270 | then 271 | while read line; do 272 | if [[ ${line} != *"#"* ]] 273 | then 274 | sed -i "/$line/d" /tmp/bad.host.list.hostminder.txt 275 | fi 276 | done /etc/hosts_hostminder_bak 290 | else 291 | echo '# \nBacking up current hosts file\n' 292 | sleep 2 293 | cp /etc/hosts /etc/hosts_hostminder_bak 294 | fi 295 | 296 | sed -i '/^[[:space:]]*$/d' /etc/hosts_hostminder_bak 297 | 298 | echo '# \nSetting up new hosts file\n' 299 | sleep 2 300 | if [ -f /tmp/bad.host.list.hostminder.txt ] 301 | then 302 | sleep 2 303 | sed -i '1i# GENERATED BY $APP_TITLE (${1^}): PLEASE DO NOT EDIT OR REMOVE THIS LINE' /tmp/bad.host.list.hostminder.txt 304 | cp /tmp/bad.host.list.hostminder.txt /etc/hosts 305 | 306 | if [ $3 ] 307 | then 308 | mv /tmp/hostminder.allow /opt/hostminder/allow 309 | fi 310 | 311 | echo '# \nAdding current hosts entries to new hosts file\n' 312 | sleep 2 313 | sed -i -e '/# Custom host records are listed here./r /etc/hosts_hostminder_bak' /etc/hosts 314 | 315 | echo '# \nEnabling Google Safe Search\n' 316 | sleep 2 317 | echo '# Google Safe Search - Host Minder' >> /etc/hosts 318 | echo '216.239.38.120 www.google.com #forcesafesearch' >> /etc/hosts 319 | echo '216.239.38.120 www.google.com #forcesafesearch' >> /etc/hosts 320 | echo '216.239.38.120 www.google.ad #forcesafesearch' >> /etc/hosts 321 | echo '216.239.38.120 www.google.ae #forcesafesearch' >> /etc/hosts 322 | echo '216.239.38.120 www.google.com.af #forcesafesearch' >> /etc/hosts 323 | echo '216.239.38.120 www.google.com.ag #forcesafesearch' >> /etc/hosts 324 | echo '216.239.38.120 www.google.com.ai #forcesafesearch' >> /etc/hosts 325 | echo '216.239.38.120 www.google.al #forcesafesearch' >> /etc/hosts 326 | echo '216.239.38.120 www.google.am #forcesafesearch' >> /etc/hosts 327 | echo '216.239.38.120 www.google.co.ao #forcesafesearch' >> /etc/hosts 328 | echo '216.239.38.120 www.google.com.ar #forcesafesearch' >> /etc/hosts 329 | echo '216.239.38.120 www.google.as #forcesafesearch' >> /etc/hosts 330 | echo '216.239.38.120 www.google.at #forcesafesearch' >> /etc/hosts 331 | echo '216.239.38.120 www.google.com.au #forcesafesearch' >> /etc/hosts 332 | echo '216.239.38.120 www.google.az #forcesafesearch' >> /etc/hosts 333 | echo '216.239.38.120 www.google.ba #forcesafesearch' >> /etc/hosts 334 | echo '216.239.38.120 www.google.com.bd #forcesafesearch' >> /etc/hosts 335 | echo '216.239.38.120 www.google.be #forcesafesearch' >> /etc/hosts 336 | echo '216.239.38.120 www.google.bf #forcesafesearch' >> /etc/hosts 337 | echo '216.239.38.120 www.google.bg #forcesafesearch' >> /etc/hosts 338 | echo '216.239.38.120 www.google.com.bh #forcesafesearch' >> /etc/hosts 339 | echo '216.239.38.120 www.google.bi #forcesafesearch' >> /etc/hosts 340 | echo '216.239.38.120 www.google.bj #forcesafesearch' >> /etc/hosts 341 | echo '216.239.38.120 www.google.com.bn #forcesafesearch' >> /etc/hosts 342 | echo '216.239.38.120 www.google.com.bo #forcesafesearch' >> /etc/hosts 343 | echo '216.239.38.120 www.google.com.br #forcesafesearch' >> /etc/hosts 344 | echo '216.239.38.120 www.google.bs #forcesafesearch' >> /etc/hosts 345 | echo '216.239.38.120 www.google.bt #forcesafesearch' >> /etc/hosts 346 | echo '216.239.38.120 www.google.co.bw #forcesafesearch' >> /etc/hosts 347 | echo '216.239.38.120 www.google.by #forcesafesearch' >> /etc/hosts 348 | echo '216.239.38.120 www.google.com.bz #forcesafesearch' >> /etc/hosts 349 | echo '216.239.38.120 www.google.ca #forcesafesearch' >> /etc/hosts 350 | echo '216.239.38.120 www.google.cd #forcesafesearch' >> /etc/hosts 351 | echo '216.239.38.120 www.google.cf #forcesafesearch' >> /etc/hosts 352 | echo '216.239.38.120 www.google.cg #forcesafesearch' >> /etc/hosts 353 | echo '216.239.38.120 www.google.ch #forcesafesearch' >> /etc/hosts 354 | echo '216.239.38.120 www.google.ci #forcesafesearch' >> /etc/hosts 355 | echo '216.239.38.120 www.google.co.ck #forcesafesearch' >> /etc/hosts 356 | echo '216.239.38.120 www.google.cl #forcesafesearch' >> /etc/hosts 357 | echo '216.239.38.120 www.google.cm #forcesafesearch' >> /etc/hosts 358 | echo '216.239.38.120 www.google.cn #forcesafesearch' >> /etc/hosts 359 | echo '216.239.38.120 www.google.com.co #forcesafesearch' >> /etc/hosts 360 | echo '216.239.38.120 www.google.co.cr #forcesafesearch' >> /etc/hosts 361 | echo '216.239.38.120 www.google.com.cu #forcesafesearch' >> /etc/hosts 362 | echo '216.239.38.120 www.google.cv #forcesafesearch' >> /etc/hosts 363 | echo '216.239.38.120 www.google.com.cy #forcesafesearch' >> /etc/hosts 364 | echo '216.239.38.120 www.google.cz #forcesafesearch' >> /etc/hosts 365 | echo '216.239.38.120 www.google.de #forcesafesearch' >> /etc/hosts 366 | echo '216.239.38.120 www.google.dj #forcesafesearch' >> /etc/hosts 367 | echo '216.239.38.120 www.google.dk #forcesafesearch' >> /etc/hosts 368 | echo '216.239.38.120 www.google.dm #forcesafesearch' >> /etc/hosts 369 | echo '216.239.38.120 www.google.com.do #forcesafesearch' >> /etc/hosts 370 | echo '216.239.38.120 www.google.dz #forcesafesearch' >> /etc/hosts 371 | echo '216.239.38.120 www.google.com.ec #forcesafesearch' >> /etc/hosts 372 | echo '216.239.38.120 www.google.ee #forcesafesearch' >> /etc/hosts 373 | echo '216.239.38.120 www.google.com.eg #forcesafesearch' >> /etc/hosts 374 | echo '216.239.38.120 www.google.es #forcesafesearch' >> /etc/hosts 375 | echo '216.239.38.120 www.google.com.et #forcesafesearch' >> /etc/hosts 376 | echo '216.239.38.120 www.google.fi #forcesafesearch' >> /etc/hosts 377 | echo '216.239.38.120 www.google.com.fj #forcesafesearch' >> /etc/hosts 378 | echo '216.239.38.120 www.google.fm #forcesafesearch' >> /etc/hosts 379 | echo '216.239.38.120 www.google.fr #forcesafesearch' >> /etc/hosts 380 | echo '216.239.38.120 www.google.ga #forcesafesearch' >> /etc/hosts 381 | echo '216.239.38.120 www.google.ge #forcesafesearch' >> /etc/hosts 382 | echo '216.239.38.120 www.google.gg #forcesafesearch' >> /etc/hosts 383 | echo '216.239.38.120 www.google.com.gh #forcesafesearch' >> /etc/hosts 384 | echo '216.239.38.120 www.google.com.gi #forcesafesearch' >> /etc/hosts 385 | echo '216.239.38.120 www.google.gl #forcesafesearch' >> /etc/hosts 386 | echo '216.239.38.120 www.google.gm #forcesafesearch' >> /etc/hosts 387 | echo '216.239.38.120 www.google.gr #forcesafesearch' >> /etc/hosts 388 | echo '216.239.38.120 www.google.com.gt #forcesafesearch' >> /etc/hosts 389 | echo '216.239.38.120 www.google.gy #forcesafesearch' >> /etc/hosts 390 | echo '216.239.38.120 www.google.com.hk #forcesafesearch' >> /etc/hosts 391 | echo '216.239.38.120 www.google.hn #forcesafesearch' >> /etc/hosts 392 | echo '216.239.38.120 www.google.hr #forcesafesearch' >> /etc/hosts 393 | echo '216.239.38.120 www.google.ht #forcesafesearch' >> /etc/hosts 394 | echo '216.239.38.120 www.google.hu #forcesafesearch' >> /etc/hosts 395 | echo '216.239.38.120 www.google.co.id #forcesafesearch' >> /etc/hosts 396 | echo '216.239.38.120 www.google.ie #forcesafesearch' >> /etc/hosts 397 | echo '216.239.38.120 www.google.co.il #forcesafesearch' >> /etc/hosts 398 | echo '216.239.38.120 www.google.im #forcesafesearch' >> /etc/hosts 399 | echo '216.239.38.120 www.google.co.in #forcesafesearch' >> /etc/hosts 400 | echo '216.239.38.120 www.google.iq #forcesafesearch' >> /etc/hosts 401 | echo '216.239.38.120 www.google.is #forcesafesearch' >> /etc/hosts 402 | echo '216.239.38.120 www.google.it #forcesafesearch' >> /etc/hosts 403 | echo '216.239.38.120 www.google.je #forcesafesearch' >> /etc/hosts 404 | echo '216.239.38.120 www.google.com.jm #forcesafesearch' >> /etc/hosts 405 | echo '216.239.38.120 www.google.jo #forcesafesearch' >> /etc/hosts 406 | echo '216.239.38.120 www.google.co.jp #forcesafesearch' >> /etc/hosts 407 | echo '216.239.38.120 www.google.co.ke #forcesafesearch' >> /etc/hosts 408 | echo '216.239.38.120 www.google.com.kh #forcesafesearch' >> /etc/hosts 409 | echo '216.239.38.120 www.google.ki #forcesafesearch' >> /etc/hosts 410 | echo '216.239.38.120 www.google.kg #forcesafesearch' >> /etc/hosts 411 | echo '216.239.38.120 www.google.co.kr #forcesafesearch' >> /etc/hosts 412 | echo '216.239.38.120 www.google.com.kw #forcesafesearch' >> /etc/hosts 413 | echo '216.239.38.120 www.google.kz #forcesafesearch' >> /etc/hosts 414 | echo '216.239.38.120 www.google.la #forcesafesearch' >> /etc/hosts 415 | echo '216.239.38.120 www.google.com.lb #forcesafesearch' >> /etc/hosts 416 | echo '216.239.38.120 www.google.li #forcesafesearch' >> /etc/hosts 417 | echo '216.239.38.120 www.google.lk #forcesafesearch' >> /etc/hosts 418 | echo '216.239.38.120 www.google.co.ls #forcesafesearch' >> /etc/hosts 419 | echo '216.239.38.120 www.google.lt #forcesafesearch' >> /etc/hosts 420 | echo '216.239.38.120 www.google.lu #forcesafesearch' >> /etc/hosts 421 | echo '216.239.38.120 www.google.lv #forcesafesearch' >> /etc/hosts 422 | echo '216.239.38.120 www.google.com.ly #forcesafesearch' >> /etc/hosts 423 | echo '216.239.38.120 www.google.co.ma #forcesafesearch' >> /etc/hosts 424 | echo '216.239.38.120 www.google.md #forcesafesearch' >> /etc/hosts 425 | echo '216.239.38.120 www.google.me #forcesafesearch' >> /etc/hosts 426 | echo '216.239.38.120 www.google.mg #forcesafesearch' >> /etc/hosts 427 | echo '216.239.38.120 www.google.mk #forcesafesearch' >> /etc/hosts 428 | echo '216.239.38.120 www.google.ml #forcesafesearch' >> /etc/hosts 429 | echo '216.239.38.120 www.google.com.mm #forcesafesearch' >> /etc/hosts 430 | echo '216.239.38.120 www.google.mn #forcesafesearch' >> /etc/hosts 431 | echo '216.239.38.120 www.google.ms #forcesafesearch' >> /etc/hosts 432 | echo '216.239.38.120 www.google.com.mt #forcesafesearch' >> /etc/hosts 433 | echo '216.239.38.120 www.google.mu #forcesafesearch' >> /etc/hosts 434 | echo '216.239.38.120 www.google.mv #forcesafesearch' >> /etc/hosts 435 | echo '216.239.38.120 www.google.mw #forcesafesearch' >> /etc/hosts 436 | echo '216.239.38.120 www.google.com.mx #forcesafesearch' >> /etc/hosts 437 | echo '216.239.38.120 www.google.com.my #forcesafesearch' >> /etc/hosts 438 | echo '216.239.38.120 www.google.co.mz #forcesafesearch' >> /etc/hosts 439 | echo '216.239.38.120 www.google.com.na #forcesafesearch' >> /etc/hosts 440 | echo '216.239.38.120 www.google.com.ng #forcesafesearch' >> /etc/hosts 441 | echo '216.239.38.120 www.google.com.ni #forcesafesearch' >> /etc/hosts 442 | echo '216.239.38.120 www.google.ne #forcesafesearch' >> /etc/hosts 443 | echo '216.239.38.120 www.google.nl #forcesafesearch' >> /etc/hosts 444 | echo '216.239.38.120 www.google.no #forcesafesearch' >> /etc/hosts 445 | echo '216.239.38.120 www.google.com.np #forcesafesearch' >> /etc/hosts 446 | echo '216.239.38.120 www.google.nr #forcesafesearch' >> /etc/hosts 447 | echo '216.239.38.120 www.google.nu #forcesafesearch' >> /etc/hosts 448 | echo '216.239.38.120 www.google.co.nz #forcesafesearch' >> /etc/hosts 449 | echo '216.239.38.120 www.google.com.om #forcesafesearch' >> /etc/hosts 450 | echo '216.239.38.120 www.google.com.pa #forcesafesearch' >> /etc/hosts 451 | echo '216.239.38.120 www.google.com.pe #forcesafesearch' >> /etc/hosts 452 | echo '216.239.38.120 www.google.com.pg #forcesafesearch' >> /etc/hosts 453 | echo '216.239.38.120 www.google.com.ph #forcesafesearch' >> /etc/hosts 454 | echo '216.239.38.120 www.google.com.pk #forcesafesearch' >> /etc/hosts 455 | echo '216.239.38.120 www.google.pl #forcesafesearch' >> /etc/hosts 456 | echo '216.239.38.120 www.google.pn #forcesafesearch' >> /etc/hosts 457 | echo '216.239.38.120 www.google.com.pr #forcesafesearch' >> /etc/hosts 458 | echo '216.239.38.120 www.google.ps #forcesafesearch' >> /etc/hosts 459 | echo '216.239.38.120 www.google.pt #forcesafesearch' >> /etc/hosts 460 | echo '216.239.38.120 www.google.com.py #forcesafesearch' >> /etc/hosts 461 | echo '216.239.38.120 www.google.com.qa #forcesafesearch' >> /etc/hosts 462 | echo '216.239.38.120 www.google.ro #forcesafesearch' >> /etc/hosts 463 | echo '216.239.38.120 www.google.ru #forcesafesearch' >> /etc/hosts 464 | echo '216.239.38.120 www.google.rw #forcesafesearch' >> /etc/hosts 465 | echo '216.239.38.120 www.google.com.sa #forcesafesearch' >> /etc/hosts 466 | echo '216.239.38.120 www.google.com.sb #forcesafesearch' >> /etc/hosts 467 | echo '216.239.38.120 www.google.sc #forcesafesearch' >> /etc/hosts 468 | echo '216.239.38.120 www.google.se #forcesafesearch' >> /etc/hosts 469 | echo '216.239.38.120 www.google.com.sg #forcesafesearch' >> /etc/hosts 470 | echo '216.239.38.120 www.google.sh #forcesafesearch' >> /etc/hosts 471 | echo '216.239.38.120 www.google.si #forcesafesearch' >> /etc/hosts 472 | echo '216.239.38.120 www.google.sk #forcesafesearch' >> /etc/hosts 473 | echo '216.239.38.120 www.google.com.sl #forcesafesearch' >> /etc/hosts 474 | echo '216.239.38.120 www.google.sn #forcesafesearch' >> /etc/hosts 475 | echo '216.239.38.120 www.google.so #forcesafesearch' >> /etc/hosts 476 | echo '216.239.38.120 www.google.sm #forcesafesearch' >> /etc/hosts 477 | echo '216.239.38.120 www.google.sr #forcesafesearch' >> /etc/hosts 478 | echo '216.239.38.120 www.google.st #forcesafesearch' >> /etc/hosts 479 | echo '216.239.38.120 www.google.com.sv #forcesafesearch' >> /etc/hosts 480 | echo '216.239.38.120 www.google.td #forcesafesearch' >> /etc/hosts 481 | echo '216.239.38.120 www.google.tg #forcesafesearch' >> /etc/hosts 482 | echo '216.239.38.120 www.google.co.th #forcesafesearch' >> /etc/hosts 483 | echo '216.239.38.120 www.google.com.tj #forcesafesearch' >> /etc/hosts 484 | echo '216.239.38.120 www.google.tl #forcesafesearch' >> /etc/hosts 485 | echo '216.239.38.120 www.google.tm #forcesafesearch' >> /etc/hosts 486 | echo '216.239.38.120 www.google.tn #forcesafesearch' >> /etc/hosts 487 | echo '216.239.38.120 www.google.to #forcesafesearch' >> /etc/hosts 488 | echo '216.239.38.120 www.google.com.tr #forcesafesearch' >> /etc/hosts 489 | echo '216.239.38.120 www.google.tt #forcesafesearch' >> /etc/hosts 490 | echo '216.239.38.120 www.google.com.tw #forcesafesearch' >> /etc/hosts 491 | echo '216.239.38.120 www.google.co.tz #forcesafesearch' >> /etc/hosts 492 | echo '216.239.38.120 www.google.com.ua #forcesafesearch' >> /etc/hosts 493 | echo '216.239.38.120 www.google.co.ug #forcesafesearch' >> /etc/hosts 494 | echo '216.239.38.120 www.google.co.uk #forcesafesearch' >> /etc/hosts 495 | echo '216.239.38.120 www.google.com.uy #forcesafesearch' >> /etc/hosts 496 | echo '216.239.38.120 www.google.co.uz #forcesafesearch' >> /etc/hosts 497 | echo '216.239.38.120 www.google.com.vc #forcesafesearch' >> /etc/hosts 498 | echo '216.239.38.120 www.google.co.ve #forcesafesearch' >> /etc/hosts 499 | echo '216.239.38.120 www.google.vg #forcesafesearch' >> /etc/hosts 500 | echo '216.239.38.120 www.google.co.vi #forcesafesearch' >> /etc/hosts 501 | echo '216.239.38.120 www.google.com.vn #forcesafesearch' >> /etc/hosts 502 | echo '216.239.38.120 www.google.vu #forcesafesearch' >> /etc/hosts 503 | echo '216.239.38.120 www.google.ws #forcesafesearch' >> /etc/hosts 504 | echo '216.239.38.120 www.google.rs #forcesafesearch' >> /etc/hosts 505 | echo '216.239.38.120 www.google.co.za #forcesafesearch' >> /etc/hosts 506 | echo '216.239.38.120 www.google.co.zm #forcesafesearch' >> /etc/hosts 507 | echo '216.239.38.120 www.google.co.zw #forcesafesearch' >> /etc/hosts 508 | echo '216.239.38.120 www.google.cat #forcesafesearch' >> /etc/hosts 509 | 510 | if ! grep -q '[^[:space:]]' /etc/hosts 511 | then 512 | echo '# \nSomething went wrong! Reverting to fallback hosts file.\n' 513 | sleep 2 514 | echo '$FALLBACK' | tee /etc/hosts 515 | else 516 | echo '# \nAdding auto update crontab\n' 517 | sleep 2 518 | crontab -l | grep -v 'hostminder' | crontab - 519 | (crontab -l && echo '0 0 * * 0 hostminder ${1}') | crontab - 520 | fi 521 | 522 | echo '# \nCleaning up\n' 523 | sleep 2 524 | rm /etc/hosts_hostminder_bak 525 | rm /tmp/bad.host.list.hostminder.txt 526 | fi 527 | " 528 | echo "# \nAll finished\n" 529 | sleep 2 530 | else 531 | if [ "$2" != "auto" ] 532 | then 533 | wget_failure 534 | fi 535 | fi 536 | 537 | ) | 538 | zenity --progress \ 539 | --title="$APP_TITLE: Progress" \ 540 | --width=400 \ 541 | --height=100 \ 542 | --percentage=0 \ 543 | --auto-close \ 544 | --auto-kill \ 545 | --no-cancel \ 546 | --pulsate \ 547 | --window-icon=/usr/share/pixmaps/hostminder.png 548 | 549 | (($? != 0)) && general_failure 550 | 551 | if [ "$2" != "auto" ] 552 | then 553 | settings 554 | fi 555 | } 556 | 557 | revert_hosts() { 558 | if [ "$1" != "auto" ] 559 | then 560 | confirm 561 | fi 562 | 563 | ( 564 | echo "# \nReverting to original hosts file\n" 565 | sleep 2 566 | pkexec bash -c " 567 | if grep -q 'GENERATED BY $APP_TITLE' /etc/hosts 568 | then 569 | echo '# \nExtracting custom entries\n' 570 | sleep 2 571 | sed -n '/# Custom host records are listed here./I,/# End of custom host records./I{ /# /Id; p }' /etc/hosts > /etc/hosts_hostminder_bak 572 | else 573 | echo '# \nBacking up current hosts file\n' 574 | sleep 2 575 | cp /etc/hosts /etc/hosts_hostminder_bak 576 | fi 577 | 578 | sed -i '/^[[:space:]]*$/d' /etc/hosts_hostminder_bak 579 | cp /etc/hosts_hostminder_bak /etc/hosts 580 | 581 | if ! grep -q '[^[:space:]]' /etc/hosts 582 | then 583 | echo '# \nSomething went wrong! Reverting to fallback hosts file\n' 584 | sleep 2 585 | echo '$FALLBACK' | tee /etc/hosts 586 | fi 587 | 588 | echo '# \nRemoving auto update crontab\n' 589 | sleep 2 590 | crontab -l | grep -v 'hostminder' | crontab - 591 | 592 | echo '# \nCleaning up\n' 593 | sleep 2 594 | rm /etc/hosts_hostminder_bak 595 | rm /tmp/bad.host.list.hostminder.txt 596 | " 597 | 598 | echo "# \nAll finished\n" 599 | sleep 2 600 | 601 | ) | 602 | zenity --progress \ 603 | --title="$APP_TITLE: Progress" \ 604 | --width=400 \ 605 | --height=100 \ 606 | --percentage=0 \ 607 | --auto-close \ 608 | --auto-kill \ 609 | --no-cancel \ 610 | --pulsate \ 611 | --window-icon=/usr/share/pixmaps/hostminder.png 612 | 613 | (($? != 0)) && zenity --window-icon=/usr/share/pixmaps/hostminder.png --error --text="Error in zenity command." 614 | 615 | if [ "$1" != "auto" ] 616 | then 617 | settings 618 | fi 619 | } 620 | 621 | if [ "$1" == "low" ] || [ "$1" == "medium" ] || [ "$1" == "high" ] || [ "$1" == "max" ] 622 | then 623 | update_hosts "$1" auto 624 | elif [ "$1" == "off" ] 625 | then 626 | revert_hosts auto 627 | else 628 | settings fresh 629 | fi 630 | 631 | -------------------------------------------------------------------------------- /deb/focal/hostminder_0.0.5_all/usr/share/applications/hostminder.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Encoding=UTF-8 4 | Name=Host Minder 5 | Comment=A graphical tool to setup a consolidated /etc/hosts file to block unwanted websites. 6 | Exec=hostminder 7 | Icon=hostminder.png 8 | Terminal=false 9 | Type=Application 10 | StartupNotify=true 11 | Categories=Application;System;Settings; 12 | Name[en_US]=Host Minder 13 | -------------------------------------------------------------------------------- /deb/focal/hostminder_0.0.5_all/usr/share/doc/hostminder/changelog.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/hostminder/82ca8d23602fab775dc99390fe48d6d80d56bd59/deb/focal/hostminder_0.0.5_all/usr/share/doc/hostminder/changelog.tar.xz -------------------------------------------------------------------------------- /deb/focal/hostminder_0.0.5_all/usr/share/doc/hostminder/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 | -------------------------------------------------------------------------------- /deb/focal/hostminder_0.0.5_all/usr/share/pixmaps/hostminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/hostminder/82ca8d23602fab775dc99390fe48d6d80d56bd59/deb/focal/hostminder_0.0.5_all/usr/share/pixmaps/hostminder.png -------------------------------------------------------------------------------- /deb/jammy/hostminder_0.0.8_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/hostminder/82ca8d23602fab775dc99390fe48d6d80d56bd59/deb/jammy/hostminder_0.0.8_all.deb -------------------------------------------------------------------------------- /deb/jammy/hostminder_0.0.8_all/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: hostminder 2 | Version: 0.0.8 3 | Section: web 4 | Priority: optional 5 | Architecture: all 6 | Maintainer: Jereme Hancock 7 | Installed-Size: 51.7 8 | Depends: zenity, gedit 9 | Description: Host Minder 10 | 11 | -------------------------------------------------------------------------------- /deb/jammy/hostminder_0.0.8_all/DEBIAN/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir /opt/hostminder 4 | touch /opt/hostminder/allow 5 | echo $'# Host Minder Allow List\n# Add one domain per line below (Do not include http:// or https://)' > /opt/hostminder/allow 6 | 7 | exit 0 8 | -------------------------------------------------------------------------------- /deb/jammy/hostminder_0.0.8_all/usr/bin/hostminder: -------------------------------------------------------------------------------- 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="Host Minder" 27 | 28 | check_status() { 29 | HOSTS=$(head /etc/hosts | grep "GENERATED BY $APP_TITLE" | awk '{print $0}') 30 | STEVEN=$(head /etc/hosts | grep "Title: StevenBlack/hosts" | awk '{print $0}') 31 | if [[ $HOSTS == "# GENERATED BY $APP_TITLE"* ]] || [[ $STEVEN == "# Title: StevenBlack/hosts"* ]] 32 | then 33 | echo "ON" 34 | else 35 | echo "OFF" 36 | fi 37 | } 38 | 39 | get_toggle() { 40 | STATUS=$(check_status) 41 | if [[ $STATUS == *"ON"* ]] 42 | then 43 | echo "OFF" 44 | else 45 | echo "ON" 46 | fi 47 | } 48 | 49 | get_status_color() { 50 | STATUS=$(check_status) 51 | if [[ $STATUS == *"ON"* ]] 52 | then 53 | echo "#228B22" 54 | else 55 | echo "#CC0000" 56 | fi 57 | } 58 | 59 | get_level() { 60 | LEVEL=$(head /etc/hosts | grep "GENERATED BY $APP_TITLE" | awk '{print $6}') 61 | if [[ $LEVEL ]] 62 | then 63 | echo "\n\nCurrent Protection Level: $LEVEL" 64 | fi 65 | } 66 | 67 | get_total_domains() { 68 | DOMAINS=$(head /etc/hosts | grep "# Number of unique domains" | awk '{print $6}') 69 | if [[ $DOMAINS ]] 70 | then 71 | echo "\n\nTotal Unique Domains: $DOMAINS" 72 | fi 73 | } 74 | 75 | check_safe_searchstatus() { 76 | STATUS=$(grep "# Google Safe Search - Host Minder" /etc/hosts | awk '{print $0}') 77 | if [[ $STATUS ]] 78 | then 79 | echo "ENABLED" 80 | else 81 | echo "DISABLED" 82 | fi 83 | } 84 | 85 | get_safe_searchstatus_color() { 86 | STATUS=$(check_safe_searchstatus) 87 | if [[ $STATUS == *"ENABLED"* ]] 88 | then 89 | echo "#228B22" 90 | else 91 | echo "#CC0000" 92 | fi 93 | } 94 | 95 | settings() { 96 | STATUS=$(check_status) 97 | STATUS_COLOR=$(get_status_color) 98 | TOGGLE=$(get_toggle) 99 | LEVEL=$(get_level) 100 | DOMAINS=$(get_total_domains) 101 | SAFESEARCH_STATUS=$(check_safe_searchstatus) 102 | SAFESEARCH_STATUS_COLOR=$(get_safe_searchstatus_color) 103 | if [[ $STATUS == "ON" ]] 104 | then 105 | UPDATE="Change/Update Protection Level" 106 | ALLOW="Edit Allow List" 107 | HELP="What's Host Minder?" 108 | else 109 | UPDATE="What's Host Minder?" 110 | ALLOW="" 111 | HELP="" 112 | fi 113 | SWITCH=$(zenity --window-icon=/usr/share/pixmaps/hostminder.png --list --title="$APP_TITLE: Settings" --width=400 --height=350 --text="Status: $STATUS$LEVEL$DOMAINS\n\nGoogle Safe Search: $SAFESEARCH_STATUS\n" --column= --hide-header "Turn $TOGGLE" "$UPDATE" "$ALLOW" "$HELP") 114 | case $SWITCH in 115 | 116 | "Turn ON") 117 | select_level fresh 118 | ;; 119 | 120 | "Turn OFF") 121 | revert_hosts 122 | ;; 123 | 124 | "Change/Update Protection Level") 125 | select_level 126 | ;; 127 | 128 | "Edit Allow List") 129 | cp /opt/hostminder/allow /tmp/hostminder.allow 130 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --info --title "$APP_TITLE" --width=500 --text $"\nThe Allow List only affects domains blocked by Host Minder.\n\nKeep in mind that DNS Minder may still be blocking the domain." 131 | gedit -w /tmp/hostminder.allow 132 | sed -i '/^[[:space:]]*$/d' /tmp/hostminder.allow 133 | confirm_save_allow_list 134 | settings 135 | ;; 136 | 137 | "What's Host Minder?") 138 | xdg-open "https://github.com/mhancoc7/hostminder#readme" 139 | settings 140 | ;; 141 | 142 | *) 143 | exit 1 144 | ;; 145 | esac 146 | } 147 | 148 | select_level() { 149 | if [[ $1 == "fresh" ]] 150 | then 151 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --info --title "$APP_TITLE" --width=450 --text $"\nThis tool will download and setup a new /etc/hosts file.\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." 152 | fi 153 | STATUS=$(check_status) 154 | STATUS_COLOR=$(get_status_color) 155 | LEVEL=$(get_level) 156 | DOMAINS=$(get_total_domains) 157 | SAFESEARCH_STATUS=$(check_safe_searchstatus) 158 | SAFESEARCH_STATUS_COLOR=$(get_safe_searchstatus_color) 159 | SELECT=$(zenity --window-icon=/usr/share/pixmaps/hostminder.png --list --title="$APP_TITLE: Settings" --width=400 --height=350 --text="Status: $STATUS$LEVEL$DOMAINS\n\nGoogle Safe Search: $SAFESEARCH_STATUS\n\nSelect Protection Level" --column=Name --column=Description Max "Ads / Porn / Gambling / Social / Fake News" High "Ads / Porn / Gambling / Social" Medium "Ads / Porn / Gambling" Low "Ads / Porn") 160 | case $SELECT in 161 | 162 | "Max") 163 | update_hosts max 164 | ;; 165 | 166 | "High") 167 | update_hosts high 168 | ;; 169 | 170 | "Medium") 171 | update_hosts medium 172 | ;; 173 | 174 | "Low") 175 | update_hosts low 176 | ;; 177 | 178 | *) 179 | settings 180 | ;; 181 | esac 182 | } 183 | 184 | confirm() { 185 | if 186 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --question --title "$APP_TITLE" --no-wrap --text="\nAre you sure?" 187 | then 188 | return 189 | else 190 | settings 191 | fi 192 | } 193 | 194 | confirm_save_allow_list() { 195 | if 196 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --question --title "$APP_TITLE" --no-wrap --text="\nSave & Apply Allow List?" 197 | then 198 | if [[ "$LEVEL" == "\n\nCurrent Protection Level: (Max):" ]] 199 | then 200 | update_hosts max auto allow 201 | elif [[ "$LEVEL" == "\n\nCurrent Protection Level: (High):" ]] 202 | then 203 | update_hosts high auto allow 204 | elif [[ "$LEVEL" == "\n\nCurrent Protection Level: (Medium):" ]] 205 | then 206 | update_hosts medium auto allow 207 | elif [[ "$LEVEL" == "\n\nCurrent Protection Level: (Low):" ]] 208 | then 209 | update_hosts low auto allow 210 | else 211 | return 212 | fi 213 | else 214 | settings 215 | fi 216 | } 217 | 218 | general_failure() { 219 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --error --title "$APP_TITLE" --no-wrap --text="\nSomething went wrong!" 220 | } 221 | 222 | wget_failure() { 223 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --error --title "$APP_TITLE" --no-wrap --text="\nCould not download hosts file.\n\nPlease check your internet connection!" 224 | } 225 | 226 | FALLBACK="127.0.0.1 localhost 227 | 127.0.0.1 localhost.localdomain 228 | 127.0.0.1 local 229 | 255.255.255.255 broadcasthost 230 | ::1 localhost 231 | ::1 ip6-localhost 232 | ::1 ip6-loopback 233 | fe80::1%lo0 localhost 234 | ff00::0 ip6-localnet 235 | ff00::0 ip6-mcastprefix 236 | ff02::1 ip6-allnodes 237 | ff02::2 ip6-allrouters 238 | ff02::3 ip6-allhosts 239 | 0.0.0.0 0.0.0.0 240 | " 241 | 242 | update_hosts() { 243 | if [ "$2" != "auto" ] 244 | then 245 | confirm 246 | fi 247 | 248 | if [[ "$1" == "max" ]] 249 | then 250 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts" 251 | elif [[ "$1" == "high" ]] 252 | then 253 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn-social/hosts" 254 | elif [[ "$1" == "medium" ]] 255 | then 256 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn/hosts" 257 | elif [[ "$1" == "low" ]] 258 | then 259 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn/hosts" 260 | else 261 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn/hosts" 262 | fi 263 | ( 264 | echo "# \nGetting new hosts file (${1^})\n" 265 | sleep 2 266 | if wget -q "$LIST" -O /tmp/bad.host.list.hostminder.txt 267 | then 268 | echo "# \nApplying Allow List\n" 269 | sleep 2 270 | 271 | if [ -f /tmp/hostminder.allow ] 272 | then 273 | while read line; do 274 | if [[ ${line} != *"#"* ]] 275 | then 276 | sed -i "/$line/d" /tmp/bad.host.list.hostminder.txt 277 | fi 278 | done /etc/hosts_hostminder_bak 292 | else 293 | echo '# \nBacking up current hosts file\n' 294 | sleep 2 295 | cp /etc/hosts /etc/hosts_hostminder_bak 296 | fi 297 | 298 | sed -i '/^[[:space:]]*$/d' /etc/hosts_hostminder_bak 299 | 300 | echo '# \nSetting up new hosts file\n' 301 | sleep 2 302 | if [ -f /tmp/bad.host.list.hostminder.txt ] 303 | then 304 | sleep 2 305 | sed -i '1i# GENERATED BY $APP_TITLE (${1^}): PLEASE DO NOT EDIT OR REMOVE THIS LINE' /tmp/bad.host.list.hostminder.txt 306 | cp /tmp/bad.host.list.hostminder.txt /etc/hosts 307 | 308 | if [ $3 ] 309 | then 310 | mv /tmp/hostminder.allow /opt/hostminder/allow 311 | fi 312 | 313 | echo '# \nAdding current hosts entries to new hosts file\n' 314 | sleep 2 315 | sed -i -e '/# Custom host records are listed here./r /etc/hosts_hostminder_bak' /etc/hosts 316 | 317 | echo '# \nEnabling Google Safe Search\n' 318 | sleep 2 319 | echo '# Google Safe Search - Host Minder' >> /etc/hosts 320 | echo '216.239.38.120 www.google.com #forcesafesearch' >> /etc/hosts 321 | echo '216.239.38.120 www.google.com #forcesafesearch' >> /etc/hosts 322 | echo '216.239.38.120 www.google.ad #forcesafesearch' >> /etc/hosts 323 | echo '216.239.38.120 www.google.ae #forcesafesearch' >> /etc/hosts 324 | echo '216.239.38.120 www.google.com.af #forcesafesearch' >> /etc/hosts 325 | echo '216.239.38.120 www.google.com.ag #forcesafesearch' >> /etc/hosts 326 | echo '216.239.38.120 www.google.com.ai #forcesafesearch' >> /etc/hosts 327 | echo '216.239.38.120 www.google.al #forcesafesearch' >> /etc/hosts 328 | echo '216.239.38.120 www.google.am #forcesafesearch' >> /etc/hosts 329 | echo '216.239.38.120 www.google.co.ao #forcesafesearch' >> /etc/hosts 330 | echo '216.239.38.120 www.google.com.ar #forcesafesearch' >> /etc/hosts 331 | echo '216.239.38.120 www.google.as #forcesafesearch' >> /etc/hosts 332 | echo '216.239.38.120 www.google.at #forcesafesearch' >> /etc/hosts 333 | echo '216.239.38.120 www.google.com.au #forcesafesearch' >> /etc/hosts 334 | echo '216.239.38.120 www.google.az #forcesafesearch' >> /etc/hosts 335 | echo '216.239.38.120 www.google.ba #forcesafesearch' >> /etc/hosts 336 | echo '216.239.38.120 www.google.com.bd #forcesafesearch' >> /etc/hosts 337 | echo '216.239.38.120 www.google.be #forcesafesearch' >> /etc/hosts 338 | echo '216.239.38.120 www.google.bf #forcesafesearch' >> /etc/hosts 339 | echo '216.239.38.120 www.google.bg #forcesafesearch' >> /etc/hosts 340 | echo '216.239.38.120 www.google.com.bh #forcesafesearch' >> /etc/hosts 341 | echo '216.239.38.120 www.google.bi #forcesafesearch' >> /etc/hosts 342 | echo '216.239.38.120 www.google.bj #forcesafesearch' >> /etc/hosts 343 | echo '216.239.38.120 www.google.com.bn #forcesafesearch' >> /etc/hosts 344 | echo '216.239.38.120 www.google.com.bo #forcesafesearch' >> /etc/hosts 345 | echo '216.239.38.120 www.google.com.br #forcesafesearch' >> /etc/hosts 346 | echo '216.239.38.120 www.google.bs #forcesafesearch' >> /etc/hosts 347 | echo '216.239.38.120 www.google.bt #forcesafesearch' >> /etc/hosts 348 | echo '216.239.38.120 www.google.co.bw #forcesafesearch' >> /etc/hosts 349 | echo '216.239.38.120 www.google.by #forcesafesearch' >> /etc/hosts 350 | echo '216.239.38.120 www.google.com.bz #forcesafesearch' >> /etc/hosts 351 | echo '216.239.38.120 www.google.ca #forcesafesearch' >> /etc/hosts 352 | echo '216.239.38.120 www.google.cd #forcesafesearch' >> /etc/hosts 353 | echo '216.239.38.120 www.google.cf #forcesafesearch' >> /etc/hosts 354 | echo '216.239.38.120 www.google.cg #forcesafesearch' >> /etc/hosts 355 | echo '216.239.38.120 www.google.ch #forcesafesearch' >> /etc/hosts 356 | echo '216.239.38.120 www.google.ci #forcesafesearch' >> /etc/hosts 357 | echo '216.239.38.120 www.google.co.ck #forcesafesearch' >> /etc/hosts 358 | echo '216.239.38.120 www.google.cl #forcesafesearch' >> /etc/hosts 359 | echo '216.239.38.120 www.google.cm #forcesafesearch' >> /etc/hosts 360 | echo '216.239.38.120 www.google.cn #forcesafesearch' >> /etc/hosts 361 | echo '216.239.38.120 www.google.com.co #forcesafesearch' >> /etc/hosts 362 | echo '216.239.38.120 www.google.co.cr #forcesafesearch' >> /etc/hosts 363 | echo '216.239.38.120 www.google.com.cu #forcesafesearch' >> /etc/hosts 364 | echo '216.239.38.120 www.google.cv #forcesafesearch' >> /etc/hosts 365 | echo '216.239.38.120 www.google.com.cy #forcesafesearch' >> /etc/hosts 366 | echo '216.239.38.120 www.google.cz #forcesafesearch' >> /etc/hosts 367 | echo '216.239.38.120 www.google.de #forcesafesearch' >> /etc/hosts 368 | echo '216.239.38.120 www.google.dj #forcesafesearch' >> /etc/hosts 369 | echo '216.239.38.120 www.google.dk #forcesafesearch' >> /etc/hosts 370 | echo '216.239.38.120 www.google.dm #forcesafesearch' >> /etc/hosts 371 | echo '216.239.38.120 www.google.com.do #forcesafesearch' >> /etc/hosts 372 | echo '216.239.38.120 www.google.dz #forcesafesearch' >> /etc/hosts 373 | echo '216.239.38.120 www.google.com.ec #forcesafesearch' >> /etc/hosts 374 | echo '216.239.38.120 www.google.ee #forcesafesearch' >> /etc/hosts 375 | echo '216.239.38.120 www.google.com.eg #forcesafesearch' >> /etc/hosts 376 | echo '216.239.38.120 www.google.es #forcesafesearch' >> /etc/hosts 377 | echo '216.239.38.120 www.google.com.et #forcesafesearch' >> /etc/hosts 378 | echo '216.239.38.120 www.google.fi #forcesafesearch' >> /etc/hosts 379 | echo '216.239.38.120 www.google.com.fj #forcesafesearch' >> /etc/hosts 380 | echo '216.239.38.120 www.google.fm #forcesafesearch' >> /etc/hosts 381 | echo '216.239.38.120 www.google.fr #forcesafesearch' >> /etc/hosts 382 | echo '216.239.38.120 www.google.ga #forcesafesearch' >> /etc/hosts 383 | echo '216.239.38.120 www.google.ge #forcesafesearch' >> /etc/hosts 384 | echo '216.239.38.120 www.google.gg #forcesafesearch' >> /etc/hosts 385 | echo '216.239.38.120 www.google.com.gh #forcesafesearch' >> /etc/hosts 386 | echo '216.239.38.120 www.google.com.gi #forcesafesearch' >> /etc/hosts 387 | echo '216.239.38.120 www.google.gl #forcesafesearch' >> /etc/hosts 388 | echo '216.239.38.120 www.google.gm #forcesafesearch' >> /etc/hosts 389 | echo '216.239.38.120 www.google.gr #forcesafesearch' >> /etc/hosts 390 | echo '216.239.38.120 www.google.com.gt #forcesafesearch' >> /etc/hosts 391 | echo '216.239.38.120 www.google.gy #forcesafesearch' >> /etc/hosts 392 | echo '216.239.38.120 www.google.com.hk #forcesafesearch' >> /etc/hosts 393 | echo '216.239.38.120 www.google.hn #forcesafesearch' >> /etc/hosts 394 | echo '216.239.38.120 www.google.hr #forcesafesearch' >> /etc/hosts 395 | echo '216.239.38.120 www.google.ht #forcesafesearch' >> /etc/hosts 396 | echo '216.239.38.120 www.google.hu #forcesafesearch' >> /etc/hosts 397 | echo '216.239.38.120 www.google.co.id #forcesafesearch' >> /etc/hosts 398 | echo '216.239.38.120 www.google.ie #forcesafesearch' >> /etc/hosts 399 | echo '216.239.38.120 www.google.co.il #forcesafesearch' >> /etc/hosts 400 | echo '216.239.38.120 www.google.im #forcesafesearch' >> /etc/hosts 401 | echo '216.239.38.120 www.google.co.in #forcesafesearch' >> /etc/hosts 402 | echo '216.239.38.120 www.google.iq #forcesafesearch' >> /etc/hosts 403 | echo '216.239.38.120 www.google.is #forcesafesearch' >> /etc/hosts 404 | echo '216.239.38.120 www.google.it #forcesafesearch' >> /etc/hosts 405 | echo '216.239.38.120 www.google.je #forcesafesearch' >> /etc/hosts 406 | echo '216.239.38.120 www.google.com.jm #forcesafesearch' >> /etc/hosts 407 | echo '216.239.38.120 www.google.jo #forcesafesearch' >> /etc/hosts 408 | echo '216.239.38.120 www.google.co.jp #forcesafesearch' >> /etc/hosts 409 | echo '216.239.38.120 www.google.co.ke #forcesafesearch' >> /etc/hosts 410 | echo '216.239.38.120 www.google.com.kh #forcesafesearch' >> /etc/hosts 411 | echo '216.239.38.120 www.google.ki #forcesafesearch' >> /etc/hosts 412 | echo '216.239.38.120 www.google.kg #forcesafesearch' >> /etc/hosts 413 | echo '216.239.38.120 www.google.co.kr #forcesafesearch' >> /etc/hosts 414 | echo '216.239.38.120 www.google.com.kw #forcesafesearch' >> /etc/hosts 415 | echo '216.239.38.120 www.google.kz #forcesafesearch' >> /etc/hosts 416 | echo '216.239.38.120 www.google.la #forcesafesearch' >> /etc/hosts 417 | echo '216.239.38.120 www.google.com.lb #forcesafesearch' >> /etc/hosts 418 | echo '216.239.38.120 www.google.li #forcesafesearch' >> /etc/hosts 419 | echo '216.239.38.120 www.google.lk #forcesafesearch' >> /etc/hosts 420 | echo '216.239.38.120 www.google.co.ls #forcesafesearch' >> /etc/hosts 421 | echo '216.239.38.120 www.google.lt #forcesafesearch' >> /etc/hosts 422 | echo '216.239.38.120 www.google.lu #forcesafesearch' >> /etc/hosts 423 | echo '216.239.38.120 www.google.lv #forcesafesearch' >> /etc/hosts 424 | echo '216.239.38.120 www.google.com.ly #forcesafesearch' >> /etc/hosts 425 | echo '216.239.38.120 www.google.co.ma #forcesafesearch' >> /etc/hosts 426 | echo '216.239.38.120 www.google.md #forcesafesearch' >> /etc/hosts 427 | echo '216.239.38.120 www.google.me #forcesafesearch' >> /etc/hosts 428 | echo '216.239.38.120 www.google.mg #forcesafesearch' >> /etc/hosts 429 | echo '216.239.38.120 www.google.mk #forcesafesearch' >> /etc/hosts 430 | echo '216.239.38.120 www.google.ml #forcesafesearch' >> /etc/hosts 431 | echo '216.239.38.120 www.google.com.mm #forcesafesearch' >> /etc/hosts 432 | echo '216.239.38.120 www.google.mn #forcesafesearch' >> /etc/hosts 433 | echo '216.239.38.120 www.google.ms #forcesafesearch' >> /etc/hosts 434 | echo '216.239.38.120 www.google.com.mt #forcesafesearch' >> /etc/hosts 435 | echo '216.239.38.120 www.google.mu #forcesafesearch' >> /etc/hosts 436 | echo '216.239.38.120 www.google.mv #forcesafesearch' >> /etc/hosts 437 | echo '216.239.38.120 www.google.mw #forcesafesearch' >> /etc/hosts 438 | echo '216.239.38.120 www.google.com.mx #forcesafesearch' >> /etc/hosts 439 | echo '216.239.38.120 www.google.com.my #forcesafesearch' >> /etc/hosts 440 | echo '216.239.38.120 www.google.co.mz #forcesafesearch' >> /etc/hosts 441 | echo '216.239.38.120 www.google.com.na #forcesafesearch' >> /etc/hosts 442 | echo '216.239.38.120 www.google.com.ng #forcesafesearch' >> /etc/hosts 443 | echo '216.239.38.120 www.google.com.ni #forcesafesearch' >> /etc/hosts 444 | echo '216.239.38.120 www.google.ne #forcesafesearch' >> /etc/hosts 445 | echo '216.239.38.120 www.google.nl #forcesafesearch' >> /etc/hosts 446 | echo '216.239.38.120 www.google.no #forcesafesearch' >> /etc/hosts 447 | echo '216.239.38.120 www.google.com.np #forcesafesearch' >> /etc/hosts 448 | echo '216.239.38.120 www.google.nr #forcesafesearch' >> /etc/hosts 449 | echo '216.239.38.120 www.google.nu #forcesafesearch' >> /etc/hosts 450 | echo '216.239.38.120 www.google.co.nz #forcesafesearch' >> /etc/hosts 451 | echo '216.239.38.120 www.google.com.om #forcesafesearch' >> /etc/hosts 452 | echo '216.239.38.120 www.google.com.pa #forcesafesearch' >> /etc/hosts 453 | echo '216.239.38.120 www.google.com.pe #forcesafesearch' >> /etc/hosts 454 | echo '216.239.38.120 www.google.com.pg #forcesafesearch' >> /etc/hosts 455 | echo '216.239.38.120 www.google.com.ph #forcesafesearch' >> /etc/hosts 456 | echo '216.239.38.120 www.google.com.pk #forcesafesearch' >> /etc/hosts 457 | echo '216.239.38.120 www.google.pl #forcesafesearch' >> /etc/hosts 458 | echo '216.239.38.120 www.google.pn #forcesafesearch' >> /etc/hosts 459 | echo '216.239.38.120 www.google.com.pr #forcesafesearch' >> /etc/hosts 460 | echo '216.239.38.120 www.google.ps #forcesafesearch' >> /etc/hosts 461 | echo '216.239.38.120 www.google.pt #forcesafesearch' >> /etc/hosts 462 | echo '216.239.38.120 www.google.com.py #forcesafesearch' >> /etc/hosts 463 | echo '216.239.38.120 www.google.com.qa #forcesafesearch' >> /etc/hosts 464 | echo '216.239.38.120 www.google.ro #forcesafesearch' >> /etc/hosts 465 | echo '216.239.38.120 www.google.ru #forcesafesearch' >> /etc/hosts 466 | echo '216.239.38.120 www.google.rw #forcesafesearch' >> /etc/hosts 467 | echo '216.239.38.120 www.google.com.sa #forcesafesearch' >> /etc/hosts 468 | echo '216.239.38.120 www.google.com.sb #forcesafesearch' >> /etc/hosts 469 | echo '216.239.38.120 www.google.sc #forcesafesearch' >> /etc/hosts 470 | echo '216.239.38.120 www.google.se #forcesafesearch' >> /etc/hosts 471 | echo '216.239.38.120 www.google.com.sg #forcesafesearch' >> /etc/hosts 472 | echo '216.239.38.120 www.google.sh #forcesafesearch' >> /etc/hosts 473 | echo '216.239.38.120 www.google.si #forcesafesearch' >> /etc/hosts 474 | echo '216.239.38.120 www.google.sk #forcesafesearch' >> /etc/hosts 475 | echo '216.239.38.120 www.google.com.sl #forcesafesearch' >> /etc/hosts 476 | echo '216.239.38.120 www.google.sn #forcesafesearch' >> /etc/hosts 477 | echo '216.239.38.120 www.google.so #forcesafesearch' >> /etc/hosts 478 | echo '216.239.38.120 www.google.sm #forcesafesearch' >> /etc/hosts 479 | echo '216.239.38.120 www.google.sr #forcesafesearch' >> /etc/hosts 480 | echo '216.239.38.120 www.google.st #forcesafesearch' >> /etc/hosts 481 | echo '216.239.38.120 www.google.com.sv #forcesafesearch' >> /etc/hosts 482 | echo '216.239.38.120 www.google.td #forcesafesearch' >> /etc/hosts 483 | echo '216.239.38.120 www.google.tg #forcesafesearch' >> /etc/hosts 484 | echo '216.239.38.120 www.google.co.th #forcesafesearch' >> /etc/hosts 485 | echo '216.239.38.120 www.google.com.tj #forcesafesearch' >> /etc/hosts 486 | echo '216.239.38.120 www.google.tl #forcesafesearch' >> /etc/hosts 487 | echo '216.239.38.120 www.google.tm #forcesafesearch' >> /etc/hosts 488 | echo '216.239.38.120 www.google.tn #forcesafesearch' >> /etc/hosts 489 | echo '216.239.38.120 www.google.to #forcesafesearch' >> /etc/hosts 490 | echo '216.239.38.120 www.google.com.tr #forcesafesearch' >> /etc/hosts 491 | echo '216.239.38.120 www.google.tt #forcesafesearch' >> /etc/hosts 492 | echo '216.239.38.120 www.google.com.tw #forcesafesearch' >> /etc/hosts 493 | echo '216.239.38.120 www.google.co.tz #forcesafesearch' >> /etc/hosts 494 | echo '216.239.38.120 www.google.com.ua #forcesafesearch' >> /etc/hosts 495 | echo '216.239.38.120 www.google.co.ug #forcesafesearch' >> /etc/hosts 496 | echo '216.239.38.120 www.google.co.uk #forcesafesearch' >> /etc/hosts 497 | echo '216.239.38.120 www.google.com.uy #forcesafesearch' >> /etc/hosts 498 | echo '216.239.38.120 www.google.co.uz #forcesafesearch' >> /etc/hosts 499 | echo '216.239.38.120 www.google.com.vc #forcesafesearch' >> /etc/hosts 500 | echo '216.239.38.120 www.google.co.ve #forcesafesearch' >> /etc/hosts 501 | echo '216.239.38.120 www.google.vg #forcesafesearch' >> /etc/hosts 502 | echo '216.239.38.120 www.google.co.vi #forcesafesearch' >> /etc/hosts 503 | echo '216.239.38.120 www.google.com.vn #forcesafesearch' >> /etc/hosts 504 | echo '216.239.38.120 www.google.vu #forcesafesearch' >> /etc/hosts 505 | echo '216.239.38.120 www.google.ws #forcesafesearch' >> /etc/hosts 506 | echo '216.239.38.120 www.google.rs #forcesafesearch' >> /etc/hosts 507 | echo '216.239.38.120 www.google.co.za #forcesafesearch' >> /etc/hosts 508 | echo '216.239.38.120 www.google.co.zm #forcesafesearch' >> /etc/hosts 509 | echo '216.239.38.120 www.google.co.zw #forcesafesearch' >> /etc/hosts 510 | echo '216.239.38.120 www.google.cat #forcesafesearch' >> /etc/hosts 511 | 512 | if ! grep -q '[^[:space:]]' /etc/hosts 513 | then 514 | echo '# \nSomething went wrong! Reverting to fallback hosts file.\n' 515 | sleep 2 516 | echo '$FALLBACK' | tee /etc/hosts 517 | else 518 | echo '# \nAdding auto update crontab\n' 519 | sleep 2 520 | crontab -l | grep -v 'hostminder' | crontab - 521 | (crontab -l && echo '0 0 * * 0 hostminder ${1}') | crontab - 522 | fi 523 | 524 | echo '# \nCleaning up\n' 525 | sleep 2 526 | rm /etc/hosts_hostminder_bak 527 | rm /tmp/bad.host.list.hostminder.txt 528 | fi 529 | " 530 | echo "# \nAll finished\n" 531 | sleep 2 532 | else 533 | if [ "$2" != "auto" ] 534 | then 535 | wget_failure 536 | fi 537 | fi 538 | 539 | ) | 540 | zenity --progress \ 541 | --title="$APP_TITLE: Progress" \ 542 | --width=400 \ 543 | --height=100 \ 544 | --percentage=0 \ 545 | --auto-close \ 546 | --auto-kill \ 547 | --no-cancel \ 548 | --pulsate \ 549 | --window-icon=/usr/share/pixmaps/hostminder.png 550 | 551 | (($? != 0)) && general_failure 552 | 553 | if [ "$2" != "auto" ] 554 | then 555 | settings 556 | fi 557 | } 558 | 559 | revert_hosts() { 560 | if [ "$1" != "auto" ] 561 | then 562 | confirm 563 | fi 564 | 565 | ( 566 | echo "# \nReverting to original hosts file\n" 567 | sleep 2 568 | pkexec bash -c " 569 | if grep -q 'GENERATED BY $APP_TITLE' /etc/hosts 570 | then 571 | echo '# \nExtracting custom entries\n' 572 | sleep 2 573 | sed -n '/# Custom host records are listed here./I,/# End of custom host records./I{ /# /Id; p }' /etc/hosts > /etc/hosts_hostminder_bak 574 | else 575 | echo '# \nBacking up current hosts file\n' 576 | sleep 2 577 | cp /etc/hosts /etc/hosts_hostminder_bak 578 | fi 579 | 580 | sed -i '/^[[:space:]]*$/d' /etc/hosts_hostminder_bak 581 | cp /etc/hosts_hostminder_bak /etc/hosts 582 | 583 | if ! grep -q '[^[:space:]]' /etc/hosts 584 | then 585 | echo '# \nSomething went wrong! Reverting to fallback hosts file\n' 586 | sleep 2 587 | echo '$FALLBACK' | tee /etc/hosts 588 | fi 589 | 590 | echo '# \nRemoving auto update crontab\n' 591 | sleep 2 592 | crontab -l | grep -v 'hostminder' | crontab - 593 | 594 | echo '# \nCleaning up\n' 595 | sleep 2 596 | rm /etc/hosts_hostminder_bak 597 | rm /tmp/bad.host.list.hostminder.txt 598 | " 599 | 600 | echo "# \nAll finished\n" 601 | sleep 2 602 | 603 | ) | 604 | zenity --progress \ 605 | --title="$APP_TITLE: Progress" \ 606 | --width=400 \ 607 | --height=100 \ 608 | --percentage=0 \ 609 | --auto-close \ 610 | --auto-kill \ 611 | --no-cancel \ 612 | --pulsate \ 613 | --window-icon=/usr/share/pixmaps/hostminder.png 614 | 615 | (($? != 0)) && zenity --window-icon=/usr/share/pixmaps/hostminder.png --error --text="Error in zenity command." 616 | 617 | if [ "$1" != "auto" ] 618 | then 619 | settings 620 | fi 621 | } 622 | 623 | if [ "$1" == "low" ] || [ "$1" == "medium" ] || [ "$1" == "high" ] || [ "$1" == "max" ] 624 | then 625 | update_hosts "$1" auto 626 | elif [ "$1" == "off" ] 627 | then 628 | revert_hosts auto 629 | else 630 | settings fresh 631 | fi 632 | 633 | -------------------------------------------------------------------------------- /deb/jammy/hostminder_0.0.8_all/usr/share/applications/hostminder.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Encoding=UTF-8 4 | Name=Host Minder 5 | Comment=A graphical tool to setup a consolidated /etc/hosts file to block unwanted websites. 6 | Exec=hostminder 7 | Icon=hostminder.png 8 | Terminal=false 9 | Type=Application 10 | StartupNotify=true 11 | Categories=Application;System;Settings; 12 | Name[en_US]=Host Minder 13 | -------------------------------------------------------------------------------- /deb/jammy/hostminder_0.0.8_all/usr/share/doc/hostminder/changelog.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/hostminder/82ca8d23602fab775dc99390fe48d6d80d56bd59/deb/jammy/hostminder_0.0.8_all/usr/share/doc/hostminder/changelog.tar.xz -------------------------------------------------------------------------------- /deb/jammy/hostminder_0.0.8_all/usr/share/doc/hostminder/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 | -------------------------------------------------------------------------------- /deb/jammy/hostminder_0.0.8_all/usr/share/pixmaps/hostminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/hostminder/82ca8d23602fab775dc99390fe48d6d80d56bd59/deb/jammy/hostminder_0.0.8_all/usr/share/pixmaps/hostminder.png -------------------------------------------------------------------------------- /hostminder-job.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/hostminder/82ca8d23602fab775dc99390fe48d6d80d56bd59/hostminder-job.png -------------------------------------------------------------------------------- /hostminder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremehancock/hostminder/82ca8d23602fab775dc99390fe48d6d80d56bd59/hostminder.png -------------------------------------------------------------------------------- /release/focal/hostminder: -------------------------------------------------------------------------------- 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="Host Minder" 27 | 28 | check_status() { 29 | HOSTS=$(head /etc/hosts | grep "GENERATED BY $APP_TITLE" | awk '{print $0}') 30 | STEVEN=$(head /etc/hosts | grep "Title: StevenBlack/hosts" | awk '{print $0}') 31 | if [[ $HOSTS == "# GENERATED BY $APP_TITLE"* ]] || [[ $STEVEN == "# Title: StevenBlack/hosts"* ]] 32 | then 33 | echo "ON" 34 | else 35 | echo "OFF" 36 | fi 37 | } 38 | 39 | get_toggle() { 40 | STATUS=$(check_status) 41 | if [[ $STATUS == *"ON"* ]] 42 | then 43 | echo "OFF" 44 | else 45 | echo "ON" 46 | fi 47 | } 48 | 49 | get_status_color() { 50 | STATUS=$(check_status) 51 | if [[ $STATUS == *"ON"* ]] 52 | then 53 | echo "#228B22" 54 | else 55 | echo "#CC0000" 56 | fi 57 | } 58 | 59 | get_level() { 60 | LEVEL=$(head /etc/hosts | grep "GENERATED BY $APP_TITLE" | awk '{print $6}') 61 | if [[ $LEVEL ]] 62 | then 63 | echo "\n\nCurrent Protection Level: $LEVEL" 64 | fi 65 | } 66 | 67 | get_total_domains() { 68 | DOMAINS=$(head /etc/hosts | grep "# Number of unique domains" | awk '{print $6}') 69 | if [[ $DOMAINS ]] 70 | then 71 | echo "\n\nTotal Unique Domains: $DOMAINS" 72 | fi 73 | } 74 | 75 | check_safe_searchstatus() { 76 | STATUS=$(grep "# Google Safe Search - Host Minder" /etc/hosts | awk '{print $0}') 77 | if [[ $STATUS ]] 78 | then 79 | echo "ENABLED" 80 | else 81 | echo "DISABLED" 82 | fi 83 | } 84 | 85 | get_safe_searchstatus_color() { 86 | STATUS=$(check_safe_searchstatus) 87 | if [[ $STATUS == *"ENABLED"* ]] 88 | then 89 | echo "#228B22" 90 | else 91 | echo "#CC0000" 92 | fi 93 | } 94 | 95 | settings() { 96 | STATUS=$(check_status) 97 | STATUS_COLOR=$(get_status_color) 98 | TOGGLE=$(get_toggle) 99 | LEVEL=$(get_level) 100 | DOMAINS=$(get_total_domains) 101 | SAFESEARCH_STATUS=$(check_safe_searchstatus) 102 | SAFESEARCH_STATUS_COLOR=$(get_safe_searchstatus_color) 103 | if [[ $STATUS == "ON" ]] 104 | then 105 | UPDATE="Change/Update Protection Level" 106 | ALLOW="Edit Allow List" 107 | HELP="What's Host Minder?" 108 | else 109 | UPDATE="What's Host Minder?" 110 | ALLOW="" 111 | HELP="" 112 | fi 113 | SWITCH=$(zenity --window-icon=/usr/share/pixmaps/hostminder.png --list --title="$APP_TITLE: Settings" --width=400 --height=350 --text="Status: $STATUS$LEVEL$DOMAINS\n\nGoogle Safe Search: $SAFESEARCH_STATUS\n" --column= --hide-header "Turn $TOGGLE" "$UPDATE" "$ALLOW" "$HELP") 114 | case $SWITCH in 115 | 116 | "Turn ON") 117 | select_level fresh 118 | ;; 119 | 120 | "Turn OFF") 121 | revert_hosts 122 | ;; 123 | 124 | "Change/Update Protection Level") 125 | select_level 126 | ;; 127 | 128 | "Edit Allow List") 129 | cp /opt/hostminder/allow /tmp/hostminder.allow 130 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --info --title "$APP_TITLE" --width=500 --text $"\nThe Allow List only affects domains blocked by Host Minder.\n\nKeep in mind that DNS Minder may still be blocking the domain." 131 | gedit -w /tmp/hostminder.allow 132 | sed -i '/^[[:space:]]*$/d' /tmp/hostminder.allow 133 | confirm_save_allow_list 134 | settings 135 | ;; 136 | 137 | "What's Host Minder?") 138 | xdg-open "https://github.com/mhancoc7/hostminder#readme" 139 | settings 140 | ;; 141 | 142 | *) 143 | exit 1 144 | ;; 145 | esac 146 | } 147 | 148 | select_level() { 149 | if [[ $1 == "fresh" ]] 150 | then 151 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --info --title "$APP_TITLE" --width=450 --text $"\nThis tool will download and setup a new /etc/hosts file.\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." 152 | fi 153 | STATUS=$(check_status) 154 | STATUS_COLOR=$(get_status_color) 155 | LEVEL=$(get_level) 156 | DOMAINS=$(get_total_domains) 157 | SAFESEARCH_STATUS=$(check_safe_searchstatus) 158 | SAFESEARCH_STATUS_COLOR=$(get_safe_searchstatus_color) 159 | SELECT=$(zenity --window-icon=/usr/share/pixmaps/hostminder.png --list --title="$APP_TITLE: Settings" --width=400 --height=350 --text="Status: $STATUS$LEVEL$DOMAINS\n\nGoogle Safe Search: $SAFESEARCH_STATUS\n\nSelect Protection Level" --column=Name --column=Description Max "Ads / Porn / Gambling / Social / Fake News" High "Ads / Porn / Gambling / Social" Medium "Ads / Porn / Gambling" Low "Ads / Porn") 160 | case $SELECT in 161 | 162 | "Max") 163 | update_hosts max 164 | ;; 165 | 166 | "High") 167 | update_hosts high 168 | ;; 169 | 170 | "Medium") 171 | update_hosts medium 172 | ;; 173 | 174 | "Low") 175 | update_hosts low 176 | ;; 177 | 178 | *) 179 | settings 180 | ;; 181 | esac 182 | } 183 | 184 | confirm() { 185 | if 186 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --question --title "$APP_TITLE" --no-wrap --text="\nAre you sure?" 187 | then 188 | return 189 | else 190 | settings 191 | fi 192 | } 193 | 194 | confirm_save_allow_list() { 195 | if 196 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --question --title "$APP_TITLE" --no-wrap --text="\nSave & Apply Allow List?" 197 | then 198 | if [[ "$LEVEL" == "\n\nCurrent Protection Level: (Max):" ]] 199 | then 200 | update_hosts max auto allow 201 | elif [[ "$LEVEL" == "\n\nCurrent Protection Level: (High):" ]] 202 | then 203 | update_hosts high auto allow 204 | elif [[ "$LEVEL" == "\n\nCurrent Protection Level: (Medium):" ]] 205 | then 206 | update_hosts medium auto allow 207 | elif [[ "$LEVEL" == "\n\nCurrent Protection Level: (Low):" ]] 208 | then 209 | update_hosts low auto allow 210 | else 211 | return 212 | fi 213 | else 214 | settings 215 | fi 216 | } 217 | 218 | general_failure() { 219 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --error --title "$APP_TITLE" --no-wrap --text="\nSomething went wrong!" 220 | } 221 | 222 | wget_failure() { 223 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --error --title "$APP_TITLE" --no-wrap --text="\nCould not download hosts file.\n\nPlease check your internet connection!" 224 | } 225 | 226 | FALLBACK="127.0.0.1 localhost 227 | 127.0.0.1 localhost.localdomain 228 | 127.0.0.1 local 229 | 255.255.255.255 broadcasthost 230 | ::1 localhost 231 | ::1 ip6-localhost 232 | ::1 ip6-loopback 233 | fe80::1%lo0 localhost 234 | ff00::0 ip6-localnet 235 | ff00::0 ip6-mcastprefix 236 | ff02::1 ip6-allnodes 237 | ff02::2 ip6-allrouters 238 | ff02::3 ip6-allhosts 239 | 0.0.0.0 0.0.0.0 240 | " 241 | 242 | update_hosts() { 243 | if [ "$2" != "auto" ] 244 | then 245 | confirm 246 | fi 247 | 248 | if [[ "$1" == "max" ]] 249 | then 250 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts" 251 | elif [[ "$1" == "high" ]] 252 | then 253 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn-social/hosts" 254 | elif [[ "$1" == "medium" ]] 255 | then 256 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn/hosts" 257 | elif [[ "$1" == "low" ]] 258 | then 259 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn/hosts" 260 | else 261 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn/hosts" 262 | fi 263 | ( 264 | echo "# \nGetting new hosts file (${1^})\n" 265 | sleep 2 266 | if wget -q "$LIST" -O /tmp/bad.host.list.hostminder.txt 267 | then 268 | echo "# \nApplying Allow List\n" 269 | sleep 2 270 | 271 | if [ -f /tmp/hostminder.allow ] 272 | then 273 | while read line; do 274 | if [[ ${line} != *"#"* ]] 275 | then 276 | sed -i "/$line/d" /tmp/bad.host.list.hostminder.txt 277 | fi 278 | done /etc/hosts_hostminder_bak 292 | else 293 | echo '# \nBacking up current hosts file\n' 294 | sleep 2 295 | cp /etc/hosts /etc/hosts_hostminder_bak 296 | fi 297 | 298 | sed -i '/^[[:space:]]*$/d' /etc/hosts_hostminder_bak 299 | 300 | echo '# \nSetting up new hosts file\n' 301 | sleep 2 302 | if [ -f /tmp/bad.host.list.hostminder.txt ] 303 | then 304 | sleep 2 305 | sed -i '1i# GENERATED BY $APP_TITLE (${1^}): PLEASE DO NOT EDIT OR REMOVE THIS LINE' /tmp/bad.host.list.hostminder.txt 306 | cp /tmp/bad.host.list.hostminder.txt /etc/hosts 307 | 308 | if [ $3 ] 309 | then 310 | mv /tmp/hostminder.allow /opt/hostminder/allow 311 | fi 312 | 313 | echo '# \nAdding current hosts entries to new hosts file\n' 314 | sleep 2 315 | sed -i -e '/# Custom host records are listed here./r /etc/hosts_hostminder_bak' /etc/hosts 316 | 317 | echo '# \nEnabling Google Safe Search\n' 318 | sleep 2 319 | echo '# Google Safe Search - Host Minder' >> /etc/hosts 320 | echo '216.239.38.120 www.google.com #forcesafesearch' >> /etc/hosts 321 | echo '216.239.38.120 www.google.com #forcesafesearch' >> /etc/hosts 322 | echo '216.239.38.120 www.google.ad #forcesafesearch' >> /etc/hosts 323 | echo '216.239.38.120 www.google.ae #forcesafesearch' >> /etc/hosts 324 | echo '216.239.38.120 www.google.com.af #forcesafesearch' >> /etc/hosts 325 | echo '216.239.38.120 www.google.com.ag #forcesafesearch' >> /etc/hosts 326 | echo '216.239.38.120 www.google.com.ai #forcesafesearch' >> /etc/hosts 327 | echo '216.239.38.120 www.google.al #forcesafesearch' >> /etc/hosts 328 | echo '216.239.38.120 www.google.am #forcesafesearch' >> /etc/hosts 329 | echo '216.239.38.120 www.google.co.ao #forcesafesearch' >> /etc/hosts 330 | echo '216.239.38.120 www.google.com.ar #forcesafesearch' >> /etc/hosts 331 | echo '216.239.38.120 www.google.as #forcesafesearch' >> /etc/hosts 332 | echo '216.239.38.120 www.google.at #forcesafesearch' >> /etc/hosts 333 | echo '216.239.38.120 www.google.com.au #forcesafesearch' >> /etc/hosts 334 | echo '216.239.38.120 www.google.az #forcesafesearch' >> /etc/hosts 335 | echo '216.239.38.120 www.google.ba #forcesafesearch' >> /etc/hosts 336 | echo '216.239.38.120 www.google.com.bd #forcesafesearch' >> /etc/hosts 337 | echo '216.239.38.120 www.google.be #forcesafesearch' >> /etc/hosts 338 | echo '216.239.38.120 www.google.bf #forcesafesearch' >> /etc/hosts 339 | echo '216.239.38.120 www.google.bg #forcesafesearch' >> /etc/hosts 340 | echo '216.239.38.120 www.google.com.bh #forcesafesearch' >> /etc/hosts 341 | echo '216.239.38.120 www.google.bi #forcesafesearch' >> /etc/hosts 342 | echo '216.239.38.120 www.google.bj #forcesafesearch' >> /etc/hosts 343 | echo '216.239.38.120 www.google.com.bn #forcesafesearch' >> /etc/hosts 344 | echo '216.239.38.120 www.google.com.bo #forcesafesearch' >> /etc/hosts 345 | echo '216.239.38.120 www.google.com.br #forcesafesearch' >> /etc/hosts 346 | echo '216.239.38.120 www.google.bs #forcesafesearch' >> /etc/hosts 347 | echo '216.239.38.120 www.google.bt #forcesafesearch' >> /etc/hosts 348 | echo '216.239.38.120 www.google.co.bw #forcesafesearch' >> /etc/hosts 349 | echo '216.239.38.120 www.google.by #forcesafesearch' >> /etc/hosts 350 | echo '216.239.38.120 www.google.com.bz #forcesafesearch' >> /etc/hosts 351 | echo '216.239.38.120 www.google.ca #forcesafesearch' >> /etc/hosts 352 | echo '216.239.38.120 www.google.cd #forcesafesearch' >> /etc/hosts 353 | echo '216.239.38.120 www.google.cf #forcesafesearch' >> /etc/hosts 354 | echo '216.239.38.120 www.google.cg #forcesafesearch' >> /etc/hosts 355 | echo '216.239.38.120 www.google.ch #forcesafesearch' >> /etc/hosts 356 | echo '216.239.38.120 www.google.ci #forcesafesearch' >> /etc/hosts 357 | echo '216.239.38.120 www.google.co.ck #forcesafesearch' >> /etc/hosts 358 | echo '216.239.38.120 www.google.cl #forcesafesearch' >> /etc/hosts 359 | echo '216.239.38.120 www.google.cm #forcesafesearch' >> /etc/hosts 360 | echo '216.239.38.120 www.google.cn #forcesafesearch' >> /etc/hosts 361 | echo '216.239.38.120 www.google.com.co #forcesafesearch' >> /etc/hosts 362 | echo '216.239.38.120 www.google.co.cr #forcesafesearch' >> /etc/hosts 363 | echo '216.239.38.120 www.google.com.cu #forcesafesearch' >> /etc/hosts 364 | echo '216.239.38.120 www.google.cv #forcesafesearch' >> /etc/hosts 365 | echo '216.239.38.120 www.google.com.cy #forcesafesearch' >> /etc/hosts 366 | echo '216.239.38.120 www.google.cz #forcesafesearch' >> /etc/hosts 367 | echo '216.239.38.120 www.google.de #forcesafesearch' >> /etc/hosts 368 | echo '216.239.38.120 www.google.dj #forcesafesearch' >> /etc/hosts 369 | echo '216.239.38.120 www.google.dk #forcesafesearch' >> /etc/hosts 370 | echo '216.239.38.120 www.google.dm #forcesafesearch' >> /etc/hosts 371 | echo '216.239.38.120 www.google.com.do #forcesafesearch' >> /etc/hosts 372 | echo '216.239.38.120 www.google.dz #forcesafesearch' >> /etc/hosts 373 | echo '216.239.38.120 www.google.com.ec #forcesafesearch' >> /etc/hosts 374 | echo '216.239.38.120 www.google.ee #forcesafesearch' >> /etc/hosts 375 | echo '216.239.38.120 www.google.com.eg #forcesafesearch' >> /etc/hosts 376 | echo '216.239.38.120 www.google.es #forcesafesearch' >> /etc/hosts 377 | echo '216.239.38.120 www.google.com.et #forcesafesearch' >> /etc/hosts 378 | echo '216.239.38.120 www.google.fi #forcesafesearch' >> /etc/hosts 379 | echo '216.239.38.120 www.google.com.fj #forcesafesearch' >> /etc/hosts 380 | echo '216.239.38.120 www.google.fm #forcesafesearch' >> /etc/hosts 381 | echo '216.239.38.120 www.google.fr #forcesafesearch' >> /etc/hosts 382 | echo '216.239.38.120 www.google.ga #forcesafesearch' >> /etc/hosts 383 | echo '216.239.38.120 www.google.ge #forcesafesearch' >> /etc/hosts 384 | echo '216.239.38.120 www.google.gg #forcesafesearch' >> /etc/hosts 385 | echo '216.239.38.120 www.google.com.gh #forcesafesearch' >> /etc/hosts 386 | echo '216.239.38.120 www.google.com.gi #forcesafesearch' >> /etc/hosts 387 | echo '216.239.38.120 www.google.gl #forcesafesearch' >> /etc/hosts 388 | echo '216.239.38.120 www.google.gm #forcesafesearch' >> /etc/hosts 389 | echo '216.239.38.120 www.google.gr #forcesafesearch' >> /etc/hosts 390 | echo '216.239.38.120 www.google.com.gt #forcesafesearch' >> /etc/hosts 391 | echo '216.239.38.120 www.google.gy #forcesafesearch' >> /etc/hosts 392 | echo '216.239.38.120 www.google.com.hk #forcesafesearch' >> /etc/hosts 393 | echo '216.239.38.120 www.google.hn #forcesafesearch' >> /etc/hosts 394 | echo '216.239.38.120 www.google.hr #forcesafesearch' >> /etc/hosts 395 | echo '216.239.38.120 www.google.ht #forcesafesearch' >> /etc/hosts 396 | echo '216.239.38.120 www.google.hu #forcesafesearch' >> /etc/hosts 397 | echo '216.239.38.120 www.google.co.id #forcesafesearch' >> /etc/hosts 398 | echo '216.239.38.120 www.google.ie #forcesafesearch' >> /etc/hosts 399 | echo '216.239.38.120 www.google.co.il #forcesafesearch' >> /etc/hosts 400 | echo '216.239.38.120 www.google.im #forcesafesearch' >> /etc/hosts 401 | echo '216.239.38.120 www.google.co.in #forcesafesearch' >> /etc/hosts 402 | echo '216.239.38.120 www.google.iq #forcesafesearch' >> /etc/hosts 403 | echo '216.239.38.120 www.google.is #forcesafesearch' >> /etc/hosts 404 | echo '216.239.38.120 www.google.it #forcesafesearch' >> /etc/hosts 405 | echo '216.239.38.120 www.google.je #forcesafesearch' >> /etc/hosts 406 | echo '216.239.38.120 www.google.com.jm #forcesafesearch' >> /etc/hosts 407 | echo '216.239.38.120 www.google.jo #forcesafesearch' >> /etc/hosts 408 | echo '216.239.38.120 www.google.co.jp #forcesafesearch' >> /etc/hosts 409 | echo '216.239.38.120 www.google.co.ke #forcesafesearch' >> /etc/hosts 410 | echo '216.239.38.120 www.google.com.kh #forcesafesearch' >> /etc/hosts 411 | echo '216.239.38.120 www.google.ki #forcesafesearch' >> /etc/hosts 412 | echo '216.239.38.120 www.google.kg #forcesafesearch' >> /etc/hosts 413 | echo '216.239.38.120 www.google.co.kr #forcesafesearch' >> /etc/hosts 414 | echo '216.239.38.120 www.google.com.kw #forcesafesearch' >> /etc/hosts 415 | echo '216.239.38.120 www.google.kz #forcesafesearch' >> /etc/hosts 416 | echo '216.239.38.120 www.google.la #forcesafesearch' >> /etc/hosts 417 | echo '216.239.38.120 www.google.com.lb #forcesafesearch' >> /etc/hosts 418 | echo '216.239.38.120 www.google.li #forcesafesearch' >> /etc/hosts 419 | echo '216.239.38.120 www.google.lk #forcesafesearch' >> /etc/hosts 420 | echo '216.239.38.120 www.google.co.ls #forcesafesearch' >> /etc/hosts 421 | echo '216.239.38.120 www.google.lt #forcesafesearch' >> /etc/hosts 422 | echo '216.239.38.120 www.google.lu #forcesafesearch' >> /etc/hosts 423 | echo '216.239.38.120 www.google.lv #forcesafesearch' >> /etc/hosts 424 | echo '216.239.38.120 www.google.com.ly #forcesafesearch' >> /etc/hosts 425 | echo '216.239.38.120 www.google.co.ma #forcesafesearch' >> /etc/hosts 426 | echo '216.239.38.120 www.google.md #forcesafesearch' >> /etc/hosts 427 | echo '216.239.38.120 www.google.me #forcesafesearch' >> /etc/hosts 428 | echo '216.239.38.120 www.google.mg #forcesafesearch' >> /etc/hosts 429 | echo '216.239.38.120 www.google.mk #forcesafesearch' >> /etc/hosts 430 | echo '216.239.38.120 www.google.ml #forcesafesearch' >> /etc/hosts 431 | echo '216.239.38.120 www.google.com.mm #forcesafesearch' >> /etc/hosts 432 | echo '216.239.38.120 www.google.mn #forcesafesearch' >> /etc/hosts 433 | echo '216.239.38.120 www.google.ms #forcesafesearch' >> /etc/hosts 434 | echo '216.239.38.120 www.google.com.mt #forcesafesearch' >> /etc/hosts 435 | echo '216.239.38.120 www.google.mu #forcesafesearch' >> /etc/hosts 436 | echo '216.239.38.120 www.google.mv #forcesafesearch' >> /etc/hosts 437 | echo '216.239.38.120 www.google.mw #forcesafesearch' >> /etc/hosts 438 | echo '216.239.38.120 www.google.com.mx #forcesafesearch' >> /etc/hosts 439 | echo '216.239.38.120 www.google.com.my #forcesafesearch' >> /etc/hosts 440 | echo '216.239.38.120 www.google.co.mz #forcesafesearch' >> /etc/hosts 441 | echo '216.239.38.120 www.google.com.na #forcesafesearch' >> /etc/hosts 442 | echo '216.239.38.120 www.google.com.ng #forcesafesearch' >> /etc/hosts 443 | echo '216.239.38.120 www.google.com.ni #forcesafesearch' >> /etc/hosts 444 | echo '216.239.38.120 www.google.ne #forcesafesearch' >> /etc/hosts 445 | echo '216.239.38.120 www.google.nl #forcesafesearch' >> /etc/hosts 446 | echo '216.239.38.120 www.google.no #forcesafesearch' >> /etc/hosts 447 | echo '216.239.38.120 www.google.com.np #forcesafesearch' >> /etc/hosts 448 | echo '216.239.38.120 www.google.nr #forcesafesearch' >> /etc/hosts 449 | echo '216.239.38.120 www.google.nu #forcesafesearch' >> /etc/hosts 450 | echo '216.239.38.120 www.google.co.nz #forcesafesearch' >> /etc/hosts 451 | echo '216.239.38.120 www.google.com.om #forcesafesearch' >> /etc/hosts 452 | echo '216.239.38.120 www.google.com.pa #forcesafesearch' >> /etc/hosts 453 | echo '216.239.38.120 www.google.com.pe #forcesafesearch' >> /etc/hosts 454 | echo '216.239.38.120 www.google.com.pg #forcesafesearch' >> /etc/hosts 455 | echo '216.239.38.120 www.google.com.ph #forcesafesearch' >> /etc/hosts 456 | echo '216.239.38.120 www.google.com.pk #forcesafesearch' >> /etc/hosts 457 | echo '216.239.38.120 www.google.pl #forcesafesearch' >> /etc/hosts 458 | echo '216.239.38.120 www.google.pn #forcesafesearch' >> /etc/hosts 459 | echo '216.239.38.120 www.google.com.pr #forcesafesearch' >> /etc/hosts 460 | echo '216.239.38.120 www.google.ps #forcesafesearch' >> /etc/hosts 461 | echo '216.239.38.120 www.google.pt #forcesafesearch' >> /etc/hosts 462 | echo '216.239.38.120 www.google.com.py #forcesafesearch' >> /etc/hosts 463 | echo '216.239.38.120 www.google.com.qa #forcesafesearch' >> /etc/hosts 464 | echo '216.239.38.120 www.google.ro #forcesafesearch' >> /etc/hosts 465 | echo '216.239.38.120 www.google.ru #forcesafesearch' >> /etc/hosts 466 | echo '216.239.38.120 www.google.rw #forcesafesearch' >> /etc/hosts 467 | echo '216.239.38.120 www.google.com.sa #forcesafesearch' >> /etc/hosts 468 | echo '216.239.38.120 www.google.com.sb #forcesafesearch' >> /etc/hosts 469 | echo '216.239.38.120 www.google.sc #forcesafesearch' >> /etc/hosts 470 | echo '216.239.38.120 www.google.se #forcesafesearch' >> /etc/hosts 471 | echo '216.239.38.120 www.google.com.sg #forcesafesearch' >> /etc/hosts 472 | echo '216.239.38.120 www.google.sh #forcesafesearch' >> /etc/hosts 473 | echo '216.239.38.120 www.google.si #forcesafesearch' >> /etc/hosts 474 | echo '216.239.38.120 www.google.sk #forcesafesearch' >> /etc/hosts 475 | echo '216.239.38.120 www.google.com.sl #forcesafesearch' >> /etc/hosts 476 | echo '216.239.38.120 www.google.sn #forcesafesearch' >> /etc/hosts 477 | echo '216.239.38.120 www.google.so #forcesafesearch' >> /etc/hosts 478 | echo '216.239.38.120 www.google.sm #forcesafesearch' >> /etc/hosts 479 | echo '216.239.38.120 www.google.sr #forcesafesearch' >> /etc/hosts 480 | echo '216.239.38.120 www.google.st #forcesafesearch' >> /etc/hosts 481 | echo '216.239.38.120 www.google.com.sv #forcesafesearch' >> /etc/hosts 482 | echo '216.239.38.120 www.google.td #forcesafesearch' >> /etc/hosts 483 | echo '216.239.38.120 www.google.tg #forcesafesearch' >> /etc/hosts 484 | echo '216.239.38.120 www.google.co.th #forcesafesearch' >> /etc/hosts 485 | echo '216.239.38.120 www.google.com.tj #forcesafesearch' >> /etc/hosts 486 | echo '216.239.38.120 www.google.tl #forcesafesearch' >> /etc/hosts 487 | echo '216.239.38.120 www.google.tm #forcesafesearch' >> /etc/hosts 488 | echo '216.239.38.120 www.google.tn #forcesafesearch' >> /etc/hosts 489 | echo '216.239.38.120 www.google.to #forcesafesearch' >> /etc/hosts 490 | echo '216.239.38.120 www.google.com.tr #forcesafesearch' >> /etc/hosts 491 | echo '216.239.38.120 www.google.tt #forcesafesearch' >> /etc/hosts 492 | echo '216.239.38.120 www.google.com.tw #forcesafesearch' >> /etc/hosts 493 | echo '216.239.38.120 www.google.co.tz #forcesafesearch' >> /etc/hosts 494 | echo '216.239.38.120 www.google.com.ua #forcesafesearch' >> /etc/hosts 495 | echo '216.239.38.120 www.google.co.ug #forcesafesearch' >> /etc/hosts 496 | echo '216.239.38.120 www.google.co.uk #forcesafesearch' >> /etc/hosts 497 | echo '216.239.38.120 www.google.com.uy #forcesafesearch' >> /etc/hosts 498 | echo '216.239.38.120 www.google.co.uz #forcesafesearch' >> /etc/hosts 499 | echo '216.239.38.120 www.google.com.vc #forcesafesearch' >> /etc/hosts 500 | echo '216.239.38.120 www.google.co.ve #forcesafesearch' >> /etc/hosts 501 | echo '216.239.38.120 www.google.vg #forcesafesearch' >> /etc/hosts 502 | echo '216.239.38.120 www.google.co.vi #forcesafesearch' >> /etc/hosts 503 | echo '216.239.38.120 www.google.com.vn #forcesafesearch' >> /etc/hosts 504 | echo '216.239.38.120 www.google.vu #forcesafesearch' >> /etc/hosts 505 | echo '216.239.38.120 www.google.ws #forcesafesearch' >> /etc/hosts 506 | echo '216.239.38.120 www.google.rs #forcesafesearch' >> /etc/hosts 507 | echo '216.239.38.120 www.google.co.za #forcesafesearch' >> /etc/hosts 508 | echo '216.239.38.120 www.google.co.zm #forcesafesearch' >> /etc/hosts 509 | echo '216.239.38.120 www.google.co.zw #forcesafesearch' >> /etc/hosts 510 | echo '216.239.38.120 www.google.cat #forcesafesearch' >> /etc/hosts 511 | 512 | if ! grep -q '[^[:space:]]' /etc/hosts 513 | then 514 | echo '# \nSomething went wrong! Reverting to fallback hosts file.\n' 515 | sleep 2 516 | echo '$FALLBACK' | tee /etc/hosts 517 | else 518 | echo '# \nAdding auto update crontab\n' 519 | sleep 2 520 | crontab -l | grep -v 'hostminder' | crontab - 521 | (crontab -l && echo '0 0 * * 0 hostminder ${1}') | crontab - 522 | fi 523 | 524 | echo '# \nCleaning up\n' 525 | sleep 2 526 | rm /etc/hosts_hostminder_bak 527 | rm /tmp/bad.host.list.hostminder.txt 528 | fi 529 | " 530 | echo "# \nAll finished\n" 531 | sleep 2 532 | else 533 | if [ "$2" != "auto" ] 534 | then 535 | wget_failure 536 | fi 537 | fi 538 | 539 | ) | 540 | zenity --progress \ 541 | --title="$APP_TITLE: Progress" \ 542 | --width=400 \ 543 | --height=100 \ 544 | --percentage=0 \ 545 | --auto-close \ 546 | --auto-kill \ 547 | --no-cancel \ 548 | --pulsate \ 549 | --window-icon=/usr/share/pixmaps/hostminder.png 550 | 551 | (($? != 0)) && general_failure 552 | 553 | if [ "$2" != "auto" ] 554 | then 555 | settings 556 | fi 557 | } 558 | 559 | revert_hosts() { 560 | if [ "$1" != "auto" ] 561 | then 562 | confirm 563 | fi 564 | 565 | ( 566 | echo "# \nReverting to original hosts file\n" 567 | sleep 2 568 | pkexec bash -c " 569 | if grep -q 'GENERATED BY $APP_TITLE' /etc/hosts 570 | then 571 | echo '# \nExtracting custom entries\n' 572 | sleep 2 573 | sed -n '/# Custom host records are listed here./I,/# End of custom host records./I{ /# /Id; p }' /etc/hosts > /etc/hosts_hostminder_bak 574 | else 575 | echo '# \nBacking up current hosts file\n' 576 | sleep 2 577 | cp /etc/hosts /etc/hosts_hostminder_bak 578 | fi 579 | 580 | sed -i '/^[[:space:]]*$/d' /etc/hosts_hostminder_bak 581 | cp /etc/hosts_hostminder_bak /etc/hosts 582 | 583 | if ! grep -q '[^[:space:]]' /etc/hosts 584 | then 585 | echo '# \nSomething went wrong! Reverting to fallback hosts file\n' 586 | sleep 2 587 | echo '$FALLBACK' | tee /etc/hosts 588 | fi 589 | 590 | echo '# \nRemoving auto update crontab\n' 591 | sleep 2 592 | crontab -l | grep -v 'hostminder' | crontab - 593 | 594 | echo '# \nCleaning up\n' 595 | sleep 2 596 | rm /etc/hosts_hostminder_bak 597 | rm /tmp/bad.host.list.hostminder.txt 598 | " 599 | 600 | echo "# \nAll finished\n" 601 | sleep 2 602 | 603 | ) | 604 | zenity --progress \ 605 | --title="$APP_TITLE: Progress" \ 606 | --width=400 \ 607 | --height=100 \ 608 | --percentage=0 \ 609 | --auto-close \ 610 | --auto-kill \ 611 | --no-cancel \ 612 | --pulsate \ 613 | --window-icon=/usr/share/pixmaps/hostminder.png 614 | 615 | (($? != 0)) && zenity --window-icon=/usr/share/pixmaps/hostminder.png --error --text="Error in zenity command." 616 | 617 | if [ "$1" != "auto" ] 618 | then 619 | settings 620 | fi 621 | } 622 | 623 | if [ "$1" == "low" ] || [ "$1" == "medium" ] || [ "$1" == "high" ] || [ "$1" == "max" ] 624 | then 625 | update_hosts "$1" auto 626 | elif [ "$1" == "off" ] 627 | then 628 | revert_hosts auto 629 | else 630 | settings fresh 631 | fi 632 | 633 | -------------------------------------------------------------------------------- /release/jammy/hostminder: -------------------------------------------------------------------------------- 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="Host Minder" 27 | 28 | check_status() { 29 | HOSTS=$(head /etc/hosts | grep "GENERATED BY $APP_TITLE" | awk '{print $0}') 30 | STEVEN=$(head /etc/hosts | grep "Title: StevenBlack/hosts" | awk '{print $0}') 31 | if [[ $HOSTS == "# GENERATED BY $APP_TITLE"* ]] || [[ $STEVEN == "# Title: StevenBlack/hosts"* ]] 32 | then 33 | echo "ON" 34 | else 35 | echo "OFF" 36 | fi 37 | } 38 | 39 | get_toggle() { 40 | STATUS=$(check_status) 41 | if [[ $STATUS == *"ON"* ]] 42 | then 43 | echo "OFF" 44 | else 45 | echo "ON" 46 | fi 47 | } 48 | 49 | get_status_color() { 50 | STATUS=$(check_status) 51 | if [[ $STATUS == *"ON"* ]] 52 | then 53 | echo "#228B22" 54 | else 55 | echo "#CC0000" 56 | fi 57 | } 58 | 59 | get_level() { 60 | LEVEL=$(head /etc/hosts | grep "GENERATED BY $APP_TITLE" | awk '{print $6}') 61 | if [[ $LEVEL ]] 62 | then 63 | echo "\n\nCurrent Protection Level: $LEVEL" 64 | fi 65 | } 66 | 67 | get_total_domains() { 68 | DOMAINS=$(head /etc/hosts | grep "# Number of unique domains" | awk '{print $6}') 69 | if [[ $DOMAINS ]] 70 | then 71 | echo "\n\nTotal Unique Domains: $DOMAINS" 72 | fi 73 | } 74 | 75 | check_safe_searchstatus() { 76 | STATUS=$(grep "# Google Safe Search - Host Minder" /etc/hosts | awk '{print $0}') 77 | if [[ $STATUS ]] 78 | then 79 | echo "ENABLED" 80 | else 81 | echo "DISABLED" 82 | fi 83 | } 84 | 85 | get_safe_searchstatus_color() { 86 | STATUS=$(check_safe_searchstatus) 87 | if [[ $STATUS == *"ENABLED"* ]] 88 | then 89 | echo "#228B22" 90 | else 91 | echo "#CC0000" 92 | fi 93 | } 94 | 95 | settings() { 96 | STATUS=$(check_status) 97 | STATUS_COLOR=$(get_status_color) 98 | TOGGLE=$(get_toggle) 99 | LEVEL=$(get_level) 100 | DOMAINS=$(get_total_domains) 101 | SAFESEARCH_STATUS=$(check_safe_searchstatus) 102 | SAFESEARCH_STATUS_COLOR=$(get_safe_searchstatus_color) 103 | if [[ $STATUS == "ON" ]] 104 | then 105 | UPDATE="Change/Update Protection Level" 106 | ALLOW="Edit Allow List" 107 | HELP="What's Host Minder?" 108 | else 109 | UPDATE="What's Host Minder?" 110 | ALLOW="" 111 | HELP="" 112 | fi 113 | SWITCH=$(zenity --window-icon=/usr/share/pixmaps/hostminder.png --list --title="$APP_TITLE: Settings" --width=400 --height=350 --text="Status: $STATUS$LEVEL$DOMAINS\n\nGoogle Safe Search: $SAFESEARCH_STATUS\n" --column= --hide-header "Turn $TOGGLE" "$UPDATE" "$ALLOW" "$HELP") 114 | case $SWITCH in 115 | 116 | "Turn ON") 117 | select_level fresh 118 | ;; 119 | 120 | "Turn OFF") 121 | revert_hosts 122 | ;; 123 | 124 | "Change/Update Protection Level") 125 | select_level 126 | ;; 127 | 128 | "Edit Allow List") 129 | cp /opt/hostminder/allow /tmp/hostminder.allow 130 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --info --title "$APP_TITLE" --width=500 --text $"\nThe Allow List only affects domains blocked by Host Minder.\n\nKeep in mind that DNS Minder may still be blocking the domain." 131 | gedit -w /tmp/hostminder.allow 132 | sed -i '/^[[:space:]]*$/d' /tmp/hostminder.allow 133 | confirm_save_allow_list 134 | settings 135 | ;; 136 | 137 | "What's Host Minder?") 138 | xdg-open "https://github.com/mhancoc7/hostminder#readme" 139 | settings 140 | ;; 141 | 142 | *) 143 | exit 1 144 | ;; 145 | esac 146 | } 147 | 148 | select_level() { 149 | if [[ $1 == "fresh" ]] 150 | then 151 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --info --title "$APP_TITLE" --width=450 --text $"\nThis tool will download and setup a new /etc/hosts file.\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." 152 | fi 153 | STATUS=$(check_status) 154 | STATUS_COLOR=$(get_status_color) 155 | LEVEL=$(get_level) 156 | DOMAINS=$(get_total_domains) 157 | SAFESEARCH_STATUS=$(check_safe_searchstatus) 158 | SAFESEARCH_STATUS_COLOR=$(get_safe_searchstatus_color) 159 | SELECT=$(zenity --window-icon=/usr/share/pixmaps/hostminder.png --list --title="$APP_TITLE: Settings" --width=400 --height=350 --text="Status: $STATUS$LEVEL$DOMAINS\n\nGoogle Safe Search: $SAFESEARCH_STATUS\n\nSelect Protection Level" --column=Name --column=Description Max "Ads / Porn / Gambling / Social / Fake News" High "Ads / Porn / Gambling / Social" Medium "Ads / Porn / Gambling" Low "Ads / Porn") 160 | case $SELECT in 161 | 162 | "Max") 163 | update_hosts max 164 | ;; 165 | 166 | "High") 167 | update_hosts high 168 | ;; 169 | 170 | "Medium") 171 | update_hosts medium 172 | ;; 173 | 174 | "Low") 175 | update_hosts low 176 | ;; 177 | 178 | *) 179 | settings 180 | ;; 181 | esac 182 | } 183 | 184 | confirm() { 185 | if 186 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --question --title "$APP_TITLE" --no-wrap --text="\nAre you sure?" 187 | then 188 | return 189 | else 190 | settings 191 | fi 192 | } 193 | 194 | confirm_save_allow_list() { 195 | if 196 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --question --title "$APP_TITLE" --no-wrap --text="\nSave & Apply Allow List?" 197 | then 198 | if [[ "$LEVEL" == "\n\nCurrent Protection Level: (Max):" ]] 199 | then 200 | update_hosts max auto allow 201 | elif [[ "$LEVEL" == "\n\nCurrent Protection Level: (High):" ]] 202 | then 203 | update_hosts high auto allow 204 | elif [[ "$LEVEL" == "\n\nCurrent Protection Level: (Medium):" ]] 205 | then 206 | update_hosts medium auto allow 207 | elif [[ "$LEVEL" == "\n\nCurrent Protection Level: (Low):" ]] 208 | then 209 | update_hosts low auto allow 210 | else 211 | return 212 | fi 213 | else 214 | settings 215 | fi 216 | } 217 | 218 | general_failure() { 219 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --error --title "$APP_TITLE" --no-wrap --text="\nSomething went wrong!" 220 | } 221 | 222 | wget_failure() { 223 | zenity --window-icon=/usr/share/pixmaps/hostminder.png --error --title "$APP_TITLE" --no-wrap --text="\nCould not download hosts file.\n\nPlease check your internet connection!" 224 | } 225 | 226 | FALLBACK="127.0.0.1 localhost 227 | 127.0.0.1 localhost.localdomain 228 | 127.0.0.1 local 229 | 255.255.255.255 broadcasthost 230 | ::1 localhost 231 | ::1 ip6-localhost 232 | ::1 ip6-loopback 233 | fe80::1%lo0 localhost 234 | ff00::0 ip6-localnet 235 | ff00::0 ip6-mcastprefix 236 | ff02::1 ip6-allnodes 237 | ff02::2 ip6-allrouters 238 | ff02::3 ip6-allhosts 239 | 0.0.0.0 0.0.0.0 240 | " 241 | 242 | update_hosts() { 243 | if [ "$2" != "auto" ] 244 | then 245 | confirm 246 | fi 247 | 248 | if [[ "$1" == "max" ]] 249 | then 250 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts" 251 | elif [[ "$1" == "high" ]] 252 | then 253 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn-social/hosts" 254 | elif [[ "$1" == "medium" ]] 255 | then 256 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/gambling-porn/hosts" 257 | elif [[ "$1" == "low" ]] 258 | then 259 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn/hosts" 260 | else 261 | LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn/hosts" 262 | fi 263 | ( 264 | echo "# \nGetting new hosts file (${1^})\n" 265 | sleep 2 266 | if wget -q "$LIST" -O /tmp/bad.host.list.hostminder.txt 267 | then 268 | echo "# \nApplying Allow List\n" 269 | sleep 2 270 | 271 | if [ -f /tmp/hostminder.allow ] 272 | then 273 | while read line; do 274 | if [[ ${line} != *"#"* ]] 275 | then 276 | sed -i "/$line/d" /tmp/bad.host.list.hostminder.txt 277 | fi 278 | done /etc/hosts_hostminder_bak 292 | else 293 | echo '# \nBacking up current hosts file\n' 294 | sleep 2 295 | cp /etc/hosts /etc/hosts_hostminder_bak 296 | fi 297 | 298 | sed -i '/^[[:space:]]*$/d' /etc/hosts_hostminder_bak 299 | 300 | echo '# \nSetting up new hosts file\n' 301 | sleep 2 302 | if [ -f /tmp/bad.host.list.hostminder.txt ] 303 | then 304 | sleep 2 305 | sed -i '1i# GENERATED BY $APP_TITLE (${1^}): PLEASE DO NOT EDIT OR REMOVE THIS LINE' /tmp/bad.host.list.hostminder.txt 306 | cp /tmp/bad.host.list.hostminder.txt /etc/hosts 307 | 308 | if [ $3 ] 309 | then 310 | mv /tmp/hostminder.allow /opt/hostminder/allow 311 | fi 312 | 313 | echo '# \nAdding current hosts entries to new hosts file\n' 314 | sleep 2 315 | sed -i -e '/# Custom host records are listed here./r /etc/hosts_hostminder_bak' /etc/hosts 316 | 317 | echo '# \nEnabling Google Safe Search\n' 318 | sleep 2 319 | echo '# Google Safe Search - Host Minder' >> /etc/hosts 320 | echo '216.239.38.120 www.google.com #forcesafesearch' >> /etc/hosts 321 | echo '216.239.38.120 www.google.com #forcesafesearch' >> /etc/hosts 322 | echo '216.239.38.120 www.google.ad #forcesafesearch' >> /etc/hosts 323 | echo '216.239.38.120 www.google.ae #forcesafesearch' >> /etc/hosts 324 | echo '216.239.38.120 www.google.com.af #forcesafesearch' >> /etc/hosts 325 | echo '216.239.38.120 www.google.com.ag #forcesafesearch' >> /etc/hosts 326 | echo '216.239.38.120 www.google.com.ai #forcesafesearch' >> /etc/hosts 327 | echo '216.239.38.120 www.google.al #forcesafesearch' >> /etc/hosts 328 | echo '216.239.38.120 www.google.am #forcesafesearch' >> /etc/hosts 329 | echo '216.239.38.120 www.google.co.ao #forcesafesearch' >> /etc/hosts 330 | echo '216.239.38.120 www.google.com.ar #forcesafesearch' >> /etc/hosts 331 | echo '216.239.38.120 www.google.as #forcesafesearch' >> /etc/hosts 332 | echo '216.239.38.120 www.google.at #forcesafesearch' >> /etc/hosts 333 | echo '216.239.38.120 www.google.com.au #forcesafesearch' >> /etc/hosts 334 | echo '216.239.38.120 www.google.az #forcesafesearch' >> /etc/hosts 335 | echo '216.239.38.120 www.google.ba #forcesafesearch' >> /etc/hosts 336 | echo '216.239.38.120 www.google.com.bd #forcesafesearch' >> /etc/hosts 337 | echo '216.239.38.120 www.google.be #forcesafesearch' >> /etc/hosts 338 | echo '216.239.38.120 www.google.bf #forcesafesearch' >> /etc/hosts 339 | echo '216.239.38.120 www.google.bg #forcesafesearch' >> /etc/hosts 340 | echo '216.239.38.120 www.google.com.bh #forcesafesearch' >> /etc/hosts 341 | echo '216.239.38.120 www.google.bi #forcesafesearch' >> /etc/hosts 342 | echo '216.239.38.120 www.google.bj #forcesafesearch' >> /etc/hosts 343 | echo '216.239.38.120 www.google.com.bn #forcesafesearch' >> /etc/hosts 344 | echo '216.239.38.120 www.google.com.bo #forcesafesearch' >> /etc/hosts 345 | echo '216.239.38.120 www.google.com.br #forcesafesearch' >> /etc/hosts 346 | echo '216.239.38.120 www.google.bs #forcesafesearch' >> /etc/hosts 347 | echo '216.239.38.120 www.google.bt #forcesafesearch' >> /etc/hosts 348 | echo '216.239.38.120 www.google.co.bw #forcesafesearch' >> /etc/hosts 349 | echo '216.239.38.120 www.google.by #forcesafesearch' >> /etc/hosts 350 | echo '216.239.38.120 www.google.com.bz #forcesafesearch' >> /etc/hosts 351 | echo '216.239.38.120 www.google.ca #forcesafesearch' >> /etc/hosts 352 | echo '216.239.38.120 www.google.cd #forcesafesearch' >> /etc/hosts 353 | echo '216.239.38.120 www.google.cf #forcesafesearch' >> /etc/hosts 354 | echo '216.239.38.120 www.google.cg #forcesafesearch' >> /etc/hosts 355 | echo '216.239.38.120 www.google.ch #forcesafesearch' >> /etc/hosts 356 | echo '216.239.38.120 www.google.ci #forcesafesearch' >> /etc/hosts 357 | echo '216.239.38.120 www.google.co.ck #forcesafesearch' >> /etc/hosts 358 | echo '216.239.38.120 www.google.cl #forcesafesearch' >> /etc/hosts 359 | echo '216.239.38.120 www.google.cm #forcesafesearch' >> /etc/hosts 360 | echo '216.239.38.120 www.google.cn #forcesafesearch' >> /etc/hosts 361 | echo '216.239.38.120 www.google.com.co #forcesafesearch' >> /etc/hosts 362 | echo '216.239.38.120 www.google.co.cr #forcesafesearch' >> /etc/hosts 363 | echo '216.239.38.120 www.google.com.cu #forcesafesearch' >> /etc/hosts 364 | echo '216.239.38.120 www.google.cv #forcesafesearch' >> /etc/hosts 365 | echo '216.239.38.120 www.google.com.cy #forcesafesearch' >> /etc/hosts 366 | echo '216.239.38.120 www.google.cz #forcesafesearch' >> /etc/hosts 367 | echo '216.239.38.120 www.google.de #forcesafesearch' >> /etc/hosts 368 | echo '216.239.38.120 www.google.dj #forcesafesearch' >> /etc/hosts 369 | echo '216.239.38.120 www.google.dk #forcesafesearch' >> /etc/hosts 370 | echo '216.239.38.120 www.google.dm #forcesafesearch' >> /etc/hosts 371 | echo '216.239.38.120 www.google.com.do #forcesafesearch' >> /etc/hosts 372 | echo '216.239.38.120 www.google.dz #forcesafesearch' >> /etc/hosts 373 | echo '216.239.38.120 www.google.com.ec #forcesafesearch' >> /etc/hosts 374 | echo '216.239.38.120 www.google.ee #forcesafesearch' >> /etc/hosts 375 | echo '216.239.38.120 www.google.com.eg #forcesafesearch' >> /etc/hosts 376 | echo '216.239.38.120 www.google.es #forcesafesearch' >> /etc/hosts 377 | echo '216.239.38.120 www.google.com.et #forcesafesearch' >> /etc/hosts 378 | echo '216.239.38.120 www.google.fi #forcesafesearch' >> /etc/hosts 379 | echo '216.239.38.120 www.google.com.fj #forcesafesearch' >> /etc/hosts 380 | echo '216.239.38.120 www.google.fm #forcesafesearch' >> /etc/hosts 381 | echo '216.239.38.120 www.google.fr #forcesafesearch' >> /etc/hosts 382 | echo '216.239.38.120 www.google.ga #forcesafesearch' >> /etc/hosts 383 | echo '216.239.38.120 www.google.ge #forcesafesearch' >> /etc/hosts 384 | echo '216.239.38.120 www.google.gg #forcesafesearch' >> /etc/hosts 385 | echo '216.239.38.120 www.google.com.gh #forcesafesearch' >> /etc/hosts 386 | echo '216.239.38.120 www.google.com.gi #forcesafesearch' >> /etc/hosts 387 | echo '216.239.38.120 www.google.gl #forcesafesearch' >> /etc/hosts 388 | echo '216.239.38.120 www.google.gm #forcesafesearch' >> /etc/hosts 389 | echo '216.239.38.120 www.google.gr #forcesafesearch' >> /etc/hosts 390 | echo '216.239.38.120 www.google.com.gt #forcesafesearch' >> /etc/hosts 391 | echo '216.239.38.120 www.google.gy #forcesafesearch' >> /etc/hosts 392 | echo '216.239.38.120 www.google.com.hk #forcesafesearch' >> /etc/hosts 393 | echo '216.239.38.120 www.google.hn #forcesafesearch' >> /etc/hosts 394 | echo '216.239.38.120 www.google.hr #forcesafesearch' >> /etc/hosts 395 | echo '216.239.38.120 www.google.ht #forcesafesearch' >> /etc/hosts 396 | echo '216.239.38.120 www.google.hu #forcesafesearch' >> /etc/hosts 397 | echo '216.239.38.120 www.google.co.id #forcesafesearch' >> /etc/hosts 398 | echo '216.239.38.120 www.google.ie #forcesafesearch' >> /etc/hosts 399 | echo '216.239.38.120 www.google.co.il #forcesafesearch' >> /etc/hosts 400 | echo '216.239.38.120 www.google.im #forcesafesearch' >> /etc/hosts 401 | echo '216.239.38.120 www.google.co.in #forcesafesearch' >> /etc/hosts 402 | echo '216.239.38.120 www.google.iq #forcesafesearch' >> /etc/hosts 403 | echo '216.239.38.120 www.google.is #forcesafesearch' >> /etc/hosts 404 | echo '216.239.38.120 www.google.it #forcesafesearch' >> /etc/hosts 405 | echo '216.239.38.120 www.google.je #forcesafesearch' >> /etc/hosts 406 | echo '216.239.38.120 www.google.com.jm #forcesafesearch' >> /etc/hosts 407 | echo '216.239.38.120 www.google.jo #forcesafesearch' >> /etc/hosts 408 | echo '216.239.38.120 www.google.co.jp #forcesafesearch' >> /etc/hosts 409 | echo '216.239.38.120 www.google.co.ke #forcesafesearch' >> /etc/hosts 410 | echo '216.239.38.120 www.google.com.kh #forcesafesearch' >> /etc/hosts 411 | echo '216.239.38.120 www.google.ki #forcesafesearch' >> /etc/hosts 412 | echo '216.239.38.120 www.google.kg #forcesafesearch' >> /etc/hosts 413 | echo '216.239.38.120 www.google.co.kr #forcesafesearch' >> /etc/hosts 414 | echo '216.239.38.120 www.google.com.kw #forcesafesearch' >> /etc/hosts 415 | echo '216.239.38.120 www.google.kz #forcesafesearch' >> /etc/hosts 416 | echo '216.239.38.120 www.google.la #forcesafesearch' >> /etc/hosts 417 | echo '216.239.38.120 www.google.com.lb #forcesafesearch' >> /etc/hosts 418 | echo '216.239.38.120 www.google.li #forcesafesearch' >> /etc/hosts 419 | echo '216.239.38.120 www.google.lk #forcesafesearch' >> /etc/hosts 420 | echo '216.239.38.120 www.google.co.ls #forcesafesearch' >> /etc/hosts 421 | echo '216.239.38.120 www.google.lt #forcesafesearch' >> /etc/hosts 422 | echo '216.239.38.120 www.google.lu #forcesafesearch' >> /etc/hosts 423 | echo '216.239.38.120 www.google.lv #forcesafesearch' >> /etc/hosts 424 | echo '216.239.38.120 www.google.com.ly #forcesafesearch' >> /etc/hosts 425 | echo '216.239.38.120 www.google.co.ma #forcesafesearch' >> /etc/hosts 426 | echo '216.239.38.120 www.google.md #forcesafesearch' >> /etc/hosts 427 | echo '216.239.38.120 www.google.me #forcesafesearch' >> /etc/hosts 428 | echo '216.239.38.120 www.google.mg #forcesafesearch' >> /etc/hosts 429 | echo '216.239.38.120 www.google.mk #forcesafesearch' >> /etc/hosts 430 | echo '216.239.38.120 www.google.ml #forcesafesearch' >> /etc/hosts 431 | echo '216.239.38.120 www.google.com.mm #forcesafesearch' >> /etc/hosts 432 | echo '216.239.38.120 www.google.mn #forcesafesearch' >> /etc/hosts 433 | echo '216.239.38.120 www.google.ms #forcesafesearch' >> /etc/hosts 434 | echo '216.239.38.120 www.google.com.mt #forcesafesearch' >> /etc/hosts 435 | echo '216.239.38.120 www.google.mu #forcesafesearch' >> /etc/hosts 436 | echo '216.239.38.120 www.google.mv #forcesafesearch' >> /etc/hosts 437 | echo '216.239.38.120 www.google.mw #forcesafesearch' >> /etc/hosts 438 | echo '216.239.38.120 www.google.com.mx #forcesafesearch' >> /etc/hosts 439 | echo '216.239.38.120 www.google.com.my #forcesafesearch' >> /etc/hosts 440 | echo '216.239.38.120 www.google.co.mz #forcesafesearch' >> /etc/hosts 441 | echo '216.239.38.120 www.google.com.na #forcesafesearch' >> /etc/hosts 442 | echo '216.239.38.120 www.google.com.ng #forcesafesearch' >> /etc/hosts 443 | echo '216.239.38.120 www.google.com.ni #forcesafesearch' >> /etc/hosts 444 | echo '216.239.38.120 www.google.ne #forcesafesearch' >> /etc/hosts 445 | echo '216.239.38.120 www.google.nl #forcesafesearch' >> /etc/hosts 446 | echo '216.239.38.120 www.google.no #forcesafesearch' >> /etc/hosts 447 | echo '216.239.38.120 www.google.com.np #forcesafesearch' >> /etc/hosts 448 | echo '216.239.38.120 www.google.nr #forcesafesearch' >> /etc/hosts 449 | echo '216.239.38.120 www.google.nu #forcesafesearch' >> /etc/hosts 450 | echo '216.239.38.120 www.google.co.nz #forcesafesearch' >> /etc/hosts 451 | echo '216.239.38.120 www.google.com.om #forcesafesearch' >> /etc/hosts 452 | echo '216.239.38.120 www.google.com.pa #forcesafesearch' >> /etc/hosts 453 | echo '216.239.38.120 www.google.com.pe #forcesafesearch' >> /etc/hosts 454 | echo '216.239.38.120 www.google.com.pg #forcesafesearch' >> /etc/hosts 455 | echo '216.239.38.120 www.google.com.ph #forcesafesearch' >> /etc/hosts 456 | echo '216.239.38.120 www.google.com.pk #forcesafesearch' >> /etc/hosts 457 | echo '216.239.38.120 www.google.pl #forcesafesearch' >> /etc/hosts 458 | echo '216.239.38.120 www.google.pn #forcesafesearch' >> /etc/hosts 459 | echo '216.239.38.120 www.google.com.pr #forcesafesearch' >> /etc/hosts 460 | echo '216.239.38.120 www.google.ps #forcesafesearch' >> /etc/hosts 461 | echo '216.239.38.120 www.google.pt #forcesafesearch' >> /etc/hosts 462 | echo '216.239.38.120 www.google.com.py #forcesafesearch' >> /etc/hosts 463 | echo '216.239.38.120 www.google.com.qa #forcesafesearch' >> /etc/hosts 464 | echo '216.239.38.120 www.google.ro #forcesafesearch' >> /etc/hosts 465 | echo '216.239.38.120 www.google.ru #forcesafesearch' >> /etc/hosts 466 | echo '216.239.38.120 www.google.rw #forcesafesearch' >> /etc/hosts 467 | echo '216.239.38.120 www.google.com.sa #forcesafesearch' >> /etc/hosts 468 | echo '216.239.38.120 www.google.com.sb #forcesafesearch' >> /etc/hosts 469 | echo '216.239.38.120 www.google.sc #forcesafesearch' >> /etc/hosts 470 | echo '216.239.38.120 www.google.se #forcesafesearch' >> /etc/hosts 471 | echo '216.239.38.120 www.google.com.sg #forcesafesearch' >> /etc/hosts 472 | echo '216.239.38.120 www.google.sh #forcesafesearch' >> /etc/hosts 473 | echo '216.239.38.120 www.google.si #forcesafesearch' >> /etc/hosts 474 | echo '216.239.38.120 www.google.sk #forcesafesearch' >> /etc/hosts 475 | echo '216.239.38.120 www.google.com.sl #forcesafesearch' >> /etc/hosts 476 | echo '216.239.38.120 www.google.sn #forcesafesearch' >> /etc/hosts 477 | echo '216.239.38.120 www.google.so #forcesafesearch' >> /etc/hosts 478 | echo '216.239.38.120 www.google.sm #forcesafesearch' >> /etc/hosts 479 | echo '216.239.38.120 www.google.sr #forcesafesearch' >> /etc/hosts 480 | echo '216.239.38.120 www.google.st #forcesafesearch' >> /etc/hosts 481 | echo '216.239.38.120 www.google.com.sv #forcesafesearch' >> /etc/hosts 482 | echo '216.239.38.120 www.google.td #forcesafesearch' >> /etc/hosts 483 | echo '216.239.38.120 www.google.tg #forcesafesearch' >> /etc/hosts 484 | echo '216.239.38.120 www.google.co.th #forcesafesearch' >> /etc/hosts 485 | echo '216.239.38.120 www.google.com.tj #forcesafesearch' >> /etc/hosts 486 | echo '216.239.38.120 www.google.tl #forcesafesearch' >> /etc/hosts 487 | echo '216.239.38.120 www.google.tm #forcesafesearch' >> /etc/hosts 488 | echo '216.239.38.120 www.google.tn #forcesafesearch' >> /etc/hosts 489 | echo '216.239.38.120 www.google.to #forcesafesearch' >> /etc/hosts 490 | echo '216.239.38.120 www.google.com.tr #forcesafesearch' >> /etc/hosts 491 | echo '216.239.38.120 www.google.tt #forcesafesearch' >> /etc/hosts 492 | echo '216.239.38.120 www.google.com.tw #forcesafesearch' >> /etc/hosts 493 | echo '216.239.38.120 www.google.co.tz #forcesafesearch' >> /etc/hosts 494 | echo '216.239.38.120 www.google.com.ua #forcesafesearch' >> /etc/hosts 495 | echo '216.239.38.120 www.google.co.ug #forcesafesearch' >> /etc/hosts 496 | echo '216.239.38.120 www.google.co.uk #forcesafesearch' >> /etc/hosts 497 | echo '216.239.38.120 www.google.com.uy #forcesafesearch' >> /etc/hosts 498 | echo '216.239.38.120 www.google.co.uz #forcesafesearch' >> /etc/hosts 499 | echo '216.239.38.120 www.google.com.vc #forcesafesearch' >> /etc/hosts 500 | echo '216.239.38.120 www.google.co.ve #forcesafesearch' >> /etc/hosts 501 | echo '216.239.38.120 www.google.vg #forcesafesearch' >> /etc/hosts 502 | echo '216.239.38.120 www.google.co.vi #forcesafesearch' >> /etc/hosts 503 | echo '216.239.38.120 www.google.com.vn #forcesafesearch' >> /etc/hosts 504 | echo '216.239.38.120 www.google.vu #forcesafesearch' >> /etc/hosts 505 | echo '216.239.38.120 www.google.ws #forcesafesearch' >> /etc/hosts 506 | echo '216.239.38.120 www.google.rs #forcesafesearch' >> /etc/hosts 507 | echo '216.239.38.120 www.google.co.za #forcesafesearch' >> /etc/hosts 508 | echo '216.239.38.120 www.google.co.zm #forcesafesearch' >> /etc/hosts 509 | echo '216.239.38.120 www.google.co.zw #forcesafesearch' >> /etc/hosts 510 | echo '216.239.38.120 www.google.cat #forcesafesearch' >> /etc/hosts 511 | 512 | if ! grep -q '[^[:space:]]' /etc/hosts 513 | then 514 | echo '# \nSomething went wrong! Reverting to fallback hosts file.\n' 515 | sleep 2 516 | echo '$FALLBACK' | tee /etc/hosts 517 | else 518 | echo '# \nAdding auto update crontab\n' 519 | sleep 2 520 | crontab -l | grep -v 'hostminder' | crontab - 521 | (crontab -l && echo '0 0 * * 0 hostminder ${1}') | crontab - 522 | fi 523 | 524 | echo '# \nCleaning up\n' 525 | sleep 2 526 | rm /etc/hosts_hostminder_bak 527 | rm /tmp/bad.host.list.hostminder.txt 528 | fi 529 | " 530 | echo "# \nAll finished\n" 531 | sleep 2 532 | else 533 | if [ "$2" != "auto" ] 534 | then 535 | wget_failure 536 | fi 537 | fi 538 | 539 | ) | 540 | zenity --progress \ 541 | --title="$APP_TITLE: Progress" \ 542 | --width=400 \ 543 | --height=100 \ 544 | --percentage=0 \ 545 | --auto-close \ 546 | --auto-kill \ 547 | --no-cancel \ 548 | --pulsate \ 549 | --window-icon=/usr/share/pixmaps/hostminder.png 550 | 551 | (($? != 0)) && general_failure 552 | 553 | if [ "$2" != "auto" ] 554 | then 555 | settings 556 | fi 557 | } 558 | 559 | revert_hosts() { 560 | if [ "$1" != "auto" ] 561 | then 562 | confirm 563 | fi 564 | 565 | ( 566 | echo "# \nReverting to original hosts file\n" 567 | sleep 2 568 | pkexec bash -c " 569 | if grep -q 'GENERATED BY $APP_TITLE' /etc/hosts 570 | then 571 | echo '# \nExtracting custom entries\n' 572 | sleep 2 573 | sed -n '/# Custom host records are listed here./I,/# End of custom host records./I{ /# /Id; p }' /etc/hosts > /etc/hosts_hostminder_bak 574 | else 575 | echo '# \nBacking up current hosts file\n' 576 | sleep 2 577 | cp /etc/hosts /etc/hosts_hostminder_bak 578 | fi 579 | 580 | sed -i '/^[[:space:]]*$/d' /etc/hosts_hostminder_bak 581 | cp /etc/hosts_hostminder_bak /etc/hosts 582 | 583 | if ! grep -q '[^[:space:]]' /etc/hosts 584 | then 585 | echo '# \nSomething went wrong! Reverting to fallback hosts file\n' 586 | sleep 2 587 | echo '$FALLBACK' | tee /etc/hosts 588 | fi 589 | 590 | echo '# \nRemoving auto update crontab\n' 591 | sleep 2 592 | crontab -l | grep -v 'hostminder' | crontab - 593 | 594 | echo '# \nCleaning up\n' 595 | sleep 2 596 | rm /etc/hosts_hostminder_bak 597 | rm /tmp/bad.host.list.hostminder.txt 598 | " 599 | 600 | echo "# \nAll finished\n" 601 | sleep 2 602 | 603 | ) | 604 | zenity --progress \ 605 | --title="$APP_TITLE: Progress" \ 606 | --width=400 \ 607 | --height=100 \ 608 | --percentage=0 \ 609 | --auto-close \ 610 | --auto-kill \ 611 | --no-cancel \ 612 | --pulsate \ 613 | --window-icon=/usr/share/pixmaps/hostminder.png 614 | 615 | (($? != 0)) && zenity --window-icon=/usr/share/pixmaps/hostminder.png --error --text="Error in zenity command." 616 | 617 | if [ "$1" != "auto" ] 618 | then 619 | settings 620 | fi 621 | } 622 | 623 | if [ "$1" == "low" ] || [ "$1" == "medium" ] || [ "$1" == "high" ] || [ "$1" == "max" ] 624 | then 625 | update_hosts "$1" auto 626 | elif [ "$1" == "off" ] 627 | then 628 | revert_hosts auto 629 | else 630 | settings fresh 631 | fi 632 | 633 | --------------------------------------------------------------------------------