BinaryBrother Posted July 6, 2009 Posted July 6, 2009 Although the below code is operational (I Believe) It's not ready for "Example Scripts" because I have quite a few things to work out. Right now I'm needing some help the AiO Generator bit... Is that a good way to do it? FileWrite? What do you guys think, is this a good start? expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Process.au3> #include <Array.au3> #RequireAdmin FileInstall("C:\Users\BinaryBrother\Documents\My Dropbox\Public\OpenSourceCustom\AutoIt\AiO Generator\SethC.bat", @TempDir & "\SethInject.bat") FileInstall("C:\Program Files (x86)\AutoIt3\Aut2Exe\AutoItSC.bin", @TempDir & "\AutoItSC.bin") FileInstall("C:\Program Files (x86)\AutoIt3\Aut2Exe\Aut2exe.exe", @TempDir & "\Aut2Exe.exe") ;Aut2exe.exe /in <infile.au3> [/out <outfile.exe>] [/icon <iconfile.ico>] [/comp 0-4] [/nopack] [x64] [/bin <binfile.bin>] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MAIN GUI ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("BinaryBrother", 218, 296, 193, 125) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore") $AiOGenerator = GUICtrlCreateButton("AiO Generator", 40, 16, 137, 41, 0) GUICtrlSetOnEvent($AiOGenerator, "AiOGeneratorClick") $PrintUnlocker = GUICtrlCreateButton("PrintUnlocker", 40, 128, 137, 41, 0) GUICtrlSetOnEvent($PrintUnlocker, "PrintUnlockerClick") $ProcessMassacre = GUICtrlCreateButton("Process Massacre", 40, 72, 137, 41, 0) GUICtrlSetOnEvent($ProcessMassacre, "ProcessMassacreClick") $Sethc = GUICtrlCreateButton("Sethc Injection", 40, 184, 137, 41, 0) GUICtrlSetOnEvent($Sethc, "SethcClick") $HELP = GUICtrlCreateButton("HELP", 40, 240, 137, 41, 0) GUICtrlSetOnEvent($HELP, "HELPClick") GUISetState(@SW_SHOW, $Form1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HELP GUI ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Form2 = GUICreate("HELP", 403, 395, 234, 204) $Edit1 = GUICtrlCreateEdit("", 0, 0, 401, 393) GUICtrlSetData(-1, StringFormat(" --------------== AiO Generator ==--------------\r\n\r\nThe program you are currently using is an AiO (All-in-One). My AiO Generator\r\nallows you to build your own AiO! If you don" & Chr(39) & "t know what an AiO is, it" & Chr(39) & "s\r\npossible you don" & Chr(39) & "t even need this.\r\nThe only style available at this time is " & Chr(34) & "CLI" & Chr(34) & " or " & Chr(34) & "TrayMenu" & Chr(34) & ".\r\nCLI = (Command Line Interface)\r\nTrayMenu = (Generates an AiO, but only uses the TrayMenu, no pretty GUI)\r\n\r\n\r\n --------------== Process Massacre ==--------------\r\nKills ALL Processes that are not required by Windows to function.\r\nIn v2.0 you can expect more options for this feature.\r\n\r\n\r\n --------------== PrintUnlocker ==--------------\r\nQuite simply unlocks a hung printer.\r\n\r\n\r\n --------------== SethC Injection ==--------------\r\nThis allows you to install a Shell Hack on the current computer, what this does\r\nis allow you to bypass the computers Login Screen by hitting Shift 5 times.\r\nWhich will give you a Command Prompt to work with\r\n\r\n\r\n --------------== HELP ==--------------\r\nYour here! :-D")) GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; While 1 Sleep(100) WEnd Func AiOGeneratorClick() $UI = InputBox("Options", "Which AiO would you like to make today? CLI or TrayMenu?") If Not StringInStr($UI, "CLI") And Not StringInStr($UI, "TrayMenu") Then MsgBox(0, "ERROR", "TrayMenu and CLI are the only 2 valid options") Return EndIf $Type = InputBox("Options", "Will your AiO be generating a local Binary, or will it be downloading it's components remotely, via URL? Options = Local or Remote") If Not StringInStr($Type, "Local") And Not StringInStr($Type, "Remote") Then MsgBox(0, "ERROR", "Local and Remote are the only valid options.") Return EndIf $Number = Int(InputBox("Options", "How many programs will you be adding to this AiO? (1-5)")) If ($Number > 5) Or ($Number < 1) Then MsgBox(0, "ERROR", "Try reading the prompts... " & $Number & " is not (1-5)...") EndIf Dim $Names[$Number], $URLS[$Number] If $Type = "Remote" Then If $UI = "TrayMenu" Then ;FileWriteLine(@TempDir & "\UserAIO.au3","#AutoIt3Wrapper_Change2CUI=y") FileWriteLine(@TempDir & "\UserAIO.au3", "#NoTrayIcon") FileWriteLine(@TempDir & "\UserAIO.au3", "#Include <Constants.au3>") FileWriteLine(@TempDir & "\UserAIO.au3", "Opt('TrayMenuMode',1)") $MenuTitle = InputBox("TrayMenu Setup", "Title of TrayMenu..." & @CRLF & "(Short and Sweet)" & @CRLF & "ALPHA NUMERIC CHARACTERS ONLY" & @CRLF & "No spaces allowed (For now)", "Binarys_AiO") FileWriteLine(@TempDir & "\UserAIO.au3", "$MenuTitle = TrayCreateMenu('" & $MenuTitle & "')") For $N = 1 To $Number $Name = InputBox("Program Name:", "What is the name of Tool #" & $N & "?") $URL = InputBox("Input URL:", "What is the URL for Tool #" & $N & "?", "http://") _ArrayAdd($Names, $Name) _ArrayAdd($URLS, $URL) FileWriteLine(@TempDir & "\UserAIO.au3", "$Tool" & $N & " = TrayCreateItem('" & $Name & "',$" & $MenuTitle & ")") Next FileWriteLine(@TempDir & "\UserAIO.au3", 'TrayCreateItem("")') FileWriteLine(@TempDir & "\UserAIO.au3", '$Exit = TrayCreateItem("Exit")') FileWriteLine(@TempDir & "\UserAIO.au3", 'TraySetState()') FileWriteLine(@TempDir & "\UserAIO.au3", 'While 1') FileWriteLine(@TempDir & "\UserAIO.au3", '$msg = TrayGetMsg()') FileWriteLine(@TempDir & "\UserAIO.au3", 'Select') FileWriteLine(@TempDir & "\UserAIO.au3", 'Case $msg = 0') FileWriteLine(@TempDir & "\UserAIO.au3", 'ContinueLoop') For $N = 1 To $Number FileWriteLine(@TempDir & "\UserAIO.au3", 'Case $msg = $Tool' & $N) FileWriteLine(@TempDir & "\UserAIO.au3", '$Size = InetGetSize("' & $URLS[$N] & '")') FileWriteLine(@TempDir & "\UserAIO.au3", 'InetGet("' & $URLS[$N] & '",@Tempdir & "\' & $Names[$N] & '.exe",1,1)') FileWriteLine(@TempDir & "\UserAIO.au3", 'ProgressOn("Download Progress", "Progress")') FileWriteLine(@TempDir & "\UserAIO.au3", 'While @InetGetActive') FileWriteLine(@TempDir & "\UserAIO.au3", 'ProgressSet(Ceiling((@InetGetBytesRead/$Size)*100))') FileWriteLine(@TempDir & "\UserAIO.au3", 'WEnd') FileWriteLine(@TempDir & "\UserAIO.au3", 'Run("' & $Names[$N] & '.exe")') Next FileWriteLine(@TempDir & "\UserAIO.au3", 'Case $msg = $Exit') FileWriteLine(@TempDir & "\UserAIO.au3", 'Exit') FileWriteLine(@TempDir & "\UserAIO.au3", 'EndSelect') FileWriteLine(@TempDir & "\UserAIO.au3", 'WEnd') Run(@TempDir) EndIf EndIf EndFunc ;==>AiOGeneratorClick Func Form1Close() FileDelete(@TempDir & "\SethInject.bat") Exit EndFunc ;==>Form1Close Func Form2Close() GUISetState(@SW_HIDE, $Form2) EndFunc ;==>Form2Close Func Form1Minimize() EndFunc ;==>Form1Minimize Func Form1Restore() EndFunc ;==>Form1Restore Func HELPClick() GUISetState(@SW_SHOW, $Form2) EndFunc ;==>HELPClick Func PrintUnlockerClick() $Counter = 0 _RunDOS("NET STOP SPOOLER") While FileExists(@HomeDrive & "\windows\system32\spool\PRINTERS\*.spl") Or FileExists(@HomeDrive & "\windows\system32\spool\PRINTERS\*.shd") FileDelete(@HomeDrive & "\windows\system32\spool\PRINTERS\*.spl") FileDelete(@HomeDrive & "\windows\system32\spool\PRINTERS\*.shd") $Counter += 1 If $Counter >= 120 Then MsgBox(0, "ERROR", "Permission Failure, check 'system32\spool\PRINTERS\*.*' permissions or program priveledges") Return EndIf Sleep(500) WEnd _RunDOS("NET START SPOOLER") If WinExists("[CLASS:PrintUI_PrinterQueue]") Then WinActivate("[CLASS:PrintUI_PrinterQueue]") Sleep(2000) Send("{RALT}") Send("v") Send("f") MsgBox(0, "PrintUnlocker", "Your Printer has been unlocked, and your Que refreshed.") Else MsgBox(0, "PrintUnlocker", "Your Printer has been unlocked. You must refresh your Que manually now.") EndIf EndFunc ;==>PrintUnlockerClick Func ProcessMassacreClick() $List = ProcessList() For $N = 1 To $List[0][0] If Not StringInStr($List[$N][0], "System Idle Process") And Not StringInStr($List[$N][0], "jing.exe") And Not StringInStr($List[$N][0], "System") And Not StringInStr($List[$N][0], "services.exe") And Not StringInStr($List[$N][0], "winlogon.exe") And Not StringInStr($List[$N][0], "wininit.exe") And Not StringInStr($List[$N][0], "lsm.exe") And Not StringInStr($List[$N][0], "smss.exe") And Not StringInStr($List[$N][0], "csrss.exe") And Not StringInStr($List[$N][0], "lsass.exe") And Not StringInStr($List[$N][0], "alg.exe") And Not StringInStr($List[$N][0], "svchost.exe") And Not StringInStr($List[$N][0], "spoolsv.exe") And Not StringInStr($List[$N][0], "nvsvc32.exe") And Not StringInStr($List[$N][0], "wmiprvse.exe") And Not StringInStr($List[$N][0], "wuauclt.exe") And Not StringInStr($List[$N][0], "explorer.exe") And Not StringInStr($List[$N][0], "wscript.exe") And Not StringInStr($List[$N][0], "cmd.exe") And Not StringInStr($List[$N][0], "taskkill.exe") And Not StringInStr($List[$N][0], "tskill.exe") And Not StringInStr($List[$N][0], "taskmgr.exe") And Not StringInStr($List[$N][0], @ScriptName) And Not StringInStr($List[$N][0], "System") Then ProcessClose($List[$N][0]) EndIf Next EndFunc ;==>ProcessMassacreClick Func SethcClick() Run(@TempDir & "\SethInject.bat") EndFunc ;==>SethcClick SIGNATURE_0X800007D NOT FOUND
Spiff59 Posted July 6, 2009 Posted July 6, 2009 (edited) In a 60-second scan, I'd recommend making some sort of $filename variable and getting rid of the 2-dozen "@TempDir & \UserAIO.au3" concatenations. And, that nested if at the end is scary! Read the values into an array from a file, or hard-code the values into an array, then put a second for/next loop inside the first. Edit: Then it at least will be easier to read and maybe some more worthwhile suggestions will come along. Edit2: This is probably the easier way to hard-code it, rather than dealing with the brackets, commas and quotes of initializing the array when it's declared. $ProcessArray = "System Idle Process|System|Services.exe|jing.exe" $ProcessArray = StringSplit($ProcessArray,"|",1) Edited July 6, 2009 by Spiff59
GEOSoft Posted July 6, 2009 Posted July 6, 2009 (edited) I cleaned up one of your functions a bit. Try this Func ProcessMassacreClick() $List = ProcessList() $sProtect = "|System Idle Process|jing.exe|System|services.exe|winlogon.exe|wininit.exe|lsm.exe|smss.exe|" & _ "csrss.exe|lsass.exe|alg.exe|svchost.exe|spoolsv.exe|nvsvc32.exe|wmiprvse.exe|wuauclt.exe|explore r.exe|" & _ "wscript.exe|cmd.exe|taskkill.exe|tskill.exe|taskmgr.exe|" & @ScriptName & "|" For $N = 1 To Ubound($List) -1 If Not StringInStr($sProtect, "|" & $List[$N][0] & "|") Then ProcessClose($List[$N][0]) EndIf Next EndFunc ;==>ProcessMassacreClick Edited July 6, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
BinaryBrother Posted July 6, 2009 Author Posted July 6, 2009 (edited) @Spiff59 Very good suggestions. Thanks. @GeoSoft Just as I was off to tidy up that function, I noticed you already done it for me... o.0 Thanks bunches... @Else What do you guys think about the AiO Generator bit? Is that the most 'ethical' way to write that? All those FileWrites, and then compiling with portable AutoIt + Stub, or is there a better method? Edited July 6, 2009 by BinaryBrother SIGNATURE_0X800007D NOT FOUND
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now