Skip to content

Instantly share code, notes, and snippets.

@lantip
Created January 30, 2020 15:50
Show Gist options
  • Save lantip/1f1411859f386554f704f88735f6f2b5 to your computer and use it in GitHub Desktop.
Save lantip/1f1411859f386554f704f88735f6f2b5 to your computer and use it in GitHub Desktop.
silakan kopi paste script ini ke notepad, simpan sebagai UpdateHost.bat, tutup notepad, ke explorer, double klik filenya
@echo off
TITLE Mengubah HOSTS file karena indihomesux
COLOR F0
ECHO.
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"="
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------
:LOOP
SET Choice=
SET /P Choice="Setuju indihomesux? (Y/N)"
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
ECHO.
IF /I '%Choice%'=='Y' GOTO ACCEPTED
IF /I '%Choice%'=='N' GOTO REJECTED
ECHO Ketik Y (for Yes) atau N (for No) untuk melanjutkan!
ECHO.
GOTO Loop
:REJECTED
ECHO Tidak ada yang berubah>>%systemroot%\Temp\hostFileUpdate.log
ECHO Finished.
GOTO END
:ACCEPTED
setlocal enabledelayedexpansion
::list of host domains
set LIST=(x-tags.net a01.uadexchange.com cdn.uzone.id cdn3.uzone.id cfs.uzone.id csf.uzone.id d01.notifa.info d31qbv1cthcecs.cloudfront.net d5nxst8fruw4z.cloudfront.net expose.uzone.id kendedes.uzone.id mercusuar.uzone.id p01.notifa.info p02.notifa.info p04.notifa.info p03.notifa.info p05.notifa.info usearch.co.id welcome.indihome.co.id upoint.id uzone.id)
::Set the ip of the domains
set x-tags.net=127.0.0.1
set a01.uadexchange.com=127.0.0.1
set cdn.uzone.id=127.0.0.1
set cdn3.uzone.id=127.0.0.1
set cfs.uzone.id=127.0.0.1
set csf.uzone.id=127.0.0.1
set d01.notifa.info=127.0.0.1
set d31qbv1cthcecs.cloudfront.net=127.0.0.1
set d5nxst8fruw4z.cloudfront.net=127.0.0.1
set expose.uzone.id=127.0.0.1
set kendedes.uzone.id=127.0.0.1
set mercusuar.uzone.id=127.0.0.1
set p01.notifa.info=127.0.0.1
set p02.notifa.info=127.0.0.1
set p04.notifa.info=127.0.0.1
set p03.notifa.info=127.0.0.1
set p05.notifa.info=127.0.0.1
set usearch.co.id=127.0.0.1
set welcome.indihome.co.id=127.0.0.1
set upoint.id=127.0.0.1
set uzone.id=127.0.0.1
:: deletes the parentheses from LIST
set _list=%LIST:~1,-1%
::ECHO %WINDIR%\System32\drivers\etc\hosts > tmp.txt
for %%G in (%_list%) do (
set _name=%%G
set _value=!%%G!
SET NEWLINE=^& echo.
ECHO Carrying out requested modifications to your HOSTS file
::strip out this specific line and store in tmp file
type %WINDIR%\System32\drivers\etc\hosts | findstr /v !_name! > tmp.txt
::re-add the line to it
ECHO %NEWLINE%^!_value! !_name!>>tmp.txt
::overwrite host file
copy /b/v/y tmp.txt %WINDIR%\System32\drivers\etc\hosts
del tmp.txt
)
ipconfig /flushdns
ECHO.
ECHO.
ECHO Finished, you may close this window now.
ECHO You should now open Chrome and go to "chrome://net-internals/#dns" (without quotes)
ECHO then click the "clear host cache" button
GOTO END
:END
ECHO.
EXIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment