Jump to content

Recommended Posts

Posted (edited)

Only a minor problem. You were missing a "endIf"

These are easier to find when you format (Tidy) the code [CTRL]-T

AND

It shows where it fails which is usually where the error is. :)

Run(@HomeDrive & "Program Files (x86)Malwarebytes' Anti-Malwarembam.exe")
WinWaitActive("[class:ThunderRT6FormDC]", "Perform flash scan")
WinMove("[class:ThunderRT6FormDC]", "Perform flash scan", 0, 0, 778, 593)
Sleep(1500)
;BlockInput(1);Blocks user (input not blocked for testing purposes, just remove semicolon at the beginning to activate feature. )
MouseClick("left", 182, 128);selects update tab in main window
Sleep(1500)
MouseClick("left", 102, 328);selects check for updates
Sleep(5000)
Local $icount = 25
While $icount
If WinActive("[CLASS:#32770]", "The database was successfully updated from version") Then
  Sleep(2500)
  WinKill("[CLASS:#32770]", "The database was successfully updated from version")
  If WinActive("[CLASS:#32770]", "You have the latest database version") Then
   Sleep(2500)
   WinKill("[CLASS:#32770]", "You have the latest database version")
   ExitLoop
  EndIf
EndIf
WEnd
If ProcessExists("mbam.exe") Then
ProcessClose("mbam.exe")
MsgBox(0, "Malwarebytes updater", "Malwarebytes has been updated. Please standby for malware scan", 5)
EndIf
ProcessWaitClose("mbam.exe")
Run(@HomeDrive & "Program Files (x86)Malwarebytes' Anti-Malwarembam.exe AUTO")
ProcessWaitClose("mbam.exe")

BTW I have a "mostly functional" MalewareBytes script here if you want to look at it later let me know.

I got side tracked when I got up to the GUI for the script....sigh...

It's based on the freeware version and will

Install, Update, quick scan, Full scan and even uninstall if required. :)

OH and add exceptions ot the list.

But it hasn't been tested...

Edited by storme
Posted

Thank you StormE,

Thank you for that find!

I had it in there before, I must have removed it playing with the code. Anyways another set of eyes helps when you can't see clearly. I' just got to the office, so i will begin my work. I would love to see your code for MBAM, all code at this point helps me understand more. I can't stop thinking about the many ways I can use this. I fear my life may be consumed with coding, lol

Prcssupport

Posted (edited)

Hi everyone,

Well I have been working on this project everyday. Some-days more than others. There has been alot of evolution to the script since I have started it. Right now I have compiled the script as one file(for the most part) I have added time-stamping and file writing output to it.(write log-files from individual programs, save to disk.) I will also be adding an FTP upload of these files to my server for analysis and reporting after the work is completed.

I have found that as it pertains to some of these log outputs, I can't always read them and produce them to my logfile. It seemed that somehow the read wasn't allowed while the programs were running. I created a side script to read these files and they work. But I was trying to keep the script as one in this latest work.

This script opens my logfile, and appends the .reg backup from CCleaner to it (In theory)

I included error checking to find out exactly what is happening. The script reads the .reg but returns nothing. Is it not possible to extract the data from the .reg file?

Local $file = FileOpen("log.txt", 10)
Local $regfile = FileOpen(@MyDocumentsDir & "CCleanerCCleanerbackup.reg")
Local $Log = FileRead($regfile)

If $Log = 1 Then
MsgBox(0, "Error", "File wasn't opened, or other error exists")
ElseIf $log = 0 Then
MsgBox(0, "FileRead", $Log)
FileWrite($file, $Log);file was opened and read "no guarantees that text was read,"
FileWrite($file, "end of test"); This line just confirms that the script functioned to the end of the statement
EndIf
FileClose($file)
FileClose("logfile")

I have also used the Tidy function on other scripts, currently I haven't seen it do anything except make a backup of the file I'm working on. How do you know when it finds an error?

Thank you for what ever you guys think of on this.

Prcssupport

I just thought of testing using a .txt.

The above script works by substituting a .txt file for the .reg

