Leaderboard
Popular Content
Showing content with the highest reputation on 02/20/2016 in all areas
-
Just for fun Idea from here: http://codegolf.stackexchange.com/questions/73259/output-the-current-time-in-ascii-art Edit: Also added an analogue experimental version in post #11 #include <GUIConstants.au3> HotKeySet("{ESC}", "End") Local $hClock, $sDelim = ";", $aChar, $sScanLines, $aScanLine[6], $aFont[13] = [ _ ' ___ ; / _ \ ; | | | | ; | | | | ; | |_| | ; \___/ ', _ ; 0 ' __ ; /_ | ; | | ; | | ; | | ; |_| ', _ ; 1 ' ___ ; |__ \ ; ) | ; / / ; / /_ ; |____| ', _ ; 2 ' ____ ; |___ \ ; __) | ; |__ < ; ___) | ; |____/ ', _ ; 3 ' _ _ ; | || | ; | || |_ ; |__ _| ; | | ; |_| ', _ ; 4 ' _____ ; | ____| ; | |__ ; |___ \ ; ___) | ; |____/ ', _ ; 5 ' __ ; / / ; / /_ ; | _ \ ; | (_) | ; \___/ ', _ ; 6 ' ______ ; |____ | ; / / ; / / ; / / ; /_/ ', _ ; 7 ' ___ ; / _ \ ; | (_) | ; > _ < ; | (_) | ; \___/ ', _ ; 8 ' ___ ; / _ \ ; | (_) | ; \__, | ; / / ; /_/ ', _ ; 9 ' ; _ ;(_); _ ;(_); ', _ ; : " ; ; __ _ _ __ ;/ _` | ' \;\__,_|_|_|_|; ", _ ; am " ; ; _ __ _ __ ;| '_ \ ' \;| .__/_|_|_|;|_|"]; pm Global $hAsciiClock = GUICreate("Ascii clock", 390, 80, 10, 10, $WS_POPUPWINDOW, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE, $WS_EX_COMPOSITED)) $hClock = GUICtrlCreateLabel("", 0, 0, 390, 80, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 7, 0, 0, "Courier new") GUISetState() While 1 $sTime = StringFormat("%02s", @HOUR - (12 * (@HOUR > 12))) & "A" & @MIN & "A" & @SEC & Hex(11 + Number(@HOUR > 12), 1) For $x = 1 To StringLen($sTime) $achar = StringSplit($aFont[Dec(StringMid($sTime, $x, 1))], $sDelim, 3) For $i = 0 To 5 If $x = StringLen($sTime) Then ; last char (am or pm) $aScanLine[$i] = StringFormat('%-65s', $aScanLine[$i]) & $achar[$i] Else $aScanLine[$i] &= $achar[$i] EndIf Next Next For $i = 0 To 5 $sScanLines &= $aScanLine[$i] & @CRLF $aScanLine[$i] = "" Next GUICtrlSetData($hClock, $sScanLines) $sScanLines = "" Sleep(1000) WEnd Func End() If WinActive("[ACTIVE]") = $hAsciiClock Then Exit EndFunc ;==>End3 points
-
AuditShot - A quick endpoint interrogation
argumentum reacted to iamtheky for a topic
A simple, quick, audit tool. -Logged On Users -SystemInfo -IPconfig /All -Active Connections (Netstat) -Netstat Names -Privileged Users/Groups -Startup -Services -Processes+Svcs -Drivers (signed?) -Software -Powershell Commands -Logon Failures -All RDP Feel Free to Reply with More. **Requires PowerShell v4.0 or higher to run some of the commands , but those can be converted to WMI without much effort. ;AuditShot v1.1 -iamtheky #RequireAdmin #include<array.au3> #include<excel.au3> local $aFinal[0] $oXL = _Excel_Open(FALSE) $oXLbook = _Excel_BookNew($oXL , 13) ;----------------------------------------------------------Logged on Users--------------------------------------------------------------------------------------- $sCommand = "powershell Get-CimInstance Win32_LoggedOnUser" $iPID = run($sCommand & " | Format-List", "" , @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) $aOut = stringsplit($sOutput , @LF , 2) _Excel_RangeWrite($oXLbook , 1 , $aOut) $oXLBook.WorkSheets(1).Name = "LOGGEDON" _ArrayConcatenate($aFinal , $aOut) ;------------------------------------------------SYS INFO------------------------------------------------------------------------------------------------- $sCommand = "systeminfo" $iPID = run($sCommand, "" , @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) $aOut = stringsplit($sOutput , @LF , 2) _Excel_RangeWrite($oXLbook , 2 , $aOut) $oXLBook.WorkSheets(2).Name = "SYSINFO" _ArrayConcatenate($aFinal , $aOut) ;~ _ArrayDisplay($aFinal); ;------------------------------------------------IPCONFIG------------------------------------------------------------------------------------------------- $sCommand = "ipconfig /all" $iPID = run($sCommand, "" , @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) $aOut = stringsplit($sOutput , @LF , 2) _Excel_RangeWrite($oXLbook , 3 , $aOut) $oXLBook.WorkSheets(3).Name = "IPCONFIG" _ArrayConcatenate($aFinal , $aOut) ;~ _ArrayDisplay($aFinal); ;------------------------------------------------ACTIVE NETSTAT------------------------------------------------------------------------------------------------- $sCommand = "netstat -n" $iPID = run($sCommand, "" , @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) $aOut = stringsplit($sOutput , @LF , 2) _Excel_RangeWrite($oXLbook , 4 , $aOut) $oXLBook.WorkSheets(4).Name = "NETSTAT" _ArrayConcatenate($aFinal , $aOut) ;~ _ArrayDisplay($aFinal); ;-----------------------------------------------------NETSTAT_NAMES-------------------------------------------------------------------------------------------------- $sCommand = "netstat -n" $iPID = run($sCommand, "" , @SW_HIDE , $stdout_child) $sOutput = "" $sNSLookupOut = "" local $aNSfinal[0] local $aNSLookupFinal[0] While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) $aOut = stringsplit($sOutput , @LF , 2) For $i = 4 to ubound($aOut) - 1 $aLine = stringsplit($aOut[$i] , " " , 2) For $k = ubound($aLine) - 1 to 0 step - 1 If stringstripWS($aLine[$k] , 8) = "" Then _ArrayDelete($aLine , $k) Next ;~ msgbox(0, '' , stringleft($aLine[2] , stringinstr($aLine[2] , ":" , 0 , -1) - 1)) If ubound($aLine) > 1 Then _ArrayAdd($aNSfinal , stringleft($aLine[2] , stringinstr($aLine[2] , ":" , 0 , -1) - 1)) $aUniqueNS = _ArrayUnique($aNSfinal) _ArrayDelete($aUniqueNS , 0) Next ;~ _ArrayDisplay($aUniqueNS) For $k = 0 to ubound($aUniqueNS) - 1 $iPID = run("nslookup " & $aUniqueNS[$k] , "" , @SW_HIDE , $stdout_child) While 1 $sNSLookupOut &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) $aNSLookup = stringsplit($sNSLookupOut , @LF , 2) _ArrayDelete($aNSLookup , "0-2") _ArrayAdd($aNSLookupFinal , $aNSLookup) $sNSLookupOut = "" Next ;~ _ArrayDisplay($aNSLookupFinal , "Final") ;~ _ArrayDisplay($aNSLookupFinal , "Final") $aOut = $aNSLookupFinal _Excel_RangeWrite($oXLbook , 5 , $aOut) $oXLBook.WorkSheets(5).Name = "NS_NAMES" _ArrayConcatenate($aFinal , $aOut) ;~ _ArrayDisplay($aFinal); ;-------------------------------------------------------------Privileged Users And Groups------------------------------------------------------------------------------------ $sOutput = "" local $aSelectedGroups[] = ["Administrators" , "Backup Operators"] ; Array Of Privileged Groups For $i = 0 to ubound($aSelectedGroups) - 1 $PsCommand = '"' & "$([ADSI]'WinNT://localhost/" & stringstripws($aSelectedGroups[$i] , 3) &",group').psbase.Invoke('Members') | foreach { $_.GetType().InvokeMember('ADspath', 'GetProperty', $null, $_, $null).Replace('WinNT://', '') }" & '"' $iPID = run("powershell " & $PsCommand, "" , @SW_HIDE , $stdout_child) While 1 $sOutput &= StdoutRead($iPID) If @Error Then ExitLoop WEnd ProcessClose($iPID) Next $aOut = stringsplit($sOutput , @LF , 2) _Excel_RangeWrite($oXLbook , 6 , $aOut) $oXLBook.WorkSheets(6).Name = "PRIVILEGED" _ArrayConcatenate($aFinal , $aOut) ;~ _ArrayDisplay($aFinal); ;-------------------------------------------------Startup------------------------------------------------------------------------------------------------ $sCommand = "powershell Get-CimInstance Win32_StartupCommand | format-list" $iPID = run($sCommand, "" , @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) $aOut = stringsplit($sOutput , @LF , 2) _Excel_RangeWrite($oXLbook , 7 , $aOut) $oXLBook.WorkSheets(7).Name = "STARTUP" _ArrayConcatenate($aFinal , $aOut) ;~ _ArrayDisplay($aFinal); ;-------------------------------------------------SERVICES------------------------------------------------------------------------------------------------ $sCommand = "powershell Get-Service | format-list" $iPID = run($sCommand, "" , @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) $aOut = stringsplit($sOutput , @LF , 2) _Excel_RangeWrite($oXLbook , 8 , $aOut) $oXLBook.WorkSheets(8).Name = "SERVICES" _ArrayConcatenate($aFinal , $aOut) ;~ _ArrayDisplay($aFinal); ;----------------------------------------------------PROCESSES+svc--------------------------------------------------------------------------------------------- $sCommand = "tasklist /svc /FO CSV" $iPID = run($sCommand, "" , @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) $aOut = stringsplit($sOutput , @LF , 2) _Excel_RangeWrite($oXLbook , 9 , $aOut) $oXLBook.WorkSheets(9).Name = "PROC+SVC" _ArrayConcatenate($aFinal , $aOut) ;~ _ArrayDisplay($aFinal) ;----------------------------------------------------Drivers--------------------------------------------------------------------------------------------- $sCommand = "driverquery -si -FO csv" $iPID = run($sCommand, "" , @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) $aOut = stringsplit($sOutput , @LF , 2) _Excel_RangeWrite($oXLbook , 10 , $aOut) $oXLBook.WorkSheets(10).Name = "DRIVERS" _ArrayConcatenate($aFinal , $aOut) ;~ _ArrayDisplay($aFinal) ;----------------------------------------------------SOFTWARE--------------------------------------------------------------------------------------------- $iPid = run("powershell Get-CimInstance Win32Reg_AddRemovePrograms", "" , @SW_HIDE , 0x2) $sOutput = "" While ProcessExists($iPid) $sOutput &= StdoutRead($iPID) WEnd $aOut = stringsplit($sOutput, @LF , 2) _Excel_RangeWrite($oXLbook , 11 , $aOut) $oXLBook.WorkSheets(11).Name = "SOFTWARE" _ArrayConcatenate($aFinal , $aOut) ;~ _ArrayDisplay($aFinal) ;----------------------------------------------------------PowerShell Commands--------------------------------------------------------------------------------------- $sCommand = "powershell Get-EventLog -logname 'Windows PowerShell'" $sMessage = '-message "Provider*Function*is*Started*"' $iPID = run($sCommand & " " & $sMessage & "| Select -ExpandProperty message", "" , @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) $aOut = stringregexp($sOutput , "HostApplication=(.*)" , 3) $aOut = _ArrayUnique($aOut , 0 , 0 , 0 , 0) _Excel_RangeWrite($oXLbook , 12 , $aOut) $oXLBook.WorkSheets(12).Name = "POWERSHELL" _ArrayConcatenate($aFinal , $aOut) ;~ _ArrayDisplay($aFinal) ;----------------------------------------------------------Logon Failures--------------------------------------------------------------------------------------- $sCommand = "powershell Get-EventLog -logname 'Security'" $sMessage = '-InstanceID "4625"' $iPID = run($sCommand & " " & $sMessage & "| Format-List", "" , @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) $aOut = stringsplit($sOutput , @LF , 2) _Excel_RangeWrite($oXLbook , 13 , $aOut) $oXLBook.WorkSheets(13).Name = "LOGONFAIL" _ArrayConcatenate($aFinal , $aOut) ;----------------------------------------------------------ALL RDP--------------------------------------------------------------------------------------- $sCommand = "powershell Get-EventLog -logname 'Security'" $sMessage = '-InstanceID "4778"' $iPID = run($sCommand & " " & $sMessage & "| Format-List", "" , @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) $aOut = stringsplit($sOutput , @LF , 2) _Excel_RangeWrite($oXLbook , 14 , $aOut) $oXLBook.WorkSheets(14).Name = "RDP" _ArrayConcatenate($aFinal , $aOut) ;~ ;-------------------------------------------------------------- ;~ _ArrayDisplay($aFinal) $destfile = @ScriptDir & "\" & @MON & @MDAY & @YEAR & @HOUR & @MIN & @SEC & "AuditShot.xlsx" _Excel_BookSaveAs($oXLbook , $destfile) _Excel_Close($oXL) sleep(100) ShellExecute($destfile)1 point -
1 point
-
Should then be: $oDoc.VBProject.VBComponents.Import("C:\temp\Modul1.bas")1 point
-
Use the Word UDF that comes with AutoIt: #include <Word.au3> Global $oWord = _Word_Create() Global $oDoc = _Word_DocOpen($oWord, @ScriptDir & "/doc.doc") $oWord.Application.VBE.ActiveVBProject.VBComponents.Import(@ScriptDir & "/macro.txt") _Word_DocSave($oDoc) _Word_DocClose($oDoc) _Word_Quit($oWord)1 point
-
For Excel it works this way: $oExcel.Application.VBE.ActiveVBProject.VBComponents.Import("C:\temp\Modul1.bas") so I think for Word it should be similar: $oWord.Application.VBE.ActiveVBProject.VBComponents.Import("C:\temp\Modul1.bas")1 point
-
Get data from edit box line by line
Roshan reacted to InunoTaishou for a topic
#include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <MsgBoxConstants.au3> Example() Func Example() Local $idEdit Local $sWow64 = "" If @AutoItX64 Then $sWow64 = "\Wow6432Node" Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\_ReadMe_.txt" ; Create GUI GUICreate("Edit Get Line", 400, 300) $idEdit = GUICtrlCreateEdit("", 2, 2, 394, 268) GUISetState(@SW_SHOW) _GUICtrlEdit_SetText($idEdit, FileRead($sFile)) MsgBox($MB_SYSTEMMODAL, "Information", _GUICtrlEdit_GetLine($idEdit, 2)) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Note the _GUICtrlEdit_GetLine($idEdit, 2)) This was copied and pasted directly from the Help File.1 point -
Show button when clicking a checkbox
31290 reacted to InunoTaishou for a topic
GUICtrlSetPos Also, it's bad practice to create global variables inside a function. Declare them outside f_MainGui and initialize them in your function. #include <ButtonConstants.au3> #Include <Constants.au3> #include <Date.au3> #include <File.au3> #Include <FontConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <Misc.au3> #include <WindowsConstants.au3> #include <StringConstants.au3> Global $hGui Global $btnExample Global $chkExample Opt("GUIOnEventMode", 1) Example() While 1 Sleep (100) Wend Func Example() $hGUI = GUIcreate("Example", 120, 80) $btnExample = GUICtrlCreateButton("Hidden Button", 400, 0, 100, 30) $chkExample = GUICtrlCreateCheckbox("Click me!", 10, 10, 100, 30) GUICtrlSetOnEvent($btnExample, "ButtonExample") GUICtrlSetOnEvent($chkExample, "SetButton") GUISetOnEvent($GUI_EVENT_CLOSE, "Close") GUISetState(@SW_SHOW, $hGUI) EndFunc Func SetButton() If (GUICtrlRead($chkExample) = $GUI_CHECKED) Then GUICtrlSetPos($btnExample, 10, 40, 100, 30) Else GUICtrlSetPos($btnExample, 400, 0, 100, 30) EndIf EndFunc Func ButtonExample() MsgBox("", "", "Hidden button has been clicked!") EndFunc Func Close() GUIDelete($hGUI) Exit 0 EndFunc1 point -
and which of the checkBoxes is the one which should toggle buttonstate? And where are the func's for the events? Here's a small script: ArrayOfCheckBoxesOE.au3, which shows the logic you need if any checkbox should enable Button.1 point
-
The standard answer for small-scale problems is essentially brute-force. Of course one hits a computability wall when the scale grows significantly. Algorithms used for certain variants of the knapsack problem can be used with success. It's only when the problem is more constrained (e.g. sums of subsets of primes) that deeper number-theoretic algorithms enter into play, but none are trivial. It's somehow surprising that additive NB (number theory) is globally much more difficult than multiplicative NB, despite addition being a "simpler" operation than multiplication, at least from a intuitive point of view.1 point