Sign in to follow this  
Followers 0
Klaatu

Spybot for Dummies

12 posts in this topic

I came up with this when the President of the company asked for an easy way to help get rid of spyware from his home PC.

It will install (silently) and run (silently) Spybot S&D if not already installed, or just run it (silently) if its already installed.

All that's needed is to download Spybot's install file to where the script is and compile it. Then give the resulting .exe to the boss.

Global Const $ProgramName = 'Spybot - Search & Destroy' 
Global $Program = @ProgramFilesDir & '\' & $ProgramName & '\' & 'SpybotSD.exe' 
Main()
Exit

Func Main()
    If Not @Compiled Then
        Opt ("TrayIconDebug", 1)
    EndIf
    If Not FileExists($Program) Then
        InstallSpybot()
    EndIf
    RunSpybot()
EndFunc  ;==>Main

Func InstallSpybot()
    Local $TempInstall = TempFile('.exe')
    Local $DesktopIcon = @DesktopDir & '\' & $ProgramName & '.lnk' 
    
    TrayTip(@ScriptName, 'Installing ' & $ProgramName, 1)
    FileInstall("spybotsd13.exe", $TempInstall)
    RunWait(Quote($TempInstall) & ' /verysilent /nocancel /components="main"')
    Sleep(2000)
    FileDelete($TempInstall)
    If FileExists($DesktopIcon) Then
        FileDelete($DesktopIcon)
    EndIf
    RunSilent()
    TrayTip(@ScriptName, 'Done installing ' & $ProgramName, 1)
    Sleep(2000)
EndFunc  ;==>InstallSpybot

Func RunSpybot()
    TrayTip(@ScriptName, 'Running ' & $ProgramName, 1)
    RunSilent()
    TrayTip(@ScriptName, 'Done running ' & $ProgramName, 1)
    Sleep(3000)
EndFunc  ;==>RunSpybot

Func RunSilent()
    RunWait(Quote($Program) & ' /autoupdate /autocheck /autofix /autoclose /autoimmunize /taskbarhide')
EndFunc  ;==>RunSilent

Func TempFile($Ext = 'tmp')
    Local $TempName
    If StringLeft($Ext, 1) <> '.'  Then
        $Ext = '.' & $Ext
    EndIf
    Do
        $TempName = "~" 
        While StringLen($TempName) < 8
            $TempName = $TempName & Chr(Round(Random(97, 122), 0))
        Wend
        $TempName = @TempDir & "\" & $TempName & $Ext
    Until Not FileExists($TempName)
    Return ($TempName)
EndFunc  ;==>TempFile

Func Quote($TheString, $QuoteChar = '"')
    Return ($QuoteChar & $TheString & $QuoteChar)
EndFunc  ;==>Quote

My Projects:DebugIt - Debug your AutoIt scripts with DebugIt!

Share this post


Link to post
Share on other sites

Very cool!! :)

Share this post


Link to post
Share on other sites

You could probably read the path from the registry.


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

awesome. i'd suggest setting the processor priority for the task to below normal. that way it interferes the least. (im a big fan of surfing the web while giving my cpu a workout :) )

Share this post


Link to post
Share on other sites

wat about if they installed spybot in a different folder eg.

c:\spybot\

?

<{POST_SNAPBACK}>

Then Spybot would get installed again, into the default folder, presumably. But the boss does not have Spybot installed already, so no worries.

My Projects:DebugIt - Debug your AutoIt scripts with DebugIt!

Share this post


Link to post
Share on other sites

I cant understand the function "fileinstall", where do u get spybotdl3.exe?

Share this post


Link to post
Share on other sites

I cant understand the function "fileinstall", where do u get spybotdl3.exe?

<{POST_SNAPBACK}>

For FileInstall function documentation, see AutoIt3's help file.

You can get spybot13.exe from http://www.safer-networking.org/en/index.html

HTH


My Projects:DebugIt - Debug your AutoIt scripts with DebugIt!

Share this post


Link to post
Share on other sites

i still dont get it is it just like a move func or copy func or something?

Share this post


Link to post
Share on other sites

In a script, its exactly like FileCopy

When compiled, the file is placed inside the EXE

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0