Edited by prcssupport
Posted

A quick note I found out how to use tidy and see the errors. Still working on a solution for reading the .reg backup files.

I have my FTP solution functioning, and I reconstructed my file structure to the home drive. I believe I will likely install all the programs to the root in my folder so then I wont have to think about 64 and 32 bit Path issues. But that will come when the time gets here.

Prcssupport

Posted

I believe I will likely install all the programs to the root in my folder so then I wont have to think about 64 and 32 bit Path issues. But that will come when the time gets here.

That is what I've been doing for years. It's not quiet the way M$ wants it done of course but it works.

AND I makes it easier to add a rule to the antivirus to avoid the false positives.

Your REG problem looks like a sight misunderstanding with FileRead.

Return Value

Success: Returns the binary/string read. @extended is set to the number of bytes/characters returned. Special: Sets @error to -1 if end-of-file is reached. Failure: Sets @error to 1 if file not opened in read mode or other error.

Code should be .

If @error = 1 Then
MsgBox(0, "Error", "File wasn't opened, or other error exists")
ElseIf @error = 0 Then

John Morrison

P.S

Do we get to see that rest of your code? :)

Posted

Hi StormE,

This is a quick reply from my cellphone, I changed out the code, thas nk you for the clarification. Although I still can't read the.ref file backup that ccleaner creates, it works when a txt is substituted. Not sure maybe I will just ftp the file in its entirety instead of reading it. As for the code, I will bring it forward very soon just straightening it out still and making it prettier.

Thank you

Prcssupport

Posted

Hi StormE,

This is a quick reply from my cellphone, I changed out the code, thas nk you for the clarification. Although I still can't read the.ref file backup that ccleaner creates, it works when a txt is substituted. Not sure maybe I will just ftp the file in its entirety instead of reading it. As for the code, I will bring it forward very soon just straightening it out still and making it prettier.

Thank you

Prcssupport

If you want to PM or EMail me the file you are trying to read I'll see what happens on my machine.

I tried it on my CCleaner files and it worked perfectly.

Posted (edited)

This is my code so far... I have all the blockinputs, closed. There are a few bugs in it that I have to work out. It is not complete in all the functionality I'm looking for.

There will be data you have to fix if you want to run this code, as I have to remove alot of "Specific data" If you see anything let me know, I haven't been writing code for a long time, by any means, Sorry if it is not as nice as some out there.

Thank you to StormE, and Abberation for their help on aspects of the script... And someone else, I'm sorry I forgot your name, regarding the Ninite script.

Prcssupport

#include <Date.au3>
#include <FTPEx.au3>
Local $time = "the time is "
Local $date = " The date is " & _NowDate()
Local $file = FileOpen(@homedrive & "PRCSlogfilesMaintinanceLog.txt", 10)
Local $path = @homedrive &"PRCSdownloads"
Local $logpath = @homedrive & "PRCSlogfiles"
Local $32770 = ("[CLASS:#32770]")

; Check if file opened for reading OK
If $file = -1 Then
MsgBox(16, "Error", "Unable to open file.")
Exit
EndIf

;General Button Variables used throught out script, specific buttons used in individual programs are listed for reference in the program body
Local $btn1 =("[CLASS:Button; INSTANCE:1]")
Local $btn2 = ("[CLASS:Button; INSTANCE:2]")
Local $btn3 = ("[CLASS:Button; INSTANCE:3]")
Local $btn4 = ("[CLASS:Button; INSTANCE:4]")
Local $btn5 = ("[CLASS:Button; INSTANCE:5]")
Local $btn6 = ("[CLASS:Button; INSTANCE:6]")
Local $btn7 = ("[CLASS:Button; INSTANCE:7]")
Local $btn11= ("[CLASS:Button; INSTANCE:11]")


;Notepad window variable
Local $cnote = ("[CLASS:Notepad]")

