-
Notifications
You must be signed in to change notification settings - Fork 4
/
WebBlockerScript.cmd
261 lines (231 loc) · 13 KB
/
WebBlockerScript.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
@echo off
@REM [Default variables]
set "developer=KARTHIK LAL"
set "[email protected]"
set "project=WebBlockerScript"
set "projectU=WEB BLOCKER SCRIPT"
set "description=Block all unwanted websites from the list and can block custom websites."
set "title=WebBlockerProxy"
set "created-date=2023-04-28"
set "version=1.9.6"
set "copy-right=(C) 2023-2024 %developer%"
set "author-website=karthiklal.in"
@REM Console Header Settings
title %title%
@REM Check permission to continue the script
goto check_Permissions
:check_Permissions
echo Checking for administrator permissions
@REM Administrator permission is required to run this script
net session >nul 2>&1
if %errorLevel% == 0 (
color 2F
echo Success, You are running this script as administrator
cls
) else (
color 4F
echo Error, You are not running this script as administrator
@REM Pause until the user hits any key
pause >nul 2>&1
exit /b 1
)
@REM 888 888 888 888888b. 888 888
@REM 888 o 888 888 888 "88b 888 888
@REM 888 d8b 888 888 888 .88P 888 888
@REM 888 d888b 888 .d88b. 88888b. 8888888K. 888 .d88b. .d8888b 888 888 .d88b. 888d888
@REM 888d88888b888 d8P Y8b 888 "88b 888 "Y88b 888 d88""88b d88P" 888 .88P d8P Y8b 888P"
@REM 88888P Y88888 88888888 888 888 888 888 888 888 888 888 888888K 88888888 888
@REM 8888P Y8888 Y8b. 888 d88P 888 d88P 888 Y88..88P Y88b. 888 "88b Y8b. 888
@REM 888P Y888 "Y8888 88888P" 8888888P" 888 "Y88P" "Y8888P 888 888 "Y8888 888
echo .
setlocal EnableDelayedExpansions
@REM List of websites to block
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
@REM Set the path to the hosts file
set "host=%windir%\System32\drivers\etc\hosts"
set "comment=#WebBlockerProxies"
cls
:MENU
color 4F
@REM Developer information
echo Developer : %developer%
echo Version : %version%
echo Created Date : %created-date%
echo Project : %project%
echo Purpose : %description%
echo.
echo ====================================
echo %projectU% - %developer%
echo ====================================
echo.ß
echo 1. Block Websites from the List
echo 2. Unblock Websites from the List
echo 3. Block Custom Websites (e.g. example.com)
echo 4. Unblock Custom Websites (e.g. example.com)
echo 5. Backup Host File (Default)
echo 6. Restore Host File (Default)
echo 7. Check Host File
echo 8. Flush DNS Cache
echo 9. Exit
echo 10. Whatsapp Unblock (Experimental)
echo.
set /p option="Enter your selection: "
if "%option%"=="1" goto BLOCK
if "%option%"=="2" goto UNBLOCK
if "%option%"=="3" goto ADD_CUSTOM
if "%option%"=="4" goto UNBLOCK_CUSTOM
if "%option%"=="5" goto BACKUP_HOST
if "%option%"=="6" goto RESTORE_HOST
if "%option%"=="7" goto VIEW_HOST
if "%option%"=="8" goto FLUSHDNS
if "%option%"=="9" goto DONE
if "%option%"=="10" goto WHATSAPP_UNBLOCK
echo Invalid option.
timeout 1
goto MENU
:BLOCK
color 4F
@REM Check if the block list already exists
findstr /i /c:"%comment%" "%host%" >nul
if %errorlevel%==1 (
REM Add the comment to the host file
echo.%comment%>>"%host%"
echo.
)
@REM Block the websites by redirecting them to localhost
for %%i in (%BLOCKED_WEBSITES%) do (
findstr /i /c:"%%i" "%host%" >nul
if %errorlevel%==1 (
echo 127.0.0.1 %%i>>"%host%"
echo Blocked: %%i
)
)
echo Websites blocked successfully.
echo.
timeout 5
goto MENU
:UNBLOCK
color 2F
REM Remove the block list if it exists
findstr /i /c:"%comment%" "%host%" >nul
if %errorlevel%==0 (
REM Remove all lines that match the comment header
findstr /i /v /c:"%comment%" "%host%" >"%host%.tmp"
REM Remove the remaining lines that contain blocked websites
for %%i in (%BLOCKED_WEBSITES%) do (
findstr /i /v /c:"%%i" "%host%.tmp" >"%host%.tmp2"
move /y "%host%.tmp2" "%host%.tmp" >nul
)
REM Replace the original file with the modified file
move /y "%host%.tmp" "%host%" >nul
)
echo Websites unblocked successfully.
timeout 5
goto MENU
:ADD_CUSTOM
color 4F
set /p custom="Enter the website to block: "
set BLOCKED_WEBSITES=!BLOCKED_WEBSITES! !custom!
echo 127.0.0.1 %custom%>>"%host%"
echo Blocked: %custom%
set /p more="Do you want to add more websites? (Y/N) "
if /i "%more%"=="Y" goto ADD_CUSTOM
echo Websites added successfully.
timeout 5
goto MENU
:UNBLOCK_CUSTOM
color 2F
set /p website_to_unblock="Enter the website to unblock (e.g. example.com): "
REM Remove the website from the host file
findstr /i /c:"%website_to_unblock%" "%host%" >nul
if %errorlevel%==0 (
findstr /i /v /c:"%website_to_unblock%" "%host%" >"%host%.tmp"
move /y "%host%.tmp" "%host%" >nul
echo Website %website_to_unblock% unblocked successfully.
) else (
echo Website %website_to_unblock% is not blocked.
)
set /p unblock_more="Do you want to unblock more websites? (Y/N): "
if /i "%unblock_more%"=="Y" (
goto UNBLOCK_CUSTOM
) else (
timeout 5
goto MENU
)
:BACKUP_HOST
color 5F
set /p backup="Do you want to backup your current hosts file? (Y/N) "
if /i "%backup%"=="Y" (
xcopy /y "%host%" "%host%.bak"
echo Backup successful. Hosts file saved as %host%.bak.
) else (
echo Backup skipped.
timeout 5
)
goto MENU
:RESTORE_HOST
color 5F
set /p restore="Do you want to restore your previous hosts file? (Y/N) "
if /i "%restore%"=="Y" (
if exist "%host%.bak" (
@@ -188,56 +224,95 @@ if /i "%restore%"=="Y" (
) else (
echo Restore skipped.
)
timeout 5
goto MENU
:VIEW_HOST
color 4F
echo.
echo Viewing Host File...
echo.
notepad "%host%"
echo.
echo Host File Viewed Successfully.
timeout 5
goto MENU
:FLUSHDNS
color 4F
echo.
echo Flushing DNS cache...
ipconfig /flushdns >nul
echo DNS cache flushed successfully.
timeout 5
goto MENU
goto MENU
:WHATSAPP_UNBLOCK
color 2F
@REM Unblock whatsapp from the list
findstr /i /c:"%comment%" "%host%" >nul 2>&1
if %errorlevel%==0 (
REM Remove all lines that match the comment header
findstr /i /v /c:"%comment%" "%host%" >"%host%.tmp"
REM Remove the remaining lines that contain blocked websites
for %%i in (web.whatsapp.com www.web.whatsapp.com) do (
findstr /i /v /c:"%%i" "%host%.tmp" >"%host%.tmp2"
move /y "%host%.tmp2" "%host%.tmp" >nul
)
REM Replace the original file with the modified file
move /y "%host%.tmp" "%host%" >nul
)
echo Websites unblocked successfully. (Experimental)
timeout 5
goto MENU
:DONE
cls
color 5F
echo.
echo =======================================ß
echo THANK YOU FOR USING %projectU%
echo =======================================
echo.
echo - DEVELOPER : %developer%
echo - EMAIL : %email%
echo - WEBSITE : %author-website%
echo - VERSION : %version%
echo - CREATED DATE : %created-date%
echo.
echo - Opensource Software License agreement for windows distribution system (https://www.gnu.org/licenses/gpl-3.0.en.html)
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.
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.
echo - Copyright %copy-right%