Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;
- ; Language: English
- ; Platform: Win9x/NT
- ; Author: JRWR/DontMakeMeDoIT <http://forrest.fuqua.networklabs.org>
- ;
- #NoEnv
- #SingleInstance
- #NoTrayIcon
- #UseHook Off
- If not A_IsAdmin { ; Runs script as Administrator for UAC in Windows Vista and 7+
- Run *RunAs "%A_ScriptFullPath%"
- ExitApp
- }
- SetWorkingDir %A_ScriptDir%
- ;%A_WinDir%\System32\drivers\etc\hosts
- InputBox, hostname, DNS Lookup, Do NOT enter the WWW. prefix`, just the domain name:
- AutoTrim, On
- hostname := RegExMatch(hostname, ".*(\b\w+\.\w+)", hostname)
- hostname = %hostname1%
- tf = %A_Temp%\%A_Now%
- RunWait, %ComSpec% /c "nslookup %hostname% 8.8.8.8" > %tf%, , Hide
- FileRead, ip, %tf%
- FileDelete, %tf%
- StringSplit, DNSArray, ip,%A_Space%,
- ipaddress = %DNSArray11%
- IfNotInString, ipaddress,.
- {
- Msgbox, ERROR: IP Lookup FAILED`nDebug: Returned IP String:`n%ip%
- ExitApp,
- }
- IfInString, ipaddress,8.8.8.8
- {
- Msgbox, ERROR: IP Lookup FAILED`nDebug: Returned IP String:`n%ip%
- ExitApp,
- }
- MsgBox,4, ,Does This look correct?`nShould look like:`ngoogle.com 74.125.65.147`n-----------------------`n`n%hostname% %ipaddress%
- IfMsgBox No
- {
- Msgbox, Aborted!
- ExitApp,
- }
- FileAppend,
- (
- #Added %A_MMMM% %A_DD% %A_YYYY%
- ), %A_WinDir%\System32\drivers\etc\hosts
- FileAppend,
- (
- %hostname% %ipaddress%
- ), %A_WinDir%\System32\drivers\etc\hosts
- MsgBox, 4, , Do you want to open your HOSTS file in notepad? (Press YES or NO)
- IfMsgBox No
- return
- RunWait, %A_WinDir%\Notepad.exe %A_WinDir%\System32\drivers\etc\hosts
- ExitApp,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement