Jump to content

NEW VIDEO: I Replaced Gaming With Real Life (Nicco Transformation)

[Script] Block gaming related websites


stabi

Recommended Posts

Hi all,

had something in my mind for overcoming the addiction and wrote a little script, which is for windows only currently but can be ported to Linux aswell - If you want/need it for Linux aswell, let me know.

What this script can do?
Blocking access to gaming related websites by adding them into the hosts file.

What this script can't do (yet)?
Blocking gaming software. It is planned to block clients such as steam, uplay, battle.net, but currently it only blocks the access to websites.

How to execute?
Make a text file on your desktop (or wherever you want) and paste the content/script into it.
Change the extension from .txt to .bat
Follow this link if you dont have file extensions enabled
Right click -> Execute as admin


This script also blocks access to twitch.tv.
If you still want to access twitch.tv, remove these lines:

 

(
echo.
echo 127.0.0.1 twitch.tv
echo 127.0.0.1 www.twitch.tv
) >> "%Hosts%"


And here is the script.
 

 

REM Very basic script to block gaming related websites
REM It will backup your current hosts file
REM And add gaming related websites
REM So you can't access them anymore


NET SESSION >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
    ECHO ##################################
    ECHO Administrator PRIVILEGES Detected!
    ECHO ##################################
) ELSE (
   echo ######## ########  ########   #######  ########
   echo ##       ##     ## ##     ## ##     ## ##     ##
   echo ##       ##     ## ##     ## ##     ## ##     ##
   echo ######   ########  ########  ##     ## ########
   echo ##       ##   ##   ##   ##   ##     ## ##   ##
   echo ##       ##    ##  ##    ##  ##     ## ##    ##
   echo ######## ##     ## ##     ##  #######  ##     ##
   echo.
   echo.
   echo ####### ERROR: ADMINISTRATOR PRIVILEGES REQUIRED #########
   echo This script must be run as administrator to work properly!
   echo Right click on the file and select "Run as Administrator".
   echo ##########################################################
   echo.
   PAUSE
   EXIT /B 1
)

copy C:\Windows\System32\drivers\etc\hosts C:\Windows\System32\drivers\etc\hosts.bak

@echo off
TITLE Modifying your HOSTS file
COLOR 1F
echo.
Set "Hosts=%windir%\System32\drivers\etc\hosts"
Copy "%Hosts%" "%Hosts%.bak"
(
  echo # Steam related
  echo 127.0.0.1 steampowered.com
  echo 127.0.0.1 store.steampowered.com
  echo 127.0.0.1 steamcharts.com
  echo 127.0.0.1 steamcommunity.com
  echo 127.0.0.1 steam.tools
  echo 127.0.0.1 steam.design
  echo 127.0.0.1 steamdb.info
  echo 127.0.0.1 steamspy.com
  echo 127.0.0.1 valvesoftware.com
  echo 127.0.0.1 www.valvesoftware.com
  echo.
  echo # Battle.net / Blizzard related
  echo 127.0.0.1 blizzard.com
  echo 127.0.0.1 www.blizzard.com
  echo 127.0.0.1 battle.net
  echo 127.0.0.1 www.battle.net
  echo 127.0.0.1 worldofwarcraft.com
  echo 127.0.0.1 playhearthstone.com
  echo 127.0.0.1 starcraft.com
  echo 127.0.0.1 starcraft2.com
  echo.
  echo # League of Legends related
  echo 127.0.0.1 riotgames.com
  echo 127.0.0.1 www.riotgames.com
  echo 127.0.0.1 leagueoflegends.com
  echo 127.0.0.1 www.leagueoflegends.com
  echo 127.0.0.1 lolesports.com
  echo 127.0.0.1 www.lolesports.com
  echo 127.0.0.1 lolalytics.com
  echo 127.0.0.1 lolmath.net
  echo 127.0.0.1 lolking.net
  echo 127.0.0.1 www.lolking.net
  echo 127.0.0.1 wol.gg
  echo 127.0.0.1 lolcounter.com
  echo 127.0.0.1 www.lolcounter.com
  echo.
  echo # NCSoft related
  echo 127.0.0.1 ncsoft.com
  echo 127.0.0.1 www.ncsoft.com
  echo 127.0.0.1 bladeandsoul.com
  echo 127.0.0.1 www.bladeandsoul.com
  echo 127.0.0.1 aiononline.com
  echo 127.0.0.1 www.aiononline.com
  echo.
  echo # UPlay related
  echo 127.0.0.1 ubi.com
  echo 127.0.0.1 uplay.ubi.com
  echo 127.0.0.1 www.uplay.ubi.com
  echo 127.0.0.1 store.ubi.com
  echo 127.0.0.1 account.ubisoft.com
  echo 127.0.0.1 www.ubisoft.com
) > "%Hosts%"


REM Remove the lines below if you dont want to block twitch
(
echo.
echo 127.0.0.1 twitch.tv
echo 127.0.0.1 www.twitch.tv
) >> "%Hosts%"
REM Remove the lines above if you dont want to block twitch

REM Restarting network adapters
ipconfig /release
ipconfig /flushdns
ipconfig /renew

 



Let me know if you think such scripts are useful so I can work on it and improve it and also let me know if you need such script for Linux.

  • Like 3
Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...