├── LICENSE
├── README.md
├── WebBlockerScript.cmd
└── assets
├── imgBanner
└── WebBlockerProxy.png
└── imgReadme
├── 1.png
├── 2.png
├── 3.png
├── 4.png
└── 5.png
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 KARTHIK LAL
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 | # **WebBlockerProxy | WebBlockerScript**
2 |
3 |
4 | 
5 |
6 | 
7 | 
8 | 
9 | 
10 | 
11 | 
12 |
13 | ## Table of Contents
14 | - [About](#about)
15 | - [Usage](#usage)
16 | - [Overview of the Menu](#overview-of-the-menu)
17 | - [Features](#features)
18 | - [Contribution](#contribution)
19 | - [Developer Information](#developer-information)
20 |
21 | ## About
22 |
23 | WebBlockerScript is a simple command-line tool written in Batch script that allows users to easily block access to specific websites on their Windows computer by modifying the hosts file. This tool provides a user-friendly menu system that allows users to add custom websites to block, remove blocked websites, and even backup and restore their hosts file. It is designed to be easy to use and requires no technical knowledge or expertise to operate. This tool can be useful for parents who want to limit their children's access to certain websites or for anyone who wants to improve their productivity by blocking distracting websites during work hours.
24 |
25 |
26 |
27 |
28 |  |
29 |  |
30 |
31 |
32 |  |
33 |  |
34 |
35 |
36 |  |
37 |
38 |
39 |
40 | ## Usage
41 |
42 | - **1. Clone the repository (or download from the releases page)** - `git clone https://github.com/karthik558/WebBlockerScript`
43 | - **2. Run the script as administrator. (Right-click on the script and select "Run as administrator")**
44 | - **3. Select an option from the menu. (1-13)**
45 | - **4. Follow the on-screen instructions to block/unblock websites, add/remove websites to block, backup/restore hosts file, etc.**
46 | - **5. Always flush the DNS cache after blocking/unblocking a website. (Option 8)**
47 | - **6. Use Task Scheduler to run the script at a scheduled time to block websites. (Option 10)**
48 | - **7. Select a custom block list file to block websites. (Option 11)**
49 | - **8. Update the block list file with the latest version from the GitHub repository. (Option 12)** (If block.txt is not present in the same directory, then run the script with the internet connection to download the latest block list file. **(Option 12))**
50 | - **9. That's it! The script will do the rest.**
51 |
52 | ## Overview of the Menu
53 | - **1. Block a website** - Blocks all the websites that are stored in the `WebBlockerScript.cmd` file.
54 | - **2. Unblock a website** - Removes all the websites that are stored in the `WebBlockerScript.cmd` file.
55 | - **3. Add a website to block** - Allows you to add a custom website to block.
56 | - **4. Remove a website from block** - Allows you to remove a custom website from block.
57 | - **5. Backup hosts file** - Creates a backup of the current hosts file.
58 | - **6. Restore hosts file** - Restores the hosts file from the backup.
59 | - **7. View host file** - Displays the contents of the hosts file in the notepad.
60 | - **8. Flush DNS cache** - Flushes the DNS cache. (Always recommended after blocking/unblocking a website)
61 | - **9. Unblock WhatsApp** - Unblocks WhatsApp by removing the block from the hosts file. (Quick access to WhatsApp)
62 | - **10. Set Blocking Schedule** - Allows you to set a schedule for blocking websites. (Use Task Scheduler to run the script at the scheduled time)
63 | - **11. Select Block List File** - Allows you to select a custom block list file to block websites.
64 | - **12. Update Block List File** - Updates the block list file with the latest version from the GitHub repository.
65 | - **13. Exit** - Exits the script.
66 |
67 | ## Features
68 |
69 | - **1. Block access to specific websites on your Windows computer.**
70 | - **2. Add custom websites to block.**
71 | - **3. Remove blocked websites.**
72 | - **4. Backup and restore hosts file.**
73 | - **5. Easy to use menu system.**
74 | - **6. No technical knowledge or expertise required. (1-4)**
75 | - **7. Free and open-source.**
76 | - **8. Regular updates and improvements.**
77 | - **9. Block websites on a schedule.**
78 | - **10. Select custom block list file.**
79 |
80 | ## Contribution
81 |
82 | - **This project is open to contributions. Feel free to open a pull request or an issue if you want to contribute to this project.**
83 | - **If you find any bugs or issues, please report them in the issues section.**
84 |
85 | ## Developer Information
86 |
87 | This project was developed by [KARTHIK LAL](https://karthiklal.in). You can contact me at [dev@karthiklal.in](mailto:dev@karthiklal.in) for any queries or suggestions.
88 |
--------------------------------------------------------------------------------
/WebBlockerScript.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | @REM [Default variables]
4 | set "developer=KARTHIK LAL"
5 | set "email=dev@karthiklal.in"
6 | set "project=WebBlockerScript"
7 | set "projectU=WEB BLOCKER SCRIPT"
8 | set "description=Block all unwanted websites from the list and can block custom websites."
9 | set "title=WebBlockerProxy"
10 | set "created-date=2023-04-28"
11 | set "version=1.9.6"
12 | set "copy-right=(C) 2023-2024 %developer%"
13 | set "author-website=karthiklal.in"
14 |
15 | @REM Console Header Settings
16 | title %title%
17 |
18 | @REM Check permission to continue the script
19 | goto check_Permissions
20 |
21 | :check_Permissions
22 | echo Checking for administrator permissions
23 |
24 | @REM Administrator permission is required to run this script
25 | net session >nul 2>&1
26 | if %errorLevel% == 0 (
27 | color 2F
28 | echo Success, You are running this script as administrator
29 | cls
30 | ) else (
31 | color 4F
32 | echo Error, You are not running this script as administrator
33 |
34 | @REM Pause until the user hits any key
35 | pause >nul 2>&1
36 | exit /b 1
37 | )
38 |
39 | @REM 888 888 888 888888b. 888 888
40 | @REM 888 o 888 888 888 "88b 888 888
41 | @REM 888 d8b 888 888 888 .88P 888 888
42 | @REM 888 d888b 888 .d88b. 88888b. 8888888K. 888 .d88b. .d8888b 888 888 .d88b. 888d888
43 | @REM 888d88888b888 d8P Y8b 888 "88b 888 "Y88b 888 d88""88b d88P" 888 .88P d8P Y8b 888P"
44 | @REM 88888P Y88888 88888888 888 888 888 888 888 888 888 888 888888K 88888888 888
45 | @REM 8888P Y8888 Y8b. 888 d88P 888 d88P 888 Y88..88P Y88b. 888 "88b Y8b. 888
46 | @REM 888P Y888 "Y8888 88888P" 8888888P" 888 "Y88P" "Y8888P 888 888 "Y8888 888
47 | echo .
48 |
49 | setlocal EnableDelayedExpansions
50 |
51 | @REM List of websites to block
52 | set BLOCKED_WEBSITES=facebook.com twitter.com instagram.com youtube.com whatsapp.com tiktok.com linkedin.com pinterest.com reddit.com tumblr.com snapchat.com quora.com telegram.com flickr.com meetup.com myspace.com ask.fm douban.com weibo.com vk.com ok.ru douba.com amazon.in flipkart.com www.facebook.com www.twitter.com www.instagram.com www.youtube.com www.whatsapp.com www.tiktok.com www.linkedin.com www.pinterest.com www.reddit.com www.tumblr.com www.snapchat.com www.quora.com www.telegram.com www.flickr.com www.meetup.com www.myspace.com www.ask.fm www.douban.com www.weibo.com www.vk.com www.ok.ru www.douba.com www.amazon.in www.flipkart.com https://facebook.com https://twitter.com https://instagram.com https://youtube.com https://whatsapp.com https://tiktok.com https://linkedin.com https://pinterest.com https://reddit.com https://tumblr.com https://snapchat.com https://quora.com https://telegram.com https://flickr.com https://meetup.com https://myspace.com https://ask.fm https://douban.com https://weibo.com https://vk.com https://ok.ru https://douba.com https://www.facebook.com https://www.twitter.com https://www.instagram.com https://www.youtube.com https://www.whatsapp.com https://www.tiktok.com https://www.linkedin.com https://www.pinterest.com https://www.reddit.com https://www.tumblr.com https://www.snapchat.com https://www.quora.com https://www.telegram.com https://www.flickr.com https://www.meetup.com https://www.myspace.com https://www.ask.fm https://www.douban.com https://www.weibo.com https://www.vk.com https://www.ok.ru https://www.douba.com https://www.amazon.in https://www.flipkart.com myntra.com jabong.com ajio.com ebay.com paytm.com snapdeal.com shopclues.com homeshop18.com infibeam.com naaptol.com zivame.com clovia.com prettysecrets.com shyaway.com honeymoonpackagesindia.co.in purenudism.com nudist-video.com nudist-gallery.com mynudistsearch.com playboy.com penthouse.com hustler.com vivid.com brazzers.com twistys.com realitykings.com digitalplayground.com naughtyamerica.com fapdu.com redtube.com youporn.com pornhub.com xhamster.com xnxx.com xvideos.com txxx.com keezmovies.com entertainment.com hulu.com netflix.com hotstar.com amazonprime.com voot.com zee5.com jiocinema.com erosnow.com disneyplus.com www.myntra.com www.jabong.com www.ajio.com www.ebay.com www.paytm.com www.snapdeal.com www.shopclues.com www.homeshop18.com www.infibeam.com www.naaptol.com www.zivame.com www.clovia.com www.prettysecrets.com www.shyaway.com www.honeymoonpackagesindia.co.in www.purenudism.com www.nudist-video.com www.nudist-gallery.com www.mynudistsearch.com www.playboy.com www.penthouse.com www.hustler.com www.vivid.com www.brazzers.com www.twistys.com www.realitykings.com www.digitalplayground.com www.naughtyamerica.com www.fapdu.com www.redtube.com www.youporn.com www.pornhub.com www.xhamster.com www.xnxx.com www.xvideos.com www.txxx.com www.keezmovies.com www.entertainment.com www.hulu.com www.netflix.com www.hotstar.com www.amazonprime.com www.voot.com www.zee5.com www.jiocinema.com www.erosnow.com www.disneyplus.com https://myntra.com https://jabong.com https://ajio.com https://ebay.com https://paytm.com https://snapdeal.com https://shopclues.com https://homeshop18.com https://infibeam.com https://naaptol.com https://zivame.com https://clovia.com https://prettysecrets.com https://shyaway.com https://honeymoonpackagesindia.co.in https://purenudism.com https://nudist-video.com https://nudist-gallery.com https://mynudistsearch.com https://playboy.com https://penthouse.com https://hustler.com https://vivid.com https://brazzers.com https://twistys.com https://realitykings.com https://digitalplayground.com https://naughtyamerica.com https://fapdu.com https://redtube.com https://youporn.com https://pornhub.com https://xhamster.com https://xnxx.com https://xvideos.com https://txxx.com https://keezmovies.com https://entertainment.com https://hulu.com https://netflix.com https://hotstar.com https://amazonprime.com https://voot.com https://zee5.com https://jiocinema.com https://erosnow.com https://disneyplus.com https://www.myntra.com https://www.jabong.com https://www.ajio.com https://www.ebay.com https://www.paytm.com https://www.snapdeal.com https://www.shopclues.com https://www.homeshop18.com https://www.infibeam.com https://www.naaptol.com https://www.zivame.com https://www.clovia.com https://www.prettysecrets.com https://www.shyaway.com https://www.honeymoonpackagesindia.co.in https://www.purenudism.com https://www.nudist-video.com https://www.nudist-gallery.com https://www.mynudistsearch.com https://www.playboy.com https://www.penthouse.com https://www.hustler.com https://www.vivid.com https://www.brazzers.com https://www.twistys.com https://www.realitykings.com https://www.digitalplayground.com https://www.naughtyamerica.com https://www.fapdu.com https://www.redtube.com https://www.youporn.com https://www.pornhub.com https://www.xhamster.com https://www.xnxx.com https://www.xvideos.com https://www.txxx.com https://www.keezmovies.com https://www.entertainment.com https://www.hulu.com https://www.netflix.com https://www.hotstar.com https://www.amazonprime.com https://www.voot.com https://www.zee5.com https://www.jiocinema.com https://www.erosnow.com https://www.disneyplus.com https://web.whatsapp.com https://www.web.whatsapp.com web.whatsapp.com https://www.manoramaonline.com www.manoramaonline.com manoramaonline.com https://www.thehindu.com www.thehindu.com w.thehindu.com https://www.asianetnews.com https://asianetnews.com asianetnews.com https://malayalam.news18.com https://www.malayalam.news18.com www.malayalam.news18.com https://www.mathrubhumi.com https://mathrubhumi.com www.mathrubhumi.com https://www.twentyfournews.com https://twentyfournews.com www.twentyfournews.com https://www.aksharathalukal.in www.aksharathalukal.in aksharathalukal.in https://storymalayalam.com https://www.storymalayalam.com www.storymalayalam.com https://malayalam.pratilipi.com https://www.malayalam.pratilipi.com malayalam.pratilipi.com https://www.kadhajalakam.com https://kadhajalakam.com kadhajalakam.com
53 |
54 | @REM Set the path to the hosts file
55 | set "host=%windir%\System32\drivers\etc\hosts"
56 | set "comment=#WebBlockerProxies"
57 | cls
58 |
59 | :MENU
60 | color 4F
61 | @REM Developer information
62 | echo Developer : %developer%
63 | echo Version : %version%
64 | echo Created Date : %created-date%
65 | echo Project : %project%
66 | echo Purpose : %description%
67 | echo.
68 | echo ====================================
69 | echo %projectU% - %developer%
70 | echo ====================================
71 | echo.ß
72 | echo 1. Block Websites from the List
73 | echo 2. Unblock Websites from the List
74 | echo 3. Block Custom Websites (e.g. example.com)
75 | echo 4. Unblock Custom Websites (e.g. example.com)
76 | echo 5. Backup Host File (Default)
77 | echo 6. Restore Host File (Default)
78 | echo 7. Check Host File
79 | echo 8. Flush DNS Cache
80 | echo 9. Exit
81 | echo 10. Whatsapp Unblock (Experimental)
82 | echo.
83 | set /p option="Enter your selection: "
84 |
85 | if "%option%"=="1" goto BLOCK
86 | if "%option%"=="2" goto UNBLOCK
87 | if "%option%"=="3" goto ADD_CUSTOM
88 | if "%option%"=="4" goto UNBLOCK_CUSTOM
89 | if "%option%"=="5" goto BACKUP_HOST
90 | if "%option%"=="6" goto RESTORE_HOST
91 | if "%option%"=="7" goto VIEW_HOST
92 | if "%option%"=="8" goto FLUSHDNS
93 | if "%option%"=="9" goto DONE
94 | if "%option%"=="10" goto WHATSAPP_UNBLOCK
95 | echo Invalid option.
96 | timeout 1
97 | goto MENU
98 |
99 | :BLOCK
100 | color 4F
101 | @REM Check if the block list already exists
102 | findstr /i /c:"%comment%" "%host%" >nul
103 | if %errorlevel%==1 (
104 | REM Add the comment to the host file
105 | echo.%comment%>>"%host%"
106 | echo.
107 | )
108 | @REM Block the websites by redirecting them to localhost
109 | for %%i in (%BLOCKED_WEBSITES%) do (
110 | findstr /i /c:"%%i" "%host%" >nul
111 | if %errorlevel%==1 (
112 | echo 127.0.0.1 %%i>>"%host%"
113 | echo Blocked: %%i
114 | )
115 | )
116 | echo Websites blocked successfully.
117 | echo.
118 | timeout 5
119 | goto MENU
120 |
121 | :UNBLOCK
122 | color 2F
123 | REM Remove the block list if it exists
124 | findstr /i /c:"%comment%" "%host%" >nul
125 | if %errorlevel%==0 (
126 | REM Remove all lines that match the comment header
127 | findstr /i /v /c:"%comment%" "%host%" >"%host%.tmp"
128 |
129 | REM Remove the remaining lines that contain blocked websites
130 | for %%i in (%BLOCKED_WEBSITES%) do (
131 | findstr /i /v /c:"%%i" "%host%.tmp" >"%host%.tmp2"
132 | move /y "%host%.tmp2" "%host%.tmp" >nul
133 | )
134 |
135 | REM Replace the original file with the modified file
136 | move /y "%host%.tmp" "%host%" >nul
137 | )
138 | echo Websites unblocked successfully.
139 | timeout 5
140 | goto MENU
141 |
142 | :ADD_CUSTOM
143 | color 4F
144 | set /p custom="Enter the website to block: "
145 | set BLOCKED_WEBSITES=!BLOCKED_WEBSITES! !custom!
146 | echo 127.0.0.1 %custom%>>"%host%"
147 | echo Blocked: %custom%
148 |
149 | set /p more="Do you want to add more websites? (Y/N) "
150 | if /i "%more%"=="Y" goto ADD_CUSTOM
151 |
152 | echo Websites added successfully.
153 | timeout 5
154 | goto MENU
155 |
156 | :UNBLOCK_CUSTOM
157 | color 2F
158 | set /p website_to_unblock="Enter the website to unblock (e.g. example.com): "
159 | REM Remove the website from the host file
160 | findstr /i /c:"%website_to_unblock%" "%host%" >nul
161 | if %errorlevel%==0 (
162 | findstr /i /v /c:"%website_to_unblock%" "%host%" >"%host%.tmp"
163 | move /y "%host%.tmp" "%host%" >nul
164 | echo Website %website_to_unblock% unblocked successfully.
165 | ) else (
166 | echo Website %website_to_unblock% is not blocked.
167 | )
168 |
169 | set /p unblock_more="Do you want to unblock more websites? (Y/N): "
170 | if /i "%unblock_more%"=="Y" (
171 | goto UNBLOCK_CUSTOM
172 | ) else (
173 | timeout 5
174 | goto MENU
175 | )
176 |
177 | :BACKUP_HOST
178 | color 5F
179 | set /p backup="Do you want to backup your current hosts file? (Y/N) "
180 | if /i "%backup%"=="Y" (
181 | xcopy /y "%host%" "%host%.bak"
182 | echo Backup successful. Hosts file saved as %host%.bak.
183 | ) else (
184 | echo Backup skipped.
185 | timeout 5
186 | )
187 | goto MENU
188 |
189 | :RESTORE_HOST
190 | color 5F
191 | set /p restore="Do you want to restore your previous hosts file? (Y/N) "
192 | if /i "%restore%"=="Y" (
193 | if exist "%host%.bak" (
194 | @@ -188,56 +224,95 @@ if /i "%restore%"=="Y" (
195 | ) else (
196 | echo Restore skipped.
197 | )
198 | timeout 5
199 | goto MENU
200 |
201 | :VIEW_HOST
202 | color 4F
203 | echo.
204 | echo Viewing Host File...
205 | echo.
206 | notepad "%host%"
207 | echo.
208 | echo Host File Viewed Successfully.
209 | timeout 5
210 | goto MENU
211 |
212 | :FLUSHDNS
213 | color 4F
214 | echo.
215 | echo Flushing DNS cache...
216 | ipconfig /flushdns >nul
217 | echo DNS cache flushed successfully.
218 | timeout 5
219 | goto MENU
220 |
221 | goto MENU
222 |
223 | :WHATSAPP_UNBLOCK
224 | color 2F
225 | @REM Unblock whatsapp from the list
226 | findstr /i /c:"%comment%" "%host%" >nul 2>&1
227 | if %errorlevel%==0 (
228 | REM Remove all lines that match the comment header
229 | findstr /i /v /c:"%comment%" "%host%" >"%host%.tmp"
230 |
231 | REM Remove the remaining lines that contain blocked websites
232 | for %%i in (web.whatsapp.com www.web.whatsapp.com) do (
233 | findstr /i /v /c:"%%i" "%host%.tmp" >"%host%.tmp2"
234 | move /y "%host%.tmp2" "%host%.tmp" >nul
235 | )
236 |
237 | REM Replace the original file with the modified file
238 | move /y "%host%.tmp" "%host%" >nul
239 | )
240 | echo Websites unblocked successfully. (Experimental)
241 | timeout 5
242 | goto MENU
243 |
244 | :DONE
245 | cls
246 | color 5F
247 | echo.
248 | echo =======================================ß
249 | echo THANK YOU FOR USING %projectU%
250 | echo =======================================
251 | echo.
252 | echo - DEVELOPER : %developer%
253 | echo - EMAIL : %email%
254 | echo - WEBSITE : %author-website%
255 | echo - VERSION : %version%
256 | echo - CREATED DATE : %created-date%
257 | echo.
258 | echo - Opensource Software License agreement for windows distribution system (https://www.gnu.org/licenses/gpl-3.0.en.html)
259 | echo - Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
260 | echo - Tools are provided as is without warranty of any kind and the author is not responsible for any damage caused by the use of these tools.
261 | echo - Copyright %copy-right%
--------------------------------------------------------------------------------
/assets/imgBanner/WebBlockerProxy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthik558/WebBlockerScript/0e5cde878a69fb1991ce5eac8e4d48e6f25ea9d7/assets/imgBanner/WebBlockerProxy.png
--------------------------------------------------------------------------------
/assets/imgReadme/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthik558/WebBlockerScript/0e5cde878a69fb1991ce5eac8e4d48e6f25ea9d7/assets/imgReadme/1.png
--------------------------------------------------------------------------------
/assets/imgReadme/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthik558/WebBlockerScript/0e5cde878a69fb1991ce5eac8e4d48e6f25ea9d7/assets/imgReadme/2.png
--------------------------------------------------------------------------------
/assets/imgReadme/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthik558/WebBlockerScript/0e5cde878a69fb1991ce5eac8e4d48e6f25ea9d7/assets/imgReadme/3.png
--------------------------------------------------------------------------------
/assets/imgReadme/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthik558/WebBlockerScript/0e5cde878a69fb1991ce5eac8e4d48e6f25ea9d7/assets/imgReadme/4.png
--------------------------------------------------------------------------------
/assets/imgReadme/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthik558/WebBlockerScript/0e5cde878a69fb1991ce5eac8e4d48e6f25ea9d7/assets/imgReadme/5.png
--------------------------------------------------------------------------------