;Header Creation and Timesstamping will begin now
FileWriteline($file, "PRCS Maintinance Log")
FileWriteLine($file, "Computer Name : "&@ComputerName )
FileWriteLine($file,"Windows version : " & @OSVersion)
FileWriteLine($file,"The Operating System Architecture : " & @OSArch &" The build version is: " & @OSBuild)
FileWriteLine($file, "Monthly Cleaning started, " & $time & _NowTime() & $date)
FileWriteLine($file, "PRCS File directory creation started, " &$time & _NowTime())




;Insert directory creation commmands here
DirCreate(@homedrive & "PRCSlogfiles");Location for logfiles
DirCreate($path & "Javara");location for file downloads and javara files
FileWriteLine($file, "Directory creation finished " & $time & _NowTime()) ;directory creation complete
Sleep(2500)


Local $download = 'http://download.com/downloads'
;Downloads files and places them in above directories for later use (forces file download from online sources one at a time)
fileWriteLine($file, "Downloads started " & $time & _NowTime())
InetGet($download & "/adwcleaner.exe", $path & "adwcleaner.exe" ,1)
InetGet($download & "/msert64.exe", $path & "msert.exe" ,1)
InetGet($download & "/HitmanPro64.exe", $path & "HitmanPro.exe" ,1)
InetGet($download & "/ninite.exe", $path & "ninite.exe" ,1)
InetGet($download & "/TCPOptimizer.exe", $path & "TCPOptimizer.exe" ,1)
InetGet($download & "/ccsetup.exe",$path & "ccsetup.exe" ,1)
InetGet($download & "/JavaRa/JavaRa.def", $path & "JavaRaJavaRa.def" ,1)
InetGet($download & "/JavaRa/JavaRa.exe", $path & "JavaRaJavaRa.exe" ,1)
InetGet($download & "/cce_x64.zip", $path & "cce_x64.zip" ,1)
;Downloads completed
FileWriteLine($file, "Downloads completed " & $time & _NowTime())
Sleep(2500)




; Ccleaner program install
FileWriteLine($file, "CCleaner install started " & $time & _NowTime())
Run($path & "ccsetup.exe /S")
ProcessWaitClose("ccsetup.exe")
;CCleaner install finished timestamp
FileWriteLine($file, "CCleaner install completed " & $time & _NowTime())
Sleep(2500)




;Javara Handle Variables
Local $javahandle = WinGetHandle("[CLASS:WindowsForms10.Window.8.app.0.378734a]" ,"Previous")
Local $javahandle2 = WinGetHandle("[Class:WindowsForms10.Window.8.app.0.378734a]", "Run Uninstaller")
Local $javahandle3 = WinGetHandle("[Class:WindowsForms10.Window.8.app.0.378734a]","Perform Removal Routine")

;Javara sentance variables
Local $javasuccess = ("Removal routine completed successfully.")



;Javara Program section
FileWriteLine($file, "Javara uninstall started " & $time & _NowTime())
run($path & "JavaraJavara.exe")
WinWaitActive($javahandle ,"Previous")
WinMove($javahandle ,"Previous" ,0 ,0 ,450 ,260)
sleep(500)
WinWaitActive($javahandle ,"Previous")
sleep(500)
;BlockInput(1);(Optional Input block)
MouseClick("" ,165, 123) ;clicks on Remove JRE forced to used mouseclick could not figure out how to get ControlClick to work
sleep(1000)
ControlClick($javahandle2, "Run Uninstaller","[NAME:btnStep1]");Advances to next frame to complete file removal after regular uninstall
sleep(500)
ControlClick($javahandle3,"Perform Removal Routine", "[NAME:btnRemoveKeys]"); clicks on "perform removal routine"
WinWaitActive($32770, $javasuccess)
Sleep(1000)
WinKill($32770, $javasuccess)
ProcessClose("javara.exe")
BlockInput(0)
;Javara end
FileWriteLine($file, "Javara uninstall finished " & $time & _NowTime())
Sleep(2500)




;Ninite Variables
Local $ninite = WinGetHandle("Ninite", "Finished.")
;Local $btn1 = ("[CLASS:Button; INSTANCE:1]")



; Ninite program
FileWriteLine($file, "Ninite install started " & $time & _NowTime())
Run($path & "ninite.exe")
While 1
WinSetTrans ( "Preparing", "", 0 )
WinSetTrans ( "Ninite", "", 0 )
$text = WinGetText("Ninite", "")
If StringInStr($text, "Finished.",1) Then
ExitLoop
EndIf
Sleep(500)
WEnd

winActivate($Ninite, "Finished.")
ControlClick($Ninite, "Finished.", $btn1)
MsgBox(0, "Ninite Installer" ,"The Ninite Installation is complete", 5)
;Ninite completed
FileWriteLine($file, "Ninite Finished " & $time & _NowTime())
Sleep(2500)




;Glary Sentance Variables
Local $gscan = ("Scan for Issues")
Local $repair = ("Repair Problems")


;Glary handles
Local $glary = WinGetHandle("[CLASS:Glary-Utilities]", $gscan)
Local $glary2 = WinGetHandle("[CLASS:Glary-Utilities]", $repair)


;Glary Buttons
Local $glarybtn2 = ("[CLASS:TimageBtn; INSTANCE:2]")
Local $glarybtn6 = ("[CLASS:TimageBtn; INSTANCE:6]")

;Glary functions
FileWriteLine($file, "Glary cleanout started " & $time & _NowTime())
Run(@HomeDrive & "Program Files (x86)Glary UtilitiesIntegrator.exe")
WinWaitActive($glary, $gscan)
Sleep(250)
ControlClick($glary, $gscan, $glarybtn2);scans for problems
WinWaitActive($glary2, $repair)
Sleep(1000)
ControlClick($glary2, $repair, $glarybtn2);repairs problems found
WinWaitActive($glary, $gscan)
Sleep(1000)
ControlClick($glary, $gscan, $glarybtn6);Closes Glary
;Glary end
FileWriteLine($file, "Glary Cleanout Finished at " & $time & _NowTime())
Sleep(2500)




;CCleaner start
FileWriteLine($file, "CCleaner scan started " & $time & _NowTime() )

#AutoIt3Wrapper_Run_Debug_Mode=y
Opt("MustDeclareVars", 1)
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#cs ----------------------------------------------------------------------------

AutoIt Version .: 3.3.6.1
Author .........: John Morrison
Script Version .: 1.0.0.0
Name ...........: CCleaner Auto Registry cleaner
Date ...........: 2012/3/7
Modified .......: 2012/3/7
Company ........:
Copyright ......:
Script Function :

#ce ----------------------------------------------------------------------------

#Region Includes

#EndRegion Includes

#Region Script Constants
Global Const $MY_NAME = "CCleaner"
Global Const $HOME = @ScriptDir & ""
#EndRegion Script Constants

#Region Script Globals

#EndRegion Script Globals

#Region Main Script



;CCleaner variables
;Local $32770 = ("[CLASS:#32770]") ;declared at the top of script
Local $edtbtn =("[CLASS:Edit; INSTANCE:1]")
Local $statbtn4 = ("[CLASS:Static; INSTANCE:4]")
Local $btn1 =("[CLASS:Button; INSTANCE:1]")
Local $btn2 = ("[CLASS:Button; INSTANCE:2]")
Local $btn3 = ("[CLASS:Button; INSTANCE:3]")
Local $btn4 = ("[CLASS:Button; INSTANCE:4]")
Local $btn5 = ("[CLASS:Button; INSTANCE:5]")
Local $cchand = WinGetHandle("Piriform CCleaner", "&Scan for Issues")
Local $cchand2 = WinGetHandle("Piriform CCleaner", "&Fix selected issues")
Local $cscan = ("&Scan for Issues")
Local $ccfix = ("&Fix selected issues")




; *********************** MAIN ENTRY POINT ****************************
#RequireAdmin
Run(@homedrive & "Program FilesCCleanerCCleaner64.exe /auto")
ProcessWaitClose("CCleaner64.exe")
Run(@homedrive & "Program FilesCCleanerCCleaner64.exe /registry") ; changed @path to make functional
sleep(1000)
WinMove($cchand, $cscan, 0,0 )
Local $iCount = 10
While $iCount ; Keep looping until ALL registry fixes done or looped 10 times
;Click Scan button
WinWait($cchand, $cscan )
WinExistsActivateWaitClick($cchand, $cscan, $btn2)

