mozilla:abpxfiles:vbs:hwsmaker
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
mozilla:abpxfiles:vbs:hwsmaker [2013/11/09 19:40] – gfsadministrator | mozilla:abpxfiles:vbs:hwsmaker [2017/01/30 10:36] (current) – gfsadministrator | ||
---|---|---|---|
Line 11: | Line 11: | ||
Facendo clic sul nome dello script " | Facendo clic sul nome dello script " | ||
- | <file vb HWS-Maker_0.2.vbs> | + | Ho spostato lo script |
- | ' ABP X FILES HWS Maker 0.2 | + | |
- | ' GSolone - Ultima modifica: 20130808 rev3 | + | |
- | ' | + | |
- | ' Lo script | + | |
- | ' | + | |
- | ' STORICO MODIFICHE | + | |
- | ' 0.2- modificato l' | + | |
- | ' 0.1 rev3- corretto il problema dell' | + | |
- | ' | + | |
- | ' Sviluppo: Giovanni F. -Gioxx- Solone (dev@gfsolone.com) | + | |
- | ' Testato su: Windows 7 Pro Sp1 | + | |
- | ' | + | |
- | ' LISTA HOST UTILIZZATA | + | |
- | HTTPDownload "http://www.malwaredomainlist.com/ | + | |
- | + | ||
- | ' Non toccare nulla oltre questa riga! | + | |
- | ' DO NOT touch anything below this line! | + | |
- | + | ||
- | Sub HTTPDownload(myURL) | + | |
- | ' Variables and constants definition | + | |
- | Dim i, objFile, objFSO, objHTTP, strFile, strMsg | + | |
- | Dim objWMIService, | + | |
- | Const ForReading = 1, ForWriting = 2, ForAppending = 8 | + | |
- | + | ||
- | ' Date and time | + | |
- | strComputer = " | + | |
- | Set objWMIService = GetObject(" | + | |
- | Set colItems = objWMIService.ExecQuery(" | + | |
- | For Each objItem in colItems | + | |
- | dtmLocalTime = objItem.LocalDateTime | + | |
- | dtmMonth = Mid(dtmLocalTime, | + | |
- | dtmDay = Mid(dtmLocalTime, | + | |
- | dtmYear = Left(dtmLocalTime, | + | |
- | dtmHour = Mid(dtmLocalTime, | + | |
- | dtmMinutes = Mid(dtmLocalTime, | + | |
- | dtmSeconds = Mid(dtmLocalTime, | + | |
- | Next | + | |
- | update = dtmYear & dtmMonth & dtmDay & dtmHour & dtmMinutes | + | |
- | lastmodified = dtmDay & " | + | |
- | ' debug Wscript.Echo update | + | |
- | + | ||
- | ' | + | |
- | Set objFSO = CreateObject( " | + | |
- | + | ||
- | ' | + | |
- | Set objShell = CreateObject(" | + | |
- | Set objProcess = objShell.Environment(" | + | |
- | Set WshShell = WScript.CreateObject(" | + | |
- | strApplicationData = WshShell.ExpandEnvironmentStrings(" | + | |
- | ' | + | |
- | strFile = " | + | |
- | + | ||
- | ' | + | |
- | Set objHTTP = CreateObject( " | + | |
- | + | ||
- | ' | + | |
- | | + | |
- | | + | |
- | + | ||
- | if LenB( objHTTP.ResponseBody ) < 500 Then | + | |
- | MsgBox " | + | |
- | Exit Sub | + | |
- | End If | + | |
- | + | ||
- | ' Create or open the target file | + | |
- | Set objFile = objFSO.OpenTextFile( strFile, ForWriting, True ) | + | |
- | + | ||
- | ' | + | |
- | For i = 1 To LenB( objHTTP.ResponseBody ) | + | |
- | | + | |
- | | + | |
- | + | ||
- | ' | + | |
- | | + | |
- | + | ||
- | ' Remove line 1 to 6, header of MalwareDomainList.com Hosts List | + | |
- | For i = 1 To 6 | + | |
- | DeleteLine strFile, "", | + | |
- | | + | |
- | + | ||
- | ' Find and remove 127.0.0.1 from each line | + | |
- | Set objFSO = CreateObject(" | + | |
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | strText = objFile.ReadAll | + | |
- | objFile.Close | + | |
- | strNewText = Replace(strText, | + | |
- | + | ||
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | objFile.WriteLine strNewText | + | |
- | objFile.Close | + | |
- | + | ||
- | ' Remove empty lines at the end of file! | + | |
- | Set objFSO = CreateObject(" | + | |
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | Do Until objFile.AtEndOfStream | + | |
- | strLine = objFile.Readline | + | |
- | strLine = Trim(strLine) | + | |
- | If Len(strLine) > 0 Then | + | |
- | strNewContents = strNewContents & strLine & vbCrLf | + | |
- | End If | + | |
- | Loop | + | |
- | objFile.Close | + | |
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | objFile.Write strNewContents | + | |
- | objFile.Close | + | |
- | + | ||
- | ' Append "## | + | |
- | Set objFSO = CreateObject(" | + | |
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | Set tmpFile= objFSO.OpenTextFile(strFile & " | + | |
- | Do While Not objFile.AtEndofStream | + | |
- | url = objFile.ReadLine | + | |
- | url = url & "## | + | |
- | tmpFile.WriteLine url | + | |
- | Loop | + | |
- | objFile.Close | + | |
- | tmpFile.Close | + | |
- | objFSO.DeleteFile(strFile) | + | |
- | objFSO.MoveFile strFile&" | + | |
- | + | ||
- | ' Add list header (ABP X Files HWS) | + | |
- | Set objFSO = CreateObject(" | + | |
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | strContents = objFile.ReadAll | + | |
- | objFile.Close | + | |
- | + | ||
- | strFirstLine = " | + | |
- | strNewContents = strFirstLine & vbCrLf & strContents | + | |
- | + | ||
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | objFile.WriteLine strNewContents | + | |
- | objFile.Close | + | |
- | + | ||
- | ' Open the file (verification process) | + | |
- | CreateObject(" | + | |
- | + | ||
- | End Sub | + | |
- | + | ||
- | Sub Run(ByVal sFile) | + | |
- | ' Variables definition | + | |
- | Dim shell | + | |
- | + | ||
- | Set shell = CreateObject( " | + | |
- | shell.Run Chr(34) & sFile & Chr(34), 1, false | + | |
- | Set shell = Nothing | + | |
- | End Sub | + | |
- | + | ||
- | Sub DeleteLine(strFile, | + | |
- | 'Use strFile = " | + | |
- | 'Use strKey = "John Doe" | + | |
- | 'Use strKey = "" | + | |
- | 'Use LineNumber = " | + | |
- | 'Use LineNumber = " | + | |
- | 'Use CheckCase = " | + | |
- | 'Use CheckCase = " | + | |
- | Const ForReading=1: | + | |
- | Dim objFSO, | + | |
- | Set objFSO=CreateObject(" | + | |
- | Set objFile=objFSO.OpenTextFile(strFile, | + | |
- | Do Until objFile.AtEndOfStream | + | |
- | | + | |
- | If CheckCase=0 then strLineCase=ucase(strLine): | + | |
- | If LineNumber=objFile.Line-1 or LineNumber=0 then | + | |
- | If instr(strLine, | + | |
- | | + | |
- | Else | + | |
- | | + | |
- | End If | + | |
- | | + | |
- | strNewFile=strNewFile& | + | |
- | End If | + | |
- | Loop | + | |
- | objFile.Close | + | |
- | Set objFSO=CreateObject(" | + | |
- | Set objFile=objFSO.OpenTextFile(strFile, | + | |
- | objFile.Write strNewFile | + | |
- | objFile.Close | + | |
- | End Sub | + | |
- | </ | + | |
- | + | ||
- | ===== Archivio versioni ===== | + | |
- | + | ||
- | Qui di seguito la versione 0.1 | + | |
- | + | ||
- | <file vb HWS-Maker_0.1.vbs> | + | |
- | ' ABP X FILES HWS Maker 0.1 | + | |
- | ' GSolone - Ultima modifica: 20130808 rev3 | + | |
- | ' | + | |
- | ' Lo script scarica la lista filtri più aggiornata disponibile su MalwareDomainList.com e la modifica per renderla integrabile all' | + | |
- | ' | + | |
- | ' STORICO MODIFICHE | + | |
- | ' 0.1 rev3- corretto il problema dell' | + | |
- | ' | + | |
- | ' Sviluppo: Giovanni F. -Gioxx- Solone (dev@gfsolone.com) | + | |
- | ' Testato su: Windows 7 Pro Sp1 | + | |
- | ' | + | |
- | ' LISTA HOST UTILIZZATA | + | |
- | HTTPDownload " | + | |
- | + | ||
- | ' Non toccare nulla oltre questa riga! | + | |
- | ' DO NOT touch anything below this line! | + | |
- | + | ||
- | Sub HTTPDownload(myURL) | + | |
- | ' Variables and constants definition | + | |
- | Dim i, objFile, objFSO, objHTTP, strFile, strMsg | + | |
- | Dim objWMIService, | + | |
- | Const ForReading = 1, ForWriting = 2, ForAppending = 8 | + | |
- | + | ||
- | ' Date and time | + | |
- | strComputer = " | + | |
- | Set objWMIService = GetObject(" | + | |
- | Set colItems = objWMIService.ExecQuery(" | + | |
- | For Each objItem in colItems | + | |
- | dtmLocalTime = objItem.LocalDateTime | + | |
- | dtmMonth = Mid(dtmLocalTime, | + | |
- | dtmDay = Mid(dtmLocalTime, | + | |
- | dtmYear = Left(dtmLocalTime, | + | |
- | dtmHour = Mid(dtmLocalTime, | + | |
- | dtmMinutes = Mid(dtmLocalTime, | + | |
- | dtmSeconds = Mid(dtmLocalTime, | + | |
- | Next | + | |
- | update = dtmYear & dtmMonth & dtmDay & dtmHour & dtmMinutes | + | |
- | lastmodified = dtmDay & "-" & dtmMonth & " | + | |
- | ' debug Wscript.Echo update | + | |
- | + | ||
- | ' | + | |
- | Set objFSO = CreateObject( " | + | |
- | + | ||
- | ' | + | |
- | Set objShell = CreateObject(" | + | |
- | Set objProcess = objShell.Environment(" | + | |
- | Set WshShell = WScript.CreateObject(" | + | |
- | strApplicationData = WshShell.ExpandEnvironmentStrings(" | + | |
- | ' | + | |
- | strFile = " | + | |
- | + | ||
- | ' | + | |
- | Set objHTTP = CreateObject( " | + | |
- | + | ||
- | ' | + | |
- | | + | |
- | | + | |
- | + | ||
- | if LenB( objHTTP.ResponseBody ) < 500 Then | + | |
- | MsgBox " | + | |
- | Exit Sub | + | |
- | End If | + | |
- | + | ||
- | ' Create or open the target file | + | |
- | Set objFile = objFSO.OpenTextFile( strFile, ForWriting, True ) | + | |
- | + | ||
- | ' | + | |
- | For i = 1 To LenB( objHTTP.ResponseBody ) | + | |
- | | + | |
- | | + | |
- | + | ||
- | ' | + | |
- | | + | |
- | + | ||
- | ' Remove line 1 to 6, header of MalwareDomainList.com Hosts List | + | |
- | For i = 1 To 6 | + | |
- | DeleteLine strFile, "", | + | |
- | | + | |
- | + | ||
- | ' Find and remove 127.0.0.1 from each line | + | |
- | Set objFSO = CreateObject(" | + | |
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | strText = objFile.ReadAll | + | |
- | objFile.Close | + | |
- | strNewText = Replace(strText, | + | |
- | + | ||
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | objFile.WriteLine strNewText | + | |
- | objFile.Close | + | |
- | + | ||
- | ' Remove empty lines at the end of file! | + | |
- | Set objFSO = CreateObject(" | + | |
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | Do Until objFile.AtEndOfStream | + | |
- | strLine = objFile.Readline | + | |
- | strLine = Trim(strLine) | + | |
- | If Len(strLine) > 0 Then | + | |
- | strNewContents = strNewContents & strLine & vbCrLf | + | |
- | End If | + | |
- | Loop | + | |
- | objFile.Close | + | |
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | objFile.Write strNewContents | + | |
- | objFile.Close | + | |
- | + | ||
- | ' Append "## | + | |
- | Set objFSO = CreateObject(" | + | |
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | Set tmpFile= objFSO.OpenTextFile(strFile & " | + | |
- | Do While Not objFile.AtEndofStream | + | |
- | url = objFile.ReadLine | + | |
- | url = url & "## | + | |
- | tmpFile.WriteLine url | + | |
- | Loop | + | |
- | objFile.Close | + | |
- | tmpFile.Close | + | |
- | objFSO.DeleteFile(strFile) | + | |
- | objFSO.MoveFile strFile&" | + | |
- | + | ||
- | ' Add list header (ABP X Files HWS) | + | |
- | Set objFSO = CreateObject(" | + | |
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | strContents = objFile.ReadAll | + | |
- | objFile.Close | + | |
- | + | ||
- | strFirstLine = " | + | |
- | strNewContents = strFirstLine & vbCrLf & strContents | + | |
- | + | ||
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | objFile.WriteLine strNewContents | + | |
- | objFile.Close | + | |
- | + | ||
- | ' Open the file (verification process) | + | |
- | CreateObject(" | + | |
- | + | ||
- | End Sub | + | |
- | + | ||
- | Sub Run(ByVal sFile) | + | |
- | ' Variables definition | + | |
- | Dim shell | + | |
- | + | ||
- | Set shell = CreateObject( " | + | |
- | shell.Run Chr(34) & sFile & Chr(34), 1, false | + | |
- | Set shell = Nothing | + | |
- | End Sub | + | |
- | + | ||
- | Sub DeleteLine(strFile, | + | |
- | 'Use strFile = " | + | |
- | 'Use strKey = "John Doe" | + | |
- | 'Use strKey = "" | + | |
- | 'Use LineNumber = " | + | |
- | 'Use LineNumber = " | + | |
- | 'Use CheckCase = " | + | |
- | 'Use CheckCase = " | + | |
- | Const ForReading=1: | + | |
- | Dim objFSO, | + | |
- | Set objFSO=CreateObject(" | + | |
- | Set objFile=objFSO.OpenTextFile(strFile, | + | |
- | Do Until objFile.AtEndOfStream | + | |
- | | + | |
- | If CheckCase=0 then strLineCase=ucase(strLine): | + | |
- | If LineNumber=objFile.Line-1 or LineNumber=0 then | + | |
- | If instr(strLine, | + | |
- | | + | |
- | Else | + | |
- | | + | |
- | End If | + | |
- | | + | |
- | strNewFile=strNewFile& | + | |
- | End If | + | |
- | Loop | + | |
- | objFile.Close | + | |
- | Set objFSO=CreateObject(" | + | |
- | Set objFile=objFSO.OpenTextFile(strFile, | + | |
- | objFile.Write strNewFile | + | |
- | objFile.Close | + | |
- | End Sub | + | |
- | </ | + |
mozilla/abpxfiles/vbs/hwsmaker.1384022459.txt.gz · Last modified: 2013/11/09 19:40 by gfsadministrator