Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/17/2021 in all areas

  1. 🙃 ConsoleWrite("- Is Windows 11: " & _IsWindows_11() & @CRLF) ;ConsoleWrite("- Is Windows Server 2022: " &_IsWindows_22() & @CRLF) Func _IsWindows_11() If StringInStr(@OSVersion, "11") Or StringInStr(_GetOS_Name(), "11") Then Return 1 Return 0 EndFunc ;==>_IsWindows_11 Func _IsWindows_22() If StringInStr(@OSVersion, "22") Or StringInStr(_GetOS_Name(), "22") Then Return 1 Return 0 EndFunc ;==>_IsWindows_22 Func _GetOS_Name() Local $OSname, $objItem = "", $strComputer = ".", $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20 Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\") Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $OSname = $objItem.Caption ConsoleWrite("> System: " & $OSname & @CRLF) Return $OSname Next Else ConsoleWrite("! No WMI Objects Found for class: Win32_OperatingSystem" & @CRLF) Return SetError(1, 0, "") EndIf EndFunc ;==>_GetOS_Name ; DAO VAN TRONG - TRONG.LIVE
    1 point
  2. 1 point
  3. .. and attached to your underarms.
    1 point
  4. Gianni

    Aquarium

    This script is an alternative (improvement) to the script published at this link (www.autoitscript.com/forum/topic/186225-interesting-effect-with-transparency). In that post a flash animation was used and therefore you need the flash player to work, while here only javascript is used. Here, too, the aim is to show an interesting effect that can be obtained by exploiting transparency, but can also be used as it is just for fun. The animation consists of some fish wandering around the screen. You can continue working on the computer by letting them swim. The javascript source was not written by me, but I got it from this link: https://github.com/lrusso/Aquarium. I shrunk it down a bit and tweaked it so that fish can swim across the entire screen even with different sized monitors. The fish images and html and javascript sources have been bundled into a single "monolithic" AutoIt script, so it's easier to run. I hope you find it relaxing. Have fun fishMonolitic.zip
    1 point
  5. Look at FileFlush() You can flush file buffer to disk more frequently (if there are more FileWrites) and each of them including final FileClose() will take shorter time ...
    1 point
  6. The Webdriver "actions" is an advanced feature that can be difficult to format correctly. In this case, the string of actions isn't properly formatted, so the Webdriver is throwing an error. Here's a simplified example that worked for me -- ; Press ctrl $sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown", "value": "\uE009"},' ; Pause $sAction &= '{"type": "pause", "duration": 500},' ; Press v $sAction &= '{"type": "keyDown", "value": "v"}, {"type": "keyUp", "value": "v"},' ; Release ctrl $sAction &= '{"type": "keyUp", "value": "\uE009"}]}]}' _WD_Action($sSession, "actions", $sAction)
    1 point
  7. Yes, you can find it between your ears.
    1 point
  8. Shouldn't "testing 1.exe" be 13 ?
    1 point
  9. Version 1.7.0.0 of the UDF has been released. Now you get a help file that looks like the AutoIt help. Please test before using in production! For download please see my signature.
    1 point
  10. In case your MS SQL Server is running on your own computer, you should configure MS SQL Server to allow remote connections. This is disabled by default. First, download and install SQL Server Management Studio from here: https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15. You have to click the first link in the article: Once it is installed, open it and log in to your SQL server. Right click on your server () and click Properties --> Connections --> Allow Remote Connections. Next, open SQL Server Configuration Manager and enable TCP/IP if you have not done that already. Restart your SQL Server. Make the firewall is configured correctly, so it does not block the port you are using. And lastly, I am assuming your friend is on the same network as you, otherwise you probably have to configure port fowarding on your router. More info: Allowing remote connections: https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-the-remote-access-server-configuration-option?view=sql-server-ver15 Enable TCP/IP: https://www.habaneroconsulting.com/stories/insights/2015/tcpip-is-disabled-by-default-in-microsoft-sql-server-2014
    1 point
  11. ;$sServer = '192.168.42.228, 1500' ;try this: $sServer = '192.168.42.228' ;or use the server name as from the original example by Zedna, Aug 6, 2020 ;https://www.autoitscript.com/forum/topic/203542-ms-sql-connection/?do=findComment&comment=1461607 ;$sServer = 'server1' ;or try changing connection string: $DSN = 'SQLOLEDB;Data Source=' & $sServer & ';Initial Catalog=' & $sDatabase & ';User Id=' & $sUID &';Password=' & $sPWD & ';' See also: List all installed OLE DB providers: https://www.autoitscript.com/wiki/ADO_Tools A possible problem of your script is keeping open connections in presence of errors because of this: If @error Then Exit Better always checking for open connections on exit. This would be my version of your example: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Opt("TrayIconDebug", 1) OnAutoItExitRegister("OnAutoItExit") Global $nMsg Global $oConn, $sSQL Global $sServer = '192.168.42.228' Global $sDatabase = 'tempdb' Global $sUID = 'sa' Global $sPWD = 'examplepass' #===== ADODB ===== ;Help: COM Error Handling ;_ErrADODB From spudw2k ;https://www.autoitscript.com/forum/topic/105875-adodb-example/ Global $errADODB = ObjEvent("AutoIt.Error","_ErrADODB") Global Const $iCursorType = 3 ;0 adOpenForwardOnly, 3 adOpenStatic Global Const $iLockType = 3 ;1 adLockReadOnly, 3 adLockOptimistic Global Const $iOptions = 1 ; Options, 1 Evaluates as a textual definition of a command or stored procedure call ; 2 adCmdTable $oConn = ObjCreate("ADODB.Connection") ; Create a connection object ;~ ;https://accessexperts.com/blog/2011/03/24/sql-server-connections-strings-for-microsoft-access/ ;~ ;You should bypass the ODBC layer altogether when connecting to SQL Sever by using a connection string similar to this one in your code: ;~ ;stConnect = "Provider=SQLOLEDB;Data Source=... ;~ ;Or if you’re using native client: ;~ ;stConnect = "Provider=SQLNCLI10;Data Source=... Global $sADOConnectionString = 'Provider=SQLOLEDB;Data Source=' & $sServer & ';Initial Catalog=' & $sDatabase & ';User Id=' & $sUID &';Password=' & $sPWD & ';' ;https://www.w3schools.com/asp/prop_rs_cursorlocation.asp ;A Recordset object inherits this setting from the associated Connection object. ;This property is read-only on an open Recordset object, and read/write on a Connection object or on a closed Recordset object. $oConn.CursorLocation = 2 ;2 adUseServer, 3 adUseClient $oConn.CommandTimeout = 10 ;https://stackoverflow.com/questions/31941487/open-adodb-connection-to-excel-file-in-read-only-mode ;https://www.w3schools.com/asp/prop_rec_mode.asp $oConn.Mode = 1 ;Read-only #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 384, 168, 192, 124) Global $connect_ = GUICtrlCreateButton("Connect", 144, 112, 91, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $connect_ ms_sql_connection() EndSwitch WEnd Func ms_sql_connection() $oConn.Open($sADOConnectionString) ; Open the connection MsgBox(1, "Connection String", $oConn.ConnectionString) ;Zedna, Aug 7, 2020 ;https://www.autoitscript.com/forum/topic/203542-ms-sql-connection/?do=findComment&comment=1461671 ;simple select returns 1 value (1 column and 1 row: count() max() TOP 1) $sSQL = "SELECT 'Version: ' + @@VERSION + CHAR(13) + 'Language: ' + @@LANGUAGE + CHAR(13) + 'ServerName: ' + @@SERVERNAME;" MsgBox(0, "", $oConn.Execute($sSQL).Fields(0).Value) $oConn.Close ;Close the connection $oConn = 0 ;Release the connection object EndFunc Func _ErrADODB() Msgbox(0,"ADODB COM Error","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $errADODB.description & @CRLF & _ "err.windescription:" & @TAB & $errADODB.windescription & @CRLF & _ "err.number is: " & @TAB & hex($errADODB.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $errADODB.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $errADODB.scriptline & @CRLF & _ "err.source is: " & @TAB & $errADODB.source & @CRLF & _ "err.helpfile is: " & @TAB & $errADODB.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $errADODB.helpcontext, 5) Local $err = $errADODB.number If $err = 0 Then $err = -1 Local $sFilePath = @DesktopDir & "\error.txt" ;Open the file for write access. Local $hFileOpen = FileOpen($sFilePath, 2) ;If $hFileOpen = -1 Then ;MsgBox(0, "", "An error occurred when reading/writing the file.") ;EndIf FileWrite($hFileOpen, "ADODB COM Error" & Chr(1) & _ "err.description is: " & @TAB & $errADODB.description & Chr(1) & _ "err.windescription:" & @TAB & $errADODB.windescription & Chr(1) & _ "err.number is: " & @TAB & hex($errADODB.number,8) & Chr(1) & _ "err.lastdllerror is: " & @TAB & $errADODB.lastdllerror & Chr(1) & _ "err.scriptline is: " & @TAB & $errADODB.scriptline & Chr(1) & _ "err.source is: " & @TAB & $errADODB.source & Chr(1) & _ "err.helpfile is: " & @TAB & $errADODB.helpfile & Chr(1) & _ "err.helpcontext is: " & @TAB & $errADODB.helpcontext _ ) ;Close the handle returned by FileOpen. FileClose($hFileOpen) $oConn.Close $oConn = 0 Exit EndFunc Func OnAutoItExit() If IsObj($oConn) Then If $oConn.State > 0 Then $oConn.Close ;adStateOpen Close the connection $oConn = 0 ; Release the connection object EndIf EndFunc
    1 point
  12. Connection string Or Firewall Or MS SQL configuration
    1 point
  13. You want to logon somewhere with userid and password to get another userid/password? Make sure you run in a single signon securitycontext (like others said do not store it in script or configuration files you check in to github) Call an api to get userid/password from your vault management system beyondtrust pam Make sure you are aware of variables containing your userid/pwd in memory and handle them in line with company policies If possible work with timebased tokens for security In general I do not think it makes a difference typing userid/pwd manually or automated as soon as its entered you have the risk its left somewhere in memory (even encrypting does not help as the unencrypted variable could be anywhere in garbage collection or not reinitialized memory by the operating system). Wiping password variables will not help to get it out of computer memory. Google for DPAPI to get an idea about problematics around data that needs to be secured in memory. but again whenever you use send("plain password") it is in unprotected memory. And indeed screenscraping like you started with can easier be done with iuiautomation.
    1 point
  14. Reading from the website, I see that beyondtrust pam is actually a software security suite to exert control over privilege elevation, access, and permissions strategies. If you are interfacing with that, I strongly suggest you consult with them about using AutoIT to store user credentials in AutoIT variables where they may be stored in plain text, even if only temporarily, as nefarious types love trawling through memory dumps for exactly these type of misuse. Often if you pass these values to programs, other software can access these values, something that may be extremely undesirable. Let the existing security infrastructure in your OS give you the privileges to execute your programs without having to pass passwords and usernames as parameters. [Note: I speak from extensive corporate experience here] A strong warning: You are opening your organisation to a whole lot of grief, possibly without even realising it. Obviously your organisation is taking the current threats of cyber attacks very seriously if they are investing money on beyondtrust packages, and scripting your way in the background will just be undermining that. Your AutoIT code may even be flagged as malware and unceremoniously deleted. Given the kind of self admitted newbie type question you have posed, it is obvious you are innocently looking at the trees and not the forest. Please, please talk to your security team before you proceed with any further coding. Ask their opinion if AutoIT is the appropriate tool to be using to launch other software and pass security attributes to it.
    1 point
  15. Thanks... my simple question was how to pass the parameters... but anyways it seems it went in different direction, i have found my solution by performing some RND so thanks for going out of topic !! and filling up this topic without any related content.
    0 points
×
×
  • Create New...