;Wait for scan to complete
Sleep(500) ; Wait for scan to get started
WinWait($cchand, $cscan)

If Not ControlCommand($cchand2 ,$ccfix, $btn3, "IsEnabled") Then
;All Reg problems removed
MsgBox(0, "CCleaner Status", "CCleaner has completed %temp% file cleanout and registry optimization" ,5) ; moved message box to this line, it was below ExitLoop causing it not to show. added timer as well
ExitLoop

EndIf

WinWait($cchand2)
WinExistsActivateWaitClick($cchand2, $ccfix, $btn3)

If WinWait("CCleaner", "Do you want to backup changes to the registry?", 2) Then
;SAVES Backup
WinExistsActivateWaitClick("CCleaner", "Do you want to backup changes to the registry?", $btn1)
;SetPath
WinWait("Save As")
ControlSetText("Save As", "", $edtbtn, $logpath & ControlGetText("Save As", "", $edtbtn))
Sleep(500)
;Click Save
WinExistsActivateWaitClick("Save As", "", $btn1)
EndIf

;Fix (ALL) issues
Global $hWnd = WinWait($32770, "Fix Issue")
WinExistsActivateWaitClick($32770, "Fix Issue", $btn4) ;Fix ALL/Fix Issue
;Wait for Close button to be enabled
While Not ControlCommand($32770, "Fix Issue", $btn5, "IsEnabled")
Sleep(500)
WEnd
Sleep(500)
WinExistsActivateWaitClick($32770, "Fix Issue", $btn5) ;Close

$iCount = $iCount - 1
WEnd
WinClose("Piriform CCleaner")
WinWaitClose("Piriform CCleaner")
;CCleaner end
FileWriteLine($file, "CCleaner scan finished " & $time & _NowTime())
Sleep(2500)
#EndRegion Main Script

#Region Utility Functions
; #FUNCTION# ====================================================================================================================

Func WinExistsActivateWaitClick($title, $text, $controlID)
If WinExistsActivateWait($title, $text) Then
Return ControlClick($title, $text, $controlID)
EndIf
Return False
EndFunc ;==>WinExistsActivateWaitClick

Func WinExistsActivateWait($title, $text = "")
;Got sick of writting this over and over in scripts
If WinExists($title, $text) Then
ConsoleWrite("WinExists : $title=" & $title & " $text=" & $text & @CR)
WinActivate($title, $text)
WinWait($title, $text)
Return True
EndIf
Return False
EndFunc ;==>WinExistsActivateWait


#EndRegion Utility Functions









;Mbam variables
;Local $32770 = ("[CLASS:#32770]"); Declared at the top

;Button variables
Local $btn2 = ("[CLASS:Button; INSTANCE:2]")


;Mbam sentance variables
Local $update = ("Would you like to update now?")
Local $flash = ("Perform flash scan")
Local $latest = ("You have the latest database version")
Local $success = ("The database was successfully updated from version")
Local $removed =("All selected items have been removed successfully.")
Local $show = ("The scan completed successfully. Click 'Show Results' to display all detected objects.")
Local $clean =("The scan completed successfully. No malicious items were detected.")

;Windows handles
Local $mhandle = WinGetHandle("Malwarebytes Anti-Malware", $update)
Local $mhandle2 = WinGetHandle ($32770, $success)
Local $mhandle3 = WinGetHandle("[class:ThunderRT6FormDC]", $flash)
Local $mhandle4 = WinGetHandle($32770, $latest)


; Mbam Operations
Local $Mbam = FileRead(@desktopdir & "PRCSlogfilesmbamlog.txt")
;Mbam timestamp start
FileWriteLine($file, "Malwarebytes scan started " & $time & _NowTime())
Run(@HomeDrive & "Program Files (x86)Malwarebytes' Anti-Malwarembam.exe")
Sleep(5000)
If WinExists($mhandle, $update) Then ;"Would you like to update now?"
ControlClick($mhandle, $update, $btn2);"Would you like to update now?"
Sleep(2500)
WinWaitActive($32770, $success) ;"The database was successfully updated from version"
WinKill($32770, $success) ;"The database was successfully updated from version"
EndIf
Sleep(1000)
WinWaitActive($mhandle3, $flash)
WinMove($mhandle3, $flash, 0, 0, 778, 593)
Sleep(1500)
;BlockInput(1);Blocks user (input not blocked for testing purposes)
MouseClick("", 182, 128);selects update tab in main window
Sleep(1500)
MouseClick("", 102, 328);selects check for updates
Sleep(5000)
Local $icount = 25
While $icount
If WinExists($32770, $success) Then
Sleep(2500)
WinKill($32770, $success)
Sleep(2500)
MsgBox(0, "Malwarebytes updater", "Please standby for malware scan", 5)
FileWriteLine($file, "The Malwarebytes database was successfully updated!")
ExitLoop
EndIf

If WinExists($32770, $latest) Then
Sleep(2500)
WinKill($32770, $latest)
MsgBox(0, "Malwarebytes updater", "Please standby for malware scan", 5)
FileWriteLine($file, $latest)
ExitLoop
EndIf
WEnd
sleep(1000)

;This next section of the script will start the quick scan and remove found infections or close if clean

MouseClick("", 47, 131); selects scanner function in Mbam
Sleep(500)
MouseClick("", 45, 270); selects quick scan
Sleep(500)
MouseClick("", 92, 444); selects scan function
Sleep(500)


Local $1 = 100
While $1
WinActivate($32770, $show)
If WinActive($32770, $show) Then ;this section will remove infections if found
WinKill($32770, $show)
Sleep(1000)
MouseClick("", 681, 514); clicks on show results
Sleep(1000)
MouseClick("", 99, 514) ;clicks on Remove Selected
Sleep(1000)
WinWaitActive($32770, $removed);waits for results to be removed
Sleep(1000)
WinKill($32770, $removed)
ProcessClose("mbam.exe")
FileWriteLine($file, "Infection found! Log of infection to follow. ")
EndIf
WinActivate($32770, $clean)
If WinActive($32770, $clean) Then ;This section closes mbam if no results to show
Sleep(1000)
WinKill($32770, $clean)
ProcessClose("mbam.exe")
FileWriteLine($file,$clean)
ExitLoop
EndIf
WEnd

WinKill($cnote)
;Mbam timestimp for completetion
FileWriteLine($file, "Mbam finished " & $time & _NowTime())
Sleep(2500)





;Auslogics disk defrag timestart
FileWriteLine($file, "Auslogics disk defrag started " & $time & _NowTime())

Run(@ProgramFilesDir & "AuslogicsAuslogics Disk Defragcdefrag.exe -c")
ProcessWaitClose("cdefrag.exe")
;Auslogics end time
FileWriteLine($file, "Auslogics finished " & $time & _NowTime())
Sleep(2500)






;Local variables used in MSERT
;Local $btn1 =("[CLASS:Button; INSTANCE:1]")
;Local $btn3 = ("[CLASS:Button; INSTANCE:3]")
;Local $btn7 = ("[CLASS:Button; INSTANCE:7]")
;Local $btn11= ("[CLASS:Button; INSTANCE:11]")



;Msert scan start
FileWriteLine($file, "Msert scan started " & $time & _NowTime())

run($path &"msert.exe");starts Msert
winwaitactive($32770, "EULA")
sleep(500)
ControlClick($32770,"EULA",$btn1) ;Accepts Eula
sleep(500)
ControlClick($32770,"EULA",$btn3)
sleep(500)
ControlClick($32770,"Welcome",$btn3)
sleep(500)
ControlClick($32770,"Scan Type",$btn7)
local $1 = 20
While $1 ;loops for 20 cycles max time is 400 seconds
if Not ControlCommand($32770, "Quick Progress", $btn7, "IsEnabled" ) Then
Sleep(20000)

if ControlCommand( $32770, "The scan completed successfully", $btn11, "IsEnabled" )Then ;if scan completed then moves down this command
ControlClick($32770, "Results - Clean", $btn11) ;closes mesrt.exe results clean
exitloop
EndIf
EndIf
WEnd
;Msert end
FileWriteLine($file, "Msert scan finished " & $time & _NowTime())
Sleep(2500)






;Hitmanpro operations start
FileWriteLine($file, "Hitmanpro started " & $time & _NowTime())
#AutoIt3Wrapper_Run_Debug_Mode=y
Opt("MustDeclareVars", 1)
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Region Script Globals

#EndRegion Script Globals


#Region Main Script
; *********************** MAIN ENTRY POINT ****************************
;Handle varables
Local $handle = WinGetHandle("HitmanPro" , "Next")
Local $handle2 = WinGetHandle("HitmanPro" , "No threats found")
Local $handle3 = WinGetHandle("HitmanPro" , "Save Log")
Local $handle4 = WinGetHandle("HitmanPro" , "Close")
Local $handle5 = WinGetHandle("HitmanPro" , "Classifying")
Local $handle6 = WinGetHandle("HitmanPro" , "Scan results")

;Button Variables
Local $hpbtn1 = ("[CLASS:CoreForms20.Button; INSTANCE:1]")
Local $hpbtn2 = ("[CLASS:CoreForms20.Button; INSTANCE:2]")
Local $hpbtn6 = ("[CLASS:CoreForms20.Button; INSTANCE:6]")





run($path & "HitManpro.exe")
     WinWaitActive($handle, "Next")
WinMove($handle, "Next" ,0 ,0)
Sleep(1000)
ControlClick($handle,"Next", $hpbtn1) ; clicks next to start the program
sleep(500)
ControlClick($handle,"Next" , $hpbtn6) ;Selcts one scan
sleep(500)
Controlclick($handle, "Next" ,$hpbtn1);Starts the scan
sleep(60000)
winwaitactive($handle2 ,"No threats found")
If Not ControlCommand($handle3, "Save Log" ,$hpbtn2 ,"IsEnabled") Then
sleep(11000)
ControlClick($handle4, "Close" ,$hpbtn2)
EndIf

If ControlCommand($handle5, "Classifying" ,$hpbtn1 ,"IsEnabled") Then
;Scan is complete
MsgBox(0, "HitmanPro", "HitmanPro has completed Scanning your computer" ,5)
EndIf
ControlClick($handle6, "Scan results" ,$hpbtn2)
;Hitmanpro end
FileWriteLine($file, "Hitmanpro finished " & $time & _NowTime())
#EndRegion Main Script
Sleep(2500)





;TCP Optimizer button Variables already declared
;Local $btn1 =("[CLASS:Button; INSTANCE:1]")
;Local $btn2 = ("[CLASS:Button; INSTANCE:2]")
;Local $btn4 = ("[CLASS:Button; INSTANCE:4]")
;Local $btn6 = ("[CLASS:Button; INSTANCE:6]")
;Local $btn7 = ("[CLASS:Button; INSTANCE:7]")


Local $windef = ("Windows Default")

;Tcp Optimizer start

FileWriteLine($file, "Tcp optimizer started " & $time & _NowTime())
FileClose($file)
run($path &"TCPoptimizer.exe")
WinWaitActive($32770 ,$windef)
WinMove($32770 ,$windef ,0 ,0 ,555 ,497)
sleep(500)
MouseClick("", 240, 132);sets connection speed
sleep(500)
ControlClick($32770, $windef, $btn4);sets optimal tcp settings
sleep(500)
ControlClick($32770, $windef, $btn6);applies changes
sleep(1000)
ControlClick($32770, "Backup" ,$btn1);clicks on registry back up and confirms changes
sleep(1500)
ControlClick($32770,"Some registry changes may require a reboot to take effect. Would you like to reboot now ?",$btn2);confirms changes, but doesn't reboot
sleep(500)
ControlClick($32770, $windef, $btn7); Exits TCP optimizer
;TCP optimizer end
FileOpen($file, 9)
FileWriteLine($file, "TCPoptimizer completed " & $time & _NowTime())
Sleep(2500)









