|
Here it is: Change the extension for the txt files to the
notorious .vbs Check the the home directories for your imail
domains is the same in the scripts Mailfilter does the rules.ima files –Mailfilter1
does the forwards for the user mailboxes Copy rules.ima (Remove the H’s in this file) and
virus.fwd to the d root -drive or edit the script Patrick Moss Cyberlink Inc. -----Original Message----- From: Bobby Cannon
[mailto:[EMAIL PROTECTED]] Sent: Friday, May 19, 2000 5:01 PM To: 'Patrick Moss - CyberLink Technical Support
Group' Subject: RE: [IMail Forum] Attachment rules >I sent a reply to the list earlier with some
attached scripts - you have to >put the rules.ima in every domain it is a pain
to do manually - we have over >600 domains so I made some scripts to do it for
me - The other script adds a >forward to each mail box for each domain to send
all of the virus mailbox >forwards to one central mailbox could somebody re-post them? I must have missed those, and I have to say, they'd be awfully
nice to have. Sincerely, Bobby Cannon |
Option Explicit
' TO USE EDIT THE RULES.IMA file in the CyberLink.com DIRECTORY
Dim strFile, strCommand,FileToCheck,directory
Const ForReading = 1, ForWriting = 2, ForAppending = 8
strFile = "d:\rules.ima"
FileToCheck = "rules.ima"
Directory = "d:\imail\domains"
strCommand = InputBox("Please Enter the Imail string Needed" & vbCrLf &
"I.E.(B~filtered content in body:VIRUS)" & vbCrLf & "Set to VIRUS and nothing will
have to be set" & vbCrLf & "Refer to d:\imail\MailFilter Scripts\Instructions.txt")
strCommand = UCase(strCommand)
If InStr(strCommand,"~") = 0 Then
DisplayMessage(1)
ElseIf InStr(strCommand,":") = 0 Then
DisplayMessage(1)
ElseIf InStr(strCommand," ") > 0 Then
DisplayMessage(1)
Else
Select Case Left(strCommand,1)
Case "B"
folderlist(Directory)
DisplayMessage(2)
Case "S"
folderlist(Directory)
DisplayMessage(2)
Case "H"
folderlist(Directory)
DisplayMessage(2)
Case "F"
folderlist(Directory)
DisplayMessage(2)
Case "T"
folderlist(Directory)
DisplayMessage(2)
Case "N"
folderlist(Directory)
DisplayMessage(2)
Case Else
DisplayMessage(1)
End Select
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub DisplayMessage(bolvalue)
If bolvalue = 1 Then
Msgbox("Read the Textfile Please - You could mess up this server")
Wscript.Quit
ElseIf bolvalue = 2 Then
MsgBox("Please Run the Mailbox Filter tool Now If you want to Block users from
accessing the MailBox")
Wscript.Quit
End If
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function fileexist(filespec)
On Error Resume Next
dim msg,fso
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
if (fso.FileExists(filespec)) Then
msg = 1
else
msg = 0
end if
fileexist = msg
Set FSO = NOTHING
end Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub folderlist(folderspec)
On Error Resume Next
dim f,f1,sf,fso
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
set f = fso.GetFolder(folderspec)
set sf = f.SubFolders
for each f1 in sf
filemanip(f1.path)
Next
Set FSO = Nothing
end Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub filemanip(fldr)
Dim filelocate
filelocate = fldr & "\" & filetocheck
If (fileexist(filelocate)=1) Then
AppendFile(filelocate)
Else
CreateFile(filelocate)
End If
end Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub AppendFile(file)
Dim TextFile, Textstream,strText,bolSkipText,fso,i,arrCommand
'On Error Resume Next
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
Set TextFile = fso.GetFile(file)
Set TextStream = TextFile.OpenAsTextStream(ForReading, -2)
bolSkipText = "0"
Do
strText = strText & TextStream.ReadLine & vbCrLf
Loop While Not TextStream.AtEndOfStream
arrCommand = Split(strText, vbCrLf, -1, 1)
For each i in arrCommand
If StrComp(strCommand,i,1) = 0 Then
bolSkipText = bolSkipText + 1
Else
bolSkipText = bolSkipText + 0
End If
Next
Select Case (bolSkipText)
Case "0"
'wscript.echo "File will be Appended"
Set TextStream = TextFile.OpenAsTextStream(ForAppending, -2)
TextStream.WriteLine (strCommand)
Case Else
'wscript.echo "File will not be Appended"
End Select
Set TextFile = Nothing
Set TextStream = Nothing
bolSkipText = 0
Set FSO = NOTHING
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub CreateFile(file)
Dim TextFile, fso
'On Error Resume Next
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
Set TextFile = fso.GetFile(strFile)
textFile.Copy file
'Wscript.Echo file & " file copied"
Set textfile = Nothing
Set FSO = Nothing
End Sub
'''''''''''''''''''''''''''''''''''''''
' TO USE EDIT THE RULES.IMA file in the D ROOT DIRECTORY
Dim fso, strFile, strCommand,FileToCheck,directory, rc
Const ForReading = 1, ForWriting = 2, ForAppending = 8
' End User config
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
strFile = "d:\virus.fwd"
FileToCheck = "\virus.fwd"
RootDirectory = "d:\imail\domains"
folderlist(RootDirectory)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function fileexist(filespec)
On Error Resume Next
dim msg
if (fso.FileExists(filespec)) Then
msg = 1
else
msg = 0
end if
fileexist = msg
end Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub folderlist(folderspec)
On Error Resume Next
dim f,f1,sf
set f = fso.GetFolder(folderspec)
set sf = f.SubFolders
For Each f1 in sf
findusersfldr(f1)
Next
end Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub findusersfldr(folderspec)
Dim f3,f2,sf1
set f2 = fso.GetFolder(folderspec)
set sf1 = f2.SubFolders
For Each f3 in sf1
If LCase(f3.name) ="users" Then
filemanip(f3.path)
End If
Next
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Popup sf1.name & "all done",2
Set WshShell = nothing
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub filemanip(fldr)
Dim filelocate,f4,f5,sf2
'wscript.echo filelocate
set f4 = fso.GetFolder(fldr)
set sf2 = f4.SubFolders
For Each f5 in sf2
If fileexist(f5.path & filetocheck) = 0 Then
CreateFile(f5.path & filetocheck)
Else
End If
Next
end Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub CreateFile(file)
Dim TextFile
On Error Resume Next
Set TextFile = fso.GetFile(strFile)
textFile.Copy file
Set textfile = Nothing
Set FSO = Nothing
End Sub
virus.fwd