rendered paste bodySet objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
hostsFile = objShell.ExpandEnvironmentStrings("%SystemRoot%") & "\system32\drivers\etc\hosts"
strIP = "127.0.0.1"
strValue = "ebay.co.uk"
strValue1 = "ebay.com"
strValue2 = "www.ebay.co.uk"
strValue3 = "www.ebay.com"
strValue4 = "bebo.com"
strValue5 = "bebo.co.uk"
strValue6 = "www.bebo.com"
strValue7 = "www.bebo.co.uk"
strValue8 = "myspace.com"
strValue9 = "myspace.co.uk"
strValue10 = "www.myspace.com"
strValue11 = "www.myspace.co.uk"
strValue12 = "facebook.com"
strValue13 = "facebook.co.uk"
strValue14 = "www.facebook.com"
strValue15 = "www.facebook.co.uk"
If objFSO.FileExists(hostsFile) Then
Set objTextFile = objFSO.OpenTextFile(hostsFile, ForReading)
Else
Set myFile = objFSO.CreateTextFile(hostsFile, True)
myFile.WriteLine "127.0.0.1 localhost"
myFile.WriteLine strIP & " " & strValue
myFile.WriteLine strIP & " " & strValue1
myFile.WriteLine strIP & " " & strValue2
myFile.WriteLine strIP & " " & strValue3
myFile.WriteLine strIP & " " & strValue4
myFile.WriteLine strIP & " " & strValue5
myFile.WriteLine strIP & " " & strValue6
myFile.WriteLine strIP & " " & strValue7
myFile.WriteLine strIP & " " & strValue8
myFile.WriteLine strIP & " " & strValue9
myFile.WriteLine strIP & " " & strValue10
myFile.WriteLine strIP & " " & strValue11
myFile.WriteLine strIP & " " & strValue12
myFile.WriteLine strIP & " " & strValue13
myFile.WriteLine strIP & " " & strValue14
Wscript.Quit
End If
strFlag = 0
Do Until objTextFile.AtEndOfStream
strLine = Trim(objTextFile.ReadLine)
If InStr(strLine, strIP) > 0 Then
If InStr(strLine, strValue) > 0 Then
strFlag = "1"
End If
End If
Loop
objTextFile.Close
If strFlag = 0 Then
Set objTextFile = objFSO.OpenTextFile(hostsFile, ForAppending)
objTextFile.WriteLine vbCrLf & strIP & " " & strValue
objTextFile.WriteLine vbCrLf & strIP & " " & strValue1
objTextFile.WriteLine vbCrLf & strIP & " " & strValue2
objTextFile.WriteLine vbCrLf & strIP & " " & strValue3
objTextFile.WriteLine vbCrLf & strIP & " " & strValue4
objTextFile.WriteLine vbCrLf & strIP & " " & strValue5
objTextFile.WriteLine vbCrLf & strIP & " " & strValue6
objTextFile.WriteLine vbCrLf & strIP & " " & strValue7
objTextFile.WriteLine vbCrLf & strIP & " " & strValue8
objTextFile.WriteLine vbCrLf & strIP & " " & strValue9
objTextFile.WriteLine vbCrLf & strIP & " " & strValue10
objTextFile.WriteLine vbCrLf & strIP & " " & strValue11
objTextFile.WriteLine vbCrLf & strIP & " " & strValue12
objTextFile.WriteLine vbCrLf & strIP & " " & strValue13
objTextFile.WriteLine vbCrLf & strIP & " " & strValue14
End If