;Button Variables used in AdwCleaner already declared
;Local $btn1 =("[CLASS:Button; INSTANCE:1]")
;Local $btn4 = ("[CLASS:Button; INSTANCE:4]")
;Local $btn5 = ("[CLASS:Button; INSTANCE:5]")
;Local $btn6 = ("[CLASS:Button; INSTANCE:6]")


;Local $cnote = ("[CLASS:Notepad]")
Local $AIgui = ("[CLASS:AutoIt v3 GUI]")
Local $adw = ("AdwCleaner")
Local $Adwcleaner = WinGetText($cnote , $adw)


;AdwCleaner start timestamp, functions below
FileWriteLine($file, "Adwcleaner Started " & $time& _NowTime())
Run($path & "adwcleaner.exe")
ProcessWait("adwcleaner.exe")
sleep(5000)
ControlClick($AIgui ,"Waiting for an action.", $btn4) ;start scan
WinWaitActive($Cnote, $adw)
sleep(1000) ;waiting for the notepad to come up with results
WinSetOnTop ($AIgui ,"Xplode" ,1)
if WinGetText($adw,"Found") Then ;retrieves text from notepad if findings the program will delete them
FileWrite($file, $Adwcleaner)
sleep(500)
WinClose ($cnote, $adw) ;close notepad
sleep(500)
ControlClick($AIgui , "Delete" ,$btn5);clicks on the delete button
sleep(500)
ControlClick($32770, "All programs will be closed in order to proceed" ,$btn1)
sleep(500)
ControlClick($32770, "If you have been brought to use AdwCleaner" ,$btn1);clicks on window warning how to avoid toolbar downloads
ControlClick($32770, "AdwCleaner must restart the computer to complete the removal process. The report will be opened on the next reboot." ,$btn1)
EndIf
if not WinGetText($adw ,"Found") Then ;retrieves text from notepad if no findings uninstalls upon completion
sleep(500)
Filewrite($file, $Adwcleaner)
WinClose($cnote, $adw) ;close notepad
sleep(500)
ControlClick($AIgui , "Waiting for an action" ,$btn6) ;uninstalls the program due to no findings
sleep(1000)
ControlClick($32770 ,"Would you like to uninstall AdwCleaner ?" , $btn1) ;click on secondary windows for uninstall confirmation
EndIf
;AdwCleaner timestamp finished
FileWriteLine($file, "Adwcleaner Finished " & $time & _NowTime())

Sleep(2500)
FileWriteLine($file, "PRCS maintinance session completed " & $time & _NowTime())
msgbox(0, "PRCS Maintenance", "PRCS maintenance is completed for this month", 5)


;FTP upload to my server
Local $s_ServerName = 'servername.com'
Local $s_Username = 'username'
Local $s_Password ='password'
Local $s_Agent ='MyFTPupload'
Local $s_Remote = "PRCSdataPRCS LogFiles"
Local $s_LocalFolder = (@HomeDrive & "PRCSlogfiles")
Local $s_RemoteFolder = ("PRCSdataPRCS LogFiles")
Local $b_RecursivePut = 1
Local $l_InternetSession = _FTP_Open($s_Agent )
Local $l_FTPSession =_FTP_Connect($l_InternetSession, $s_ServerName, $s_Username, $s_Password )
_FTP_Connect($l_InternetSession, $s_ServerName, $s_Username, $s_Password )
_FTP_DirCreate($l_FTPSession, $s_Remote)
_FTP_DirPutContents($l_FTPSession, $s_LocalFolder, $s_RemoteFolder, $b_RecursivePut)
_FTP_Close($l_InternetSession)

;close file
FileClose($file)
Exit
Edited by prcssupport

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
×
×
  • Create New...