1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest Last month we upgraded BlackHatWorld.com to a new platform - . If you notice anything that requires attention please start a new thread here.
    Dismiss Notice

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

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

  1. youngguy

    youngguy Senior Member

    Joined:
    Apr 11, 2009
    Messages:
    1,053
    Likes Received:
    1,559
    Location:
    Hell
    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.

    Rapidshare:
    Code:
    http://rapidshare.com/files/314421550/Open_HOSTS.bat
    
    For who knows how to make a .bat file, this is the code:
    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
    
    Instruction:
    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

    Joined:
    Apr 1, 2009
    Messages:
    36
    Likes Received:
    53
    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

    Joined:
    Jan 6, 2010
    Messages:
    2
    Likes Received:
    0
    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:
    #
    # 102.54.94.97 rhino.acme.com # source server
    # 38.25.63.10 x.acme.com # x client host

    127.0.0.1 localhost
    ::1 localhost


    How do I modify it?
    do I just delete what is there and cut and paste this below it?

    213.203.216.114
    Code:
    www.marketsamurai.com
    213.203.216.114
    Code:
    marketsamurai.com
    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