mozilla:abpxfiles:vbs:hwsmaker
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
mozilla:abpxfiles:vbs:hwsmaker [2013/08/08 14:39] – [Sourcecode] gfsadministrator | mozilla:abpxfiles:vbs:hwsmaker [2013/11/09 19:40] – gfsadministrator | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{ : | {{ : | ||
- | Work in progress | + | >Righe di debug sparse un po' ovunque, sicuramente una marea di errori dovuti alla mia inesperienza e auto-formazione sulla programmazione |
+ | |||
+ | Vedi l' | ||
+ | Se stai cercando "suo fratello" | ||
===== Sourcecode ===== | ===== Sourcecode ===== | ||
In versione 0.1 già perfettamente funzionante, | In versione 0.1 già perfettamente funzionante, | ||
+ | |||
+ | Facendo clic sul nome dello script " | ||
+ | |||
+ | <file vb HWS-Maker_0.2.vbs> | ||
+ | ' ABP X FILES HWS Maker 0.2 | ||
+ | ' 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.2- modificato l'URL di riferimento della distribuzione lista, si comincia a lavorare su noads.it | ||
+ | ' 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 & " | ||
+ | ' 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 ) | ||
+ | | ||
+ | Next | ||
+ | |||
+ | ' | ||
+ | | ||
+ | |||
+ | ' Remove line 1 to 6, header of MalwareDomainList.com Hosts List | ||
+ | For i = 1 To 6 | ||
+ | DeleteLine strFile, "", | ||
+ | Next | ||
+ | |||
+ | ' 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 | ||
+ | Else | ||
+ | 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> | <file vb HWS-Maker_0.1.vbs> |
mozilla/abpxfiles/vbs/hwsmaker.txt · Last modified: 2017/01/30 10:36 by gfsadministrator