[GET] A Batch Script To Edit Your HOSTS File.

Discussion in 'BlackHat Lounge' started by youngguy, Nov 30, 2009.

  1. youngguy

    youngguy BANNED BANNED

    Apr 11, 2009
    Likes Received:
    I see many Softwares' crack request you to edit your HOSTS file and I know many of you guys don't know where it is and don't know how to open it right?

    I wrote a small ".bat" script to:
    1. Take Ownership of the HOSTS file (if you're on Vista & Win7)
    2. Remove attribute: system, hidden, read only of the HOSTS file
    3. Open HOSTS file with notepad ready for you to edit.

    It's a solid ".bat" script with just 4 lines of code, so it's not nessesary to provide virustotal link.

    For who knows how to make a .bat file, this is the code:
    @echo off
    takeown /f "%windir%\system32\drivers\etc\hosts" && icacls "%windir%\system32\drivers\etc\hosts" /grant administrators:F
    attrib -s -h -r %windir%\system32\drivers\etc\hosts
    %windir%\notepad.exe %windir%\system32\drivers\etc\hosts
    1. If you're using Vista / Win7, just Right Click & Run as administrator
    2. XP: Run it normally :)

    Have Fun my BH family!
    • Thanks Thanks x 5
    Last edited: Nov 30, 2009
  2. Beager

    Beager Newbie

    Apr 1, 2009
    Likes Received:
    This is a good idea, I never thought of making a .Bat file for this
    I use Host Manager right now, or HiJackThis, but this might be easier
  3. cosmickev

    cosmickev Newbie

    Jan 6, 2010
    Likes Received:
    hey young guy,

    thanks for the post. I cannot access the rapidshare link because its always congested. Is there another place to put the host file?

    This is what I get when I open the host file up.

    # Copyright (c) 1993-2006 Microsoft Corp.
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    # For example:
    # rhino.acme.com # source server
    # x.acme.com # x client host localhost
    ::1 localhost

    How do I modify it?
    do I just delete what is there and cut and paste this below it?
    Or do I create a new notepad file and save it as BAT

    Please help thanks man.

    Also, do I have to install MktingSamri first in order to get host to work?
    Last edited by a moderator: Jan 6, 2010