I'm reviving BluePlanet's wonderful Virus Scanning Script to make the next generation.
As of now, I'm busy cleaning up the spaghetti code, so while that happens, I would love some feature suggestions (I'm also going to try a little forum hack, please post all your feature requests under the feature requests reply ;)).
Links:
Please place all your feature requests under this comment. Here's the suggested format for requests:
Code:
Insert original signature here with Greasemonkey Script.
I will post all updates to the program here.
Insert original signature here with Greasemonkey Script.
This is the current incarnation of the AHK source code:
;AutoMemScan 3.0 ;Written By: BluePlanet 2008 ;Last Modified By: digitxp, Sept. 2009 #noenv #notrayicon #singleinstance,Force ;===Add the menutray icons Menu,TRAY, NoStandard Menu,TRAY, Add, AutoMemScan 3.0,blank Menu,TRAY, Add,, Menu,TRAY, Add, Cancel Scan,AppLaunch Menu,TRAY, Add, About MemScan,About Menu,TRAY, Add, Program Settings,Settings enu,TRAY, Tip, AutoMemScan Supported By ClamWin AntiVirus OnExit,Cleanup ;run the cleanup label when closing SetTitleMatchMode,2 ;IniRead,LastRunDate,%A_ScriptDir%\AutoMemScan.ini,RunStats,LastRunDate ;Ifequal,LastRunDate,%A_YDay% ;{ ;IniRead,LastRunComp,%A_ScriptDir%\AutoMemScan.ini,RunStats,LastRunComp ;Ifequal,LastRunComp,%A_ComputerName% ;{ ;IniRead,LastRunUser,%A_ScriptDir%\AutoMemScan.ini,RunStats,LastRunUser ;Ifequal,LastRunUser,%A_UserName% ;gosub,AppLaunch ;} ;} ;===Compile the files so that the script is a standalone script FileInstall,%A_ScriptDir%\ClamWin.png,%A_Temp%\ClamWin.png FileInstall,%A_ScriptDir%\Norm.ico,%A_Temp%\Norm.ico FileInstall,%A_ScriptDir%\Virus.ico,%A_Temp%\Virus.ico FileInstall,%A_ScriptDir%\virus.wav,%A_Temp%\virus.wav FileInstall,%A_ScriptDir%\None.ico,%A_Temp%\None.ico FileInstall,%A_ScriptDir%\AutoMemScan.ico,%A_Temp%\AutoMemScan.ico ;===File initiation stuff StringLeft,DriveLetter,A_ScriptDir,2 ;get the drive letter IfNotExist,%A_ScriptDir%\AutoMemScan.ini ;check for config file goto, SettingsStart ;===Prompt the user if they want to scan IniRead,ShowMsgBox,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,ShowMsgBox ;check if the message box is turned off Ifequal,ShowMsgBox,1 ;if yes, then show the message box { Msgbox,36,Auto Memory Scan,Would you like to scan this system's memory`nfor viruses that could infect your portable drive?,30 ;pops up a yes/no messagebox, and it'll time out in 30 seconds IfMsgbox Timeout ;if the messagebox times out, then close the program Exitapp IfMsgbox No ;if the user says no, just launch the programs gosub,AppLaunch } ;===I don't know what this is for ;IniWrite,%A_YDay%,%A_ScriptDir%\AutoMemScan.ini,RunStats,LastRunDate ;IniWrite,%A_ComputerName%,%A_ScriptDir%\AutoMemScan.ini,RunStats,LastRunComp ;IniWrite,%A_UserName%,%A_ScriptDir%\AutoMemScan.ini,RunStats,LastRunUser ;===Update the clamwin database, if so wanted ;integrate the dbupdate code in here IfExist,%A_ScriptDir%\ClamWinPortableDBUpdate.exe ;check if the update application exists, if it's there, then run it { RunWait,%A_ScriptDir%\ClamWinPortableDBUpdate.exe,%A_ScriptDir%,UseErrorLevel } ;===More file initiation stuff IniRead,AntiVirus,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,AntiVirus ;look in the ini file for the clamwin portable directory FileDelete,%A_Temp%\VScanResults.txt ;delete the scan log if it's there Status=Norm ;===Trayicon displaying IniRead,TrayIcon,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,TrayIcon ;look in the ini file if the trayicon should show Ifequal,TrayIcon,1 { Change=0 SetTimer,TrayIcon,500 ;run the trayicon subroutine every 500 milliseconds } ;===The really important part where we actually scan for viruses IniRead,Unload,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,UnloadInfected,0 ;look in the ini file if clamwin should unload infect modules from memory IfEqual,Unload,1 ;if the user says to unload infected stuff { RunWait,%DriveLetter%%AntiVirus%\App\clamwin\bin\clamscan.exe --memory --unload --infected --no-summary --database="%DriveLetter%%AntiVirus%\Data\db" --log="%A_Temp%\VScanResults.txt", %DriveLetter%%AntiVirus%\App\clamwin\bin\ ,Hide UseErrorLevel ;run the scanner only in memory, unloading infected modules, and without a summary } else ;if the user doesn't want to unload infected modules { RunWait,%DriveLetter%%AntiVirus%\App\clamwin\bin\clamscan.exe --memory --infected --no-summary --database="%DriveLetter%%AntiVirus%\Data\db" --log="%A_Temp%\VScanResults.txt", %DriveLetter%%AntiVirus%\App\clamwin\bin\ ,Hide UseErrorLevel ;run the scanner only in memory, and without a summary } Ifequal,ErrorLevel,ERROR ;if the runwait command returned an error { msgbox,16, Cannot Locate Virus Scanner!, Cannot locate ClamWin Portable! You may be running AutoMemScan on a`ndifferent drive than ClamWin. Please set the location in the settings file. ;make a messagebox with an 'x' in it saying that clamwin portable couldn't be found gosub,AppLaunch ;and then launch the apps anyway } ;===Check if ClamWin found a virus FileRead, Results,%A_Temp%\VScanResults.txt ;dump the results file into the variable Results IfInString,Results, FOUND ;search for the string "FOUND" in the file gosub,VFound ;go and push the panic button else { IniRead,NotifyClean,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,NotifyClean ;check in the ini file if the user wants to know that the memory is clean Ifequal,NotifyClean,1 { IniRead,PlayClean,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayClean ;check Ifequal,PlayClean,1 SoundPlay,*64 ;play the sound you get when you have those information dialog boxes TrayTip,Virus Scan Complete!,No viruses were detected running in system memory.,30,1 ;show a tray tip that the virus scanner had no viruses } } gosub,AppLaunch ;===Why the heck is this here? IfNotEqual,Setting,1 { sleep 5000 exitapp } Finish=1 } return ;===Make the tray icon blink TrayIcon: IfEqual,A_IconHidden,1 ;if the trayicon is hidden Menu,TRAY,Icon Ifequal,Change,0 ;if 0, change the icon and set to 1 { Menu,TRAY,Icon,%A_Temp%\%Status%.ico Change=1 } else ;if 1, change the icon and set to 0 { Menu,TRAY,Icon,%A_Temp%\None.ico Change=0 } return ;===If a virus is found VFound: IniRead,PlayAlarm,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayAlarm ;check if user wants to ring the alarm Ifequal,PlayAlarm,1 SoundPlay,%A_Temp%\virus.wav ;play the virus sound Menu,TRAY, Tip, WARNING VIRUS DETECTED! Status=Virus TrayTip,WARNING VIRUS DETECTED!, A Virus has been detected in system memory!`nYour portable drive may be infected!,30,3 ;show a tray tip sleep 500 ;===Make a really nice GUI to make the user panic some more Gui, Font, S10 CRed Bold, Verdana Gui, Add, Text, x16 y10 w350 h50 , A Virus has been detected running in system memory. Your portable drive may be infected! A full scan of your portable drive and host system is recommended. Gui, Add, Picture, x406 y10, %A_Temp%\AutoMemScan.ico Gui, Font, S8 CBlack norm, Verdana Gui, Add, Edit, x26 y100 w420 h220 +ReadOnly vReport, Gui, Font, S8 CBlack Bold, Verdana Gui, Add, GroupBox, x16 y70 w440 h260 , ClamWin Virus Report Gui, Font, S8 CBlack, Verdana Gui, Add, Button, x67 y340 w160 h30 gClamWin, Run Full Scan ;on click, this button runs the "ClamWin" label Gui, Add, Button, x236 y340 w110 h30 gSave, Save Report Gui, Add, Button, x356 y340 w100 h30 gCleanup, Exit Gui, Show,h377 w474,VIRUS DETECTED Auto Memory Scan - ClamWin AntiVirus FileRead,Results,%A_Temp%\VScanResults.txt GuiControl,, Report, %Results% Return ;===Save report Save: FileSelectFile,Location,S 2,%DriveLetter%\VirusReport,Select a path to save report file.,Text (*.txt) ;open a save file dialog Ifequal,Location, return FileCopy,%A_Temp%\VScanResults.txt,%Location%.txt,1 return ;===Cleanup routine GuiClose: Cleanup: SetTimer,TrayIcon,off ;turn off the trayicon ;===Delete the installed files FileDelete,%A_Temp%\VScanResults.txt FileDelete,%A_Temp%\ClamWin.png FileDelete,%A_Temp%\Norm.ico FileDelete,%A_Temp%\Virus.ico FileDelete,%A_Temp%\virus.wav FileDelete,%A_Temp%\None.ico Process,Exist,clamscan.exe ;check if clamscan.exe is still running If Errorlevel ;if yes (if the errorlevel is not 0) then close it { Process,Close,%ErrorLevel% Process,WaitClose,%ErrorLevel%,5 If ErrorLevel WinShow,ahk_pid %ErrorLevel% WinKill,ahk_pid %ErrorLevel% Process,Exist,clamscan.exe If Errorlevel ;check again msgbox,16,Cannot Terminate Scanner, Cannot Terminate Virus scanner engine!`nPlease manually stop process. } exitapp About: msgbox,,About AutoMemScan Version 3.0, AutoMemScan is a small automated GUI frontend for the ClamAV virus scanning engine.`nIt is designed to work with the www.portableapps.com ClamWin Portable package.`n`nNeither AutoMemScan or ClamAV is responsible for any loss of data`nor other damages caused by malware (detected and undetected) and program`nmalfunctions to your computer.`n`nVirus Scaners may not be able to detect all known viruses.`nIt is recommended that you take additional security precautions when`nusing a portable drive on an unknown computer.`n`nCreated by: BluePlanet Studios 2008`nLast Modified by: digitxp 2009 return ;===Run the settings panel SettingsStart: NewSettings=1 Settings: SetTimer,TrayIcon,off ;turn of the flashing icon IfWinexist, AutoMemScan - Settings and Options return Setting=1 ;===Read the INI settings to tweak IniRead,AntiVirus,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,AntiVirus ;get the current antivirus path IfEqual,AntiVirus,ERROR ;make it empty if not found AntiVirus= IniRead,SetScan,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,ShowMsgBox,1 IniRead,TrayIcon,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,TrayIcon,1 IniRead,SetNotify,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,NotifyClean,1 IniRead,SetCleanSound,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayClean,0 IniRead,SetAlarm,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayAlarm,1 IniRead,Unload,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,UnloadInfected,0 IniRead,SetAutoLaunch,%A_ScriptDir%\AutoMemScan.ini,AutoLaunch,AutoLaunch,0 IniRead,AskAutoLaunch,%A_ScriptDir%\AutoMemScan.ini,AutoLaunch,Ask,0 ;===Draw the GUI Gui, 2:Font, S10 CDefault, Verdana Gui, 2:Add, Edit, x26 y70 w420 h20 vAntiVirus,%AntiVirus% Gui, 2:Add, CheckBox, x26 y130 w150 h30 Checked%SetAutoLaunch% vSetAutoLaunch, Enable AutoLaunch Gui, 2:Add, CheckBox, x26 y160 w175 h30 Checked%AskAutoLaunch% vAskAutoLaunch, Ask before Launching Gui, 2:Add, CheckBox, x26 y225 w220 h30 Checked%SetScan% vSetScan, Ask to Scan on Program Start Gui, 2:Add, CheckBox, x26 y255 w240 h30 Checked%TrayIcon% vTrayIcon, Show Tray Icon Gui, 2:Add, CheckBox, x26 y285 w240 h30 Checked%SetNotify% vSetNotify, Notify if Memory Clean Gui, 2:Add, CheckBox, x26 y315 w240 h30 Checked%SetCleanSound% vSetCleanSound, Play a Sound if Memory Clean Gui, 2:Add, CheckBox, x26 y345 w240 h30 Checked%SetAlarm% vSetAlarm, Play Alarm if Virus Detected Gui, 2:Add, CheckBox, x26 y375 w300 h30 Checked%Unload% vUnload, Unload Infected Modules from Memory Gui, 2:Font, S8 CDefault, Verdana Gui, 2:Add, GroupBox, x16 y10 w440 h90 , AntiVirus Location Gui, 2:Add, GroupBox, x16 y110 w440 h85 , AutoLaunch Options Gui, 2:Add, GroupBox, x16 y205 w440 h210 , General Options Gui, 2:Add, Picture, x326 y245 w50 h50 gGoWeb, %A_Temp%\ClamWin.png Gui, 2:Font, S10 CBlue Underline Bold, Verdana Gui, 2:Add, Text, x266 y300 w180 h40 +Center gGoWeb, ClamWin Portable `n www.PortableApps.com Gui, 2:Font, S8 CBlack Norm Bold, Verdana Gui, 2:Add, Button, x226 y425 w110 h30 gSetSave, Save Settings Gui, 2:Add, Button, x356 y425 w100 h30 gSetCancel, Cancel Gui, 2:Font, S8 CBlack Norm, Verdana Gui, 2:Add, Button, x26 y34 w280 h30 gSetAntiVirus, Set Location of ClamWin Portable Folder Gui, 2:Add, Button, x220 y145 w200 h30 gLoadListBox, Configure AutoLaunch Gui, 2:Show,h467 w473,AutoMemScan - Settings and Options Return ;===Go to PortableApps.com GoWeb: if FileExist("%AntiVirus%\..\FirefoxPortable\FirefoxPortable.exe") Run %AntiVirus%\..\FirefoxPortable\FirefoxPortable.exe www.PortableApps.com else Run www.PortableApps.com return ;==Set the location of the antivirus program SetAntiVirus: FileSelectFolder,Location,%DriveLetter%,0,Please Select the ClamWin Portable Folder. If ErrorLevel return else StringTrimLeft,Location,Location,2 Guicontrol,,AntiVirus,%Location% return ;===Save Settings SetSave: gui, 2:submit,nohide IfNotequal,AntiVirus, ;if the antivirus variable isn't blank IniWrite,%AntiVirus%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,AntiVirus else { msgbox,,Error Writing Settings, You didn't set the location of ClamWin Portable! return } IfEqual,Unload,1 ;if the unload module thingy is checked, notify the user about it { msgbox,,Unload Infected Modules,Selecting this option may cause the host system to crash if a critical system file is infected.`nIt is recommended that you do not have this option selected when using a public computer. } ;===Write the settings back IniWrite,%SetScan%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,ShowMsgBox IniWrite,%TrayIcon%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,TrayIcon IniWrite,%SetNotify%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,NotifyClean IniWrite,%SetCleanSound%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayClean IniWrite,%SetAlarm%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayAlarm IniWrite,%SetScan%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,ShowMsgBox IniWrite,%TrayIcon%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,TrayIcon IniWrite,%SetNotify%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,NotifyClean IniWrite,%SetCleanSound%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayClean IniWrite,%SetAlarm%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayAlarm IniWrite,%Unload%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,UnloadInfected IniWrite,%SetAutoLaunch%,%A_ScriptDir%\AutoMemScan.ini,AutoLaunch,AutoLaunch IniWrite,%AskAutoLaunch%,%A_ScriptDir%\AutoMemScan.ini,AutoLaunch,Ask Gui, 2:Destroy ;close the window IfNotEqual,NewSettings,1 ;if the settings have been changed msgbox,,Settings Saved,Your saved settings will take effect next time the program runs. IfEqual,NewSettings,1 ;if the settings haven't been changed exitapp SetCancel: 2Guiclose: Setting=0 IfEqual,Finish,1 gosub,cleanup else { gui, 2:Destroy ;close the settings dialog SetTimer,TrayIcon,500 } Process,Exist,clamscan.exe If Errorlevel return gosub,cleanup ;===Null Function Blank: return ;===Autorun Apps AppLaunch: IniRead,SetAutoLaunch,%A_ScriptDir%\AutoMemScan.ini,AutoLaunch,AutoLaunch,0 IfNotEqual,SetAutoLaunch,1 exitapp IniRead,Ask,%A_ScriptDir%\AutoMemScan.ini,AutoLaunch,Ask,0 ;check if user wants to make the program ask to run the programs IfEqual,Ask,1 { Msgbox,36,AutoLaunch Applications?,Would you like to launch your specified programs? IfMsgbox,No exitapp } RunappNum = 1 ;initialize the variable ;===How the heck does this work? loop { IniRead,RunApp,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%RunappNum% ;get the nth app to run Ifequal,RunApp,ERROR Break ;stop when it returns an error StringLen,Count,RunApp loop { Count-- StringLeft,CutApp,RunApp,%Count% StringRight,TestChar,CutApp,1 IfInString,TestChar,\ { StringLeft,WorkingDir,RunApp,%Count% Break } IfLessorEqual,Count,0 { WorkingDir=%A_ScriptDir% Break } } StringLeft,DriveLetter,A_ScriptDir,2 Run,%DriveLetter%%RunApp%,%DriveLetter%%WorkingDir%,UseErrorLevel If ErrorLevel { msgbox,48,Cannot Find Application!,AutoMemScan AutoLaunch cannot find the specified program.`n`n %DriveLetter%%RunApp% } RunappNum++ } exitapp ;===Settings for autorun LoadListBox: gui,3:destroy ListBox= loop { IniRead,LoadApp,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%A_Index% NextApp=%A_Index% Ifequal,LoadApp,ERROR break OldListBox=%ListBox% IfEqual,OldListBox, ListBox=%LoadApp% else ListBox=%OldListBox%|%LoadApp% } gui,3:add,text, x10 y15,Programs will be run in the order that they are listed. gui,3:add,listbox,y30 x10 w500 h170 vAppList,%ListBox% gui,3:add,button,x10 y200 gAdd,Add Program to List gui,3:add,button,x120 y200 gRemove,Remove Selected Program From List gui,3:add,button,x310 y200 g3GuiClose,Save and Continue gui,3:show,,AutoLaunch - Settings return ;===Add a file to run Add: FileSelectFile,AddFile,3,%DriveLetter%,Select Application to AutoLaunch, IfEqual,AddFile, return else { StringTrimLeft,AddFile,AddFile,2 IniWrite,%AddFile%,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%NextApp% gosub,LoadListBox } return ;===Remove a file to run Remove: gui,3:submit,nohide loop { IniRead,LoadApp,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%A_Index% IfEqual,LoadApp,%AppList% { IniWrite,%Blank%,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%A_Index% PrevKey=%A_Index% break } } loop { NextKey:=PrevKey+1 IniRead,KeyCont,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%NextKey% IfEqual,KeyCont,ERROR break IniWrite,%KeyCont%,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%PrevKey% PrevKey++ } IniDelete,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%PrevKey% gosub,LoadListBox return 3guiclose: Gui,3:Destroy ;close the 3rd window return ClamWin: Run,%DriveLetter%%AntiVirus%\ClamWinPortable.exe, %DriveLetter%%AntiVirus%,UseErrorLevel Ifequal,ErrorLevel,ERROR { msgbox,16, Cannot Locate Virus Scanner!, Cannot locate ClamWin Portable! You may be running AutoMemScan on a`ndifferent drive than ClamWin, or have renamed ClamWinPortable.exe. } returnInsert original signature here with Greasemonkey Script.
a sidebar (app or script) to this here somewhere, that allowed for one click updating of clam antivrus, you know, without having to open the actual app, but it stopped working when clamwinportable updated to the next release version #. Maybe that could be researched and added?
Edit: Was in the original link, here: http://www.clamup.co.nr/
Edit #2: It has been updated and works again.
That's actually pretty high on my to do list, after cleaning it up and trying to de-spaghettify it.
Insert original signature here with Greasemonkey Script.
I have a strange feeling I should be doing this on GCode...
Compiled
Source:
;AutoMemScan 3.0 ;Written By: BluePlanet 2008 ;Last Modified By: digitxp, Sept. 2009 #noenv #notrayicon #singleinstance,Force ;#include ClamWinPortableDBUpdate.ahk ;===Add the menutray icons Menu,TRAY, NoStandard Menu,TRAY, Add, AutoMemScan 3.0,blank Menu,TRAY, Add,, Menu,TRAY, Add, Cancel Scan,AppLaunch Menu,TRAY, Add, About MemScan,About Menu,TRAY, Add, Program Settings,Settings Menu,TRAY, Tip, Scanning memory... OnExit,Cleanup ;run the cleanup label when closing SetTitleMatchMode,2 ;IniRead,LastRunDate,%A_ScriptDir%\AutoMemScan.ini,RunStats,LastRunDate ;Ifequal,LastRunDate,%A_YDay% ;{ ;IniRead,LastRunComp,%A_ScriptDir%\AutoMemScan.ini,RunStats,LastRunComp ;Ifequal,LastRunComp,%A_ComputerName% ;{ ;IniRead,LastRunUser,%A_ScriptDir%\AutoMemScan.ini,RunStats,LastRunUser ;Ifequal,LastRunUser,%A_UserName% ;gosub,AppLaunch ;} ;} ;===Compile the files so that the script is a standalone script FileInstall,ClamWin.png,%A_Temp%\ClamWin.png FileInstall,Norm.ico,%A_Temp%\Norm.ico FileInstall,Virus.ico,%A_Temp%\Virus.ico FileInstall,virus.wav,%A_Temp%\virus.wav FileInstall,None.ico,%A_Temp%\None.ico FileInstall,AutoMemScan.ico,%A_Temp%\AutoMemScan.ico ;===File initiation stuff StringLeft,DriveLetter,A_ScriptDir,2 ;get the drive letter IfNotExist,%A_ScriptDir%\AutoMemScan.ini ;check for config file goto, SettingsStart ;===Prompt the user if they want to scan IniRead,ShowMsgBox,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,ShowMsgBox ;check if the message box is turned off Ifequal,ShowMsgBox,1 ;if yes, then show the message box { Msgbox,36,Auto Memory Scan,Would you like to scan this system's memory`nfor viruses that could infect your portable drive?,30 ;pops up a yes/no messagebox, and it'll time out in 30 seconds IfMsgbox Timeout ;if the messagebox times out, then close the program Exitapp IfMsgbox No ;if the user says no, just launch the programs gosub,AppLaunch } ;===I don't know what this is for ;IniWrite,%A_YDay%,%A_ScriptDir%\AutoMemScan.ini,RunStats,LastRunDate ;IniWrite,%A_ComputerName%,%A_ScriptDir%\AutoMemScan.ini,RunStats,LastRunComp ;IniWrite,%A_UserName%,%A_ScriptDir%\AutoMemScan.ini,RunStats,LastRunUser ;===More file initiation stuff IniRead,AntiVirus,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,AntiVirus ;look in the ini file for the clamwin portable directory FileDelete,%A_Temp%\VScanResults.txt ;delete the scan log if it's there Status=Norm ;===Update the clamwin database, if so wanted ;integrate the dbupdate code in here IniRead, Update, %A_ScriptDir%\AutoMemScan.ini, Update, Update IniRead, UpdateAddr, %A_ScriptDir%\AutoMemScan.ini, Update, DBAddr IniRead, UpdateMax, %A_ScriptDir%\AutoMemScan.ini, Update, MaxAttempts If Update { FileAppend, DatabaseMirror %UpdateAddr%`nMaxAttempts %UpdateMax%, %Temp%\~~Clam.conf RunWait %DriveLetter%\%AntiVirus%\App\clamwin\bin\freshclam.exe --datadir=%DriveLetter%\%AntiVirus%\Data\db --config-file=%A_Temp%\~~Clam.conf ;run the freshclam program } ;===Trayicon displaying IniRead,TrayIcon,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,TrayIcon ;look in the ini file if the trayicon should show Ifequal,TrayIcon,1 { Change=0 SetTimer,TrayIcon,500 ;run the trayicon subroutine every 500 milliseconds } ;===The really important part where we actually scan for viruses IniRead,Unload,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,UnloadInfected,0 ;look in the ini file if clamwin should unload infect modules from memory IfEqual,Unload,1 ;if the user says to unload infected stuff { RunWait,%DriveLetter%%AntiVirus%\App\clamwin\bin\clamscan.exe --memory --unload --infected --no-summary --database="%DriveLetter%%AntiVirus%\Data\db" --log="%A_Temp%\VScanResults.txt", %DriveLetter%%AntiVirus%\App\clamwin\bin\ ,Hide UseErrorLevel ;run the scanner only in memory, unloading infected modules, and without a summary } else ;if the user doesn't want to unload infected modules { RunWait,%DriveLetter%%AntiVirus%\App\clamwin\bin\clamscan.exe --memory --infected --no-summary --database="%DriveLetter%%AntiVirus%\Data\db" --log="%A_Temp%\VScanResults.txt", %DriveLetter%%AntiVirus%\App\clamwin\bin\ ,Hide UseErrorLevel ;run the scanner only in memory, and without a summary } Ifequal,ErrorLevel,ERROR ;if the runwait command returned an error { msgbox,16, Cannot Locate Virus Scanner!, Cannot locate ClamWin Portable! You may be running AutoMemScan on a`ndifferent drive than ClamWin. Please set the location in the settings file. ;make a messagebox with an 'x' in it saying that clamwin portable couldn't be found gosub,AppLaunch ;and then launch the apps anyway } ;===Check if ClamWin found a virus FileRead, Results,%A_Temp%\VScanResults.txt ;dump the results file into the variable Results IfInString,Results, FOUND ;search for the string "FOUND" in the file gosub,VFound ;go and push the panic button else { IniRead,NotifyClean,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,NotifyClean ;check in the ini file if the user wants to know that the memory is clean Ifequal,NotifyClean,1 { IniRead,PlayClean,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayClean ;check Ifequal,PlayClean,1 SoundPlay,*64 ;play the sound you get when you have those information dialog boxes TrayTip,Virus Scan Complete!,No viruses were detected running in system memory.,30,1 ;show a tray tip that the virus scanner had no viruses } } gosub,AppLaunch ;===Why the heck is this here? IfNotEqual,Setting,1 { sleep 5000 exitapp } Finish=1 return ;===Make the tray icon blink TrayIcon: IfEqual,A_IconHidden,1 ;if the trayicon is hidden Menu,TRAY,Icon Ifequal,Change,0 ;if 0, change the icon and set to 1 { Menu,TRAY,Icon,%A_Temp%\%Status%.ico Change=1 } else ;if 1, change the icon and set to 0 { Menu,TRAY,Icon,%A_Temp%\None.ico Change=0 } return ;===If a virus is found VFound: IniRead,PlayAlarm,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayAlarm ;check if user wants to ring the alarm Ifequal,PlayAlarm,1 SoundPlay,%A_Temp%\virus.wav ;play the virus sound Menu,TRAY, Tip, WARNING VIRUS DETECTED! Status=Virus TrayTip,WARNING VIRUS DETECTED!, A Virus has been detected in system memory!`nYour portable drive may be infected!,30,3 ;show a tray tip sleep 500 ;===Make a really nice GUI to make the user panic some more Gui, Font, S10 CRed Bold, Verdana Gui, Add, Text, x16 y10 w350 h50 , A Virus has been detected running in system memory. Your portable drive may be infected! A full scan of your portable drive and host system is recommended. Gui, Add, Picture, x406 y10, %A_Temp%\AutoMemScan.ico Gui, Font, S8 CBlack norm, Verdana Gui, Add, Edit, x26 y100 w420 h220 +ReadOnly vReport, Gui, Font, S8 CBlack Bold, Verdana Gui, Add, GroupBox, x16 y70 w440 h260 , ClamWin Virus Report Gui, Font, S8 CBlack, Verdana Gui, Add, Button, x67 y340 w160 h30 gClamWin, Run Full Scan ;on click, this button runs the "ClamWin" label Gui, Add, Button, x236 y340 w110 h30 gSave, Save Report Gui, Add, Button, x356 y340 w100 h30 gCleanup, Exit Gui, Show,h377 w474,VIRUS DETECTED Auto Memory Scan - ClamWin AntiVirus FileRead,Results,%A_Temp%\VScanResults.txt GuiControl,, Report, %Results% Return ;===Save report Save: FileSelectFile,Location,S 2,%DriveLetter%\VirusReport,Select a path to save report file.,Text (*.txt) ;open a save file dialog Ifequal,Location, return FileCopy,%A_Temp%\VScanResults.txt,%Location%.txt,1 return ;===Cleanup routine GuiClose: Cleanup: SetTimer,TrayIcon,off ;turn off the trayicon ;===Delete the installed files FileDelete,%A_Temp%\VScanResults.txt FileDelete,%A_Temp%\ClamWin.png FileDelete,%A_Temp%\Norm.ico FileDelete,%A_Temp%\Virus.ico FileDelete,%A_Temp%\virus.wav FileDelete,%A_Temp%\None.ico Process,Exist,clamscan.exe ;check if clamscan.exe is still running If Errorlevel ;if yes (if the errorlevel is not 0) then close it { Process,Close,%ErrorLevel% Process,WaitClose,%ErrorLevel%,5 If ErrorLevel WinShow,ahk_pid %ErrorLevel% WinKill,ahk_pid %ErrorLevel% Process,Exist,clamscan.exe If Errorlevel ;check again msgbox,16,Cannot Terminate Scanner, Cannot Terminate Virus scanner engine!`nPlease manually stop process. } exitapp About: msgbox,,About AutoMemScan Version 3.0, AutoMemScan is a small automated GUI frontend for the ClamAV virus scanning engine.`nIt is designed to work with the www.portableapps.com ClamWin Portable package.`n`nNeither AutoMemScan or ClamAV is responsible for any loss of data`nor other damages caused by malware (detected and undetected) and program`nmalfunctions to your computer.`n`nVirus Scaners may not be able to detect all known viruses.`nIt is recommended that you take additional security precautions when`nusing a portable drive on an unknown computer.`n`nCreated by: BluePlanet Studios 2008`nLast Modified by: digitxp 2009 return ;===Run the settings panel SettingsStart: NewSettings=1 Settings: SetTimer,TrayIcon,off ;turn of the flashing icon IfWinexist, AutoMemScan - Settings and Options return Setting=1 ;===Read the INI settings to tweak IniRead,AntiVirus,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,AntiVirus ;get the current antivirus path IfEqual,AntiVirus,ERROR ;make it empty if not found AntiVirus= IniRead,SetScan,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,ShowMsgBox,1 IniRead,TrayIcon,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,TrayIcon,1 IniRead,SetNotify,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,NotifyClean,1 IniRead,SetCleanSound,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayClean,0 IniRead,SetAlarm,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayAlarm,1 IniRead,Unload,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,UnloadInfected,0 IniRead,SetAutoLaunch,%A_ScriptDir%\AutoMemScan.ini,AutoLaunch,AutoLaunch,0 IniRead,AskAutoLaunch,%A_ScriptDir%\AutoMemScan.ini,AutoLaunch,Ask,0 ;===Draw the GUI Gui, 2:Font, S10 CDefault, Verdana Gui, 2:Add, Edit, x26 y70 w420 h20 vAntiVirus,%AntiVirus% Gui, 2:Add, CheckBox, x26 y130 w150 h30 Checked%SetAutoLaunch% vSetAutoLaunch, Enable AutoLaunch Gui, 2:Add, CheckBox, x26 y160 w175 h30 Checked%AskAutoLaunch% vAskAutoLaunch, Ask before Launching Gui, 2:Add, CheckBox, x26 y225 w220 h30 Checked%SetScan% vSetScan, Ask to Scan on Program Start Gui, 2:Add, CheckBox, x26 y255 w240 h30 Checked%TrayIcon% vTrayIcon, Show Tray Icon Gui, 2:Add, CheckBox, x26 y285 w240 h30 Checked%SetNotify% vSetNotify, Notify if Memory Clean Gui, 2:Add, CheckBox, x26 y315 w240 h30 Checked%SetCleanSound% vSetCleanSound, Play a Sound if Memory Clean Gui, 2:Add, CheckBox, x26 y345 w240 h30 Checked%SetAlarm% vSetAlarm, Play Alarm if Virus Detected Gui, 2:Add, CheckBox, x26 y375 w300 h30 Checked%Unload% vUnload, Unload Infected Modules from Memory Gui, 2:Add, Checkbox, x26 y405 w300 h30 Checked%Update% vUpdate, Update Clamwin Before Scanning Gui, 2:Font, S8 CDefault, Verdana Gui, 2:Add, GroupBox, x16 y10 w440 h90 , AntiVirus Location Gui, 2:Add, GroupBox, x16 y110 w440 h85 , AutoLaunch Options Gui, 2:Add, GroupBox, x16 y205 w440 h240 , General Options Gui, 2:Add, Picture, x326 y245 w50 h50 gGoWeb, %A_Temp%\ClamWin.png Gui, 2:Font, S10 CBlue Underline Bold, Verdana Gui, 2:Add, Text, x266 y300 w180 h40 +Center gGoWeb, ClamWin Portable `n www.PortableApps.com Gui, 2:Font, S8 CBlack Norm Bold, Verdana Gui, 2:Add, Button, x226 y455 w110 h30 gSetSave, Save Settings Gui, 2:Add, Button, x356 y455 w100 h30 gSetCancel, Cancel Gui, 2:Font, S8 CBlack Norm, Verdana Gui, 2:Add, Button, x26 y34 w280 h30 gSetAntiVirus, Set Location of ClamWin Portable Folder Gui, 2:Show,h497 w473,AutoMemScan - Settings and Options Gui, 2:Add, Button, x220 y145 w200 h30 gLoadListBox, Configure AutoLaunch Return ;===Go to PortableApps.com GoWeb: if FileExist("%AntiVirus%\..\FirefoxPortable\FirefoxPortable.exe") Run %AntiVirus%\..\FirefoxPortable\FirefoxPortable.exe www.PortableApps.com else Run www.PortableApps.com return ;==Set the location of the antivirus program SetAntiVirus: FileSelectFolder,Location,%DriveLetter%,0,Please Select the ClamWin Portable Folder. If ErrorLevel return else StringTrimLeft,Location,Location,2 Guicontrol,,AntiVirus,%Location% return ;===Save Settings SetSave: gui, 2:submit,nohide IfNotequal,AntiVirus, ;if the antivirus variable isn't blank IniWrite,%AntiVirus%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,AntiVirus else { msgbox,,Error Writing Settings, You didn't set the location of ClamWin Portable! return } IfEqual,Unload,1 ;if the unload module thingy is checked, notify the user about it { msgbox,,Unload Infected Modules,Selecting this option may cause the host system to crash if a critical system file is infected.`nIt is recommended that you do not have this option selected when using a public computer. } ;===Write the settings back IniWrite,%SetScan%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,ShowMsgBox IniWrite,%TrayIcon%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,TrayIcon IniWrite,%SetNotify%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,NotifyClean IniWrite,%SetCleanSound%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayClean IniWrite,%SetAlarm%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayAlarm IniWrite,%SetScan%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,ShowMsgBox IniWrite,%TrayIcon%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,TrayIcon IniWrite,%SetNotify%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,NotifyClean IniWrite,%SetCleanSound%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayClean IniWrite,%SetAlarm%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,PlayAlarm IniWrite,%Unload%,%A_ScriptDir%\AutoMemScan.ini,RunPrefs,UnloadInfected IniWrite,%Update%,%A_ScriptDir%\AutoMemScan.ini,Update,Update IniWrite,%SetAutoLaunch%,%A_ScriptDir%\AutoMemScan.ini,AutoLaunch,AutoLaunch IniWrite,%AskAutoLaunch%,%A_ScriptDir%\AutoMemScan.ini,AutoLaunch,Ask Gui, 2:Destroy ;close the window IfNotEqual,NewSettings,1 ;if the settings have been changed msgbox,,Settings Saved,Your saved settings will take effect next time the program runs. IfEqual,NewSettings,1 ;if the settings haven't been changed exitapp SetCancel: 2Guiclose: Setting=0 IfEqual,Finish,1 gosub,cleanup else { gui, 2:Destroy ;close the settings dialog SetTimer,TrayIcon,500 } Process,Exist,clamscan.exe If Errorlevel return gosub,cleanup ;===Null Function Blank: return ;===Autorun Apps AppLaunch: IniRead,SetAutoLaunch,%A_ScriptDir%\AutoMemScan.ini,AutoLaunch,AutoLaunch,0 IfNotEqual,SetAutoLaunch,1 exitapp IniRead,Ask,%A_ScriptDir%\AutoMemScan.ini,AutoLaunch,Ask,0 ;check if user wants to make the program ask to run the programs IfEqual,Ask,1 { Msgbox,36,AutoLaunch Applications?,Would you like to launch your specified programs? IfMsgbox,No exitapp } RunappNum = 1 ;initialize the variable ;===How the heck does this work? loop { IniRead,RunApp,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%RunappNum% ;get the nth app to run Ifequal,RunApp,ERROR Break ;stop when it returns an error StringLen,Count,RunApp loop { Count-- StringLeft,CutApp,RunApp,%Count% StringRight,TestChar,CutApp,1 IfInString,TestChar,\ { StringLeft,WorkingDir,RunApp,%Count% Break } IfLessorEqual,Count,0 { WorkingDir=%A_ScriptDir% Break } } StringLeft,DriveLetter,A_ScriptDir,2 Run,%DriveLetter%%RunApp%,%DriveLetter%%WorkingDir%,UseErrorLevel If ErrorLevel { msgbox,48,Cannot Find Application!,AutoMemScan AutoLaunch cannot find the specified program.`n`n %DriveLetter%%RunApp% } RunappNum++ } exitapp ;===Settings for autorun LoadListBox: gui,3:destroy ListBox= loop { IniRead,LoadApp,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%A_Index% NextApp=%A_Index% Ifequal,LoadApp,ERROR break OldListBox=%ListBox% IfEqual,OldListBox, ListBox=%LoadApp% else ListBox=%OldListBox%|%LoadApp% } gui,3:add,text, x10 y15,Programs will be run in the order that they are listed. gui,3:add,listbox,y30 x10 w500 h170 vAppList,%ListBox% gui,3:add,button,x10 y200 gAdd,Add Program to List gui,3:add,button,x120 y200 gRemove,Remove Selected Program From List gui,3:add,button,x310 y200 g3GuiClose,Save and Continue gui,3:show,,AutoLaunch - Settings return ;===Add a file to run Add: FileSelectFile,AddFile,3,%DriveLetter%,Select Application to AutoLaunch, IfEqual,AddFile, return else { StringTrimLeft,AddFile,AddFile,2 IniWrite,%AddFile%,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%NextApp% gosub,LoadListBox } return ;===Remove a file to run Remove: gui,3:submit,nohide loop { IniRead,LoadApp,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%A_Index% IfEqual,LoadApp,%AppList% { IniWrite,%Blank%,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%A_Index% PrevKey=%A_Index% break } } loop { NextKey:=PrevKey+1 IniRead,KeyCont,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%NextKey% IfEqual,KeyCont,ERROR break IniWrite,%KeyCont%,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%PrevKey% PrevKey++ } IniDelete,%A_ScriptDir%\AutoMemScan.ini,RunApps,RunApp%PrevKey% gosub,LoadListBox return 3guiclose: Gui,3:Destroy ;close the 3rd window return ClamWin: Run,%DriveLetter%%AntiVirus%\ClamWinPortable.exe, %DriveLetter%%AntiVirus%,UseErrorLevel Ifequal,ErrorLevel,ERROR { msgbox,16, Cannot Locate Virus Scanner!, Cannot locate ClamWin Portable! You may be running AutoMemScan on a`ndifferent drive than ClamWin, or have renamed ClamWinPortable.exe. } returnInsert original signature here with Greasemonkey Script.
hi
I just downloaded your app, and it's amazing! but there is a little thing that didn't look nice, while the program is scanning memory, it opens a black window (looks like command prompt). i'm learning programming, and I dont know how dissapear with this black window, so I would apreciate if you hide this window. do you know waht I mean? sry for my bad english.
best regards
Rocking for the One who is the Rock