Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/24/2015 in all areas

  1. ; Set the End key to call the RandomClick function HotKeySet("{End}", "_RandomClick") ; Maximum number of clicks and the maximum delay between each click Global $maxClicks = 10, $maxDelay = 500 ; Infinite while loop that prevents the script from closing. Putting a slight delay so the script doesn't eat up CPU. While 1 Sleep(100) WEnd ; The function. Func _RandomClick() ; For loop. It will do everything after line 15 and before line 18 a Random number of times (Random(0, Random(0, $maxClicks)) For $i = 0 To Random(0, Random(0, $maxClicks)) MouseClick("Left", Random(0, Random(0, @DesktopWidth)), Random(0, Random(0, @DesktopHeight)), Random(1, 3), 5) Sleep(Random(0, Random(0, $maxDelay) Next EndFunc
    2 points
  2. Try the new AuCGI handler! (added September 22, 2007) Now, you can make your own web pages and web applications with AutoIt! And, with AuCGI, easier and better than ever before! AuCGI allows for exciting new features such as <?au3 ?> tags! Here's all you have to do to start making your own web pages in AutoIt! 1.) Download AuCGI.exe (click) and put it in C:\ (or wherever you want) 2.) Download Web.au3 (click) and put it in C:\Program Files\AutoIt3\include, or if you are using beta, C:\Program Files\AutoIt3\beta\include ABYSS WEB SERVER 3.) Download and install Abyss Web Server X1 if you haven't already from http://www.aprelium.com/ 4.) go to the Abyss Control panel (usually http://192.168.0.1:9999/ ) 5.) Click Configure next to the Default Host (or if you have ...bought... Abyss Web Server X2, next to whatever host you want to configure) 6.) Go to Scripting Parameters 7.) If you have already installed Web-Based AutoIt, click the pencil next to the AutoIt interpreter. If you are new to web-based autoit, click the Add button in the Interpreters table. 8.) Fill in the info with this...info: Interpreter: C:\AuCGI.exe (or where ever you put AuCGI.exe in step 1) Arguments: LEAVE BLANK Type: Standard If you are new to web-based autoit (didn't have it installed before), click Add under Extensions, and type auw (or ahp or whatever file extension you want to use for web-based Apps) 9.) click OK 10.) click OK again 11.) Click Restart at the top of the page 12.) you're ready! APACHE NOTE: AUCGI WITH APACHE IS UNTESTED AND MAY NOT WORK. IF YOU USE APACHE, PLEASE TEST THIS AND TELL ME HOW IT WORKS OUT. 3.) Add the following text to either your apache config file, or your .htaccess file (or create a .htaccess file and put this in there) Options +ExecCGI AddHandler cgi-script .auwIf you want, replace .auw with .ahp or whatever file extension you want to use for web-based Apps. 4.) I think that's it. Now, whenever you want to make a web-based App, put this at the beginning: #!C:\AuCGI.exeif you put AuCGI.exe somewhere other than C:\, put the path to there after the #! This is called a Shebang line. Yes, this has to go at the VERY beginning of the web-based app. it has to be on the very first line. No blank lines or spaces or tabs or anything before it. Even before the ##WebApp line (which you'll learn about later...) ------------------------------------------------------------------- To make your first web-based app! On the first line needs to be this: ##WebApp This marks your scripts as a web-based app. Without that there, your script will not work. If you wish, you can add parameters after that. For example: ##WebApp title="My Cool Web Page" if you specify a title, the starting html tags are there for you. If you want to put other info in the <head> tag or anything, you should set the title manually using the <title> tag, instead of using the ##WebApp line. As with the Shebang line, this must go at the very top of the script, with no blank lines or spaces before it. However, if you are using Apache, this should go after the Shebang line. you can also use ##WebApp content-type="xxxx" to change the content type that is sent to the server. The default is text/html. You could also use text/plain or pretty much any standard format content type. or you can use both: ##WebApp title="My Title" content-type="blah/blah" But I don't see why you would do that, seeing as changing the content type will make the title not work anyway... Note: Don't put double quotes in your title. Double quotes should be used to surround the title, but they should not be inside the title. Also, don't even try using variables. It won't work. Here is an example of what NOT TO DO: ##WebApp title="My name is " & $name & "! How are you?"I'm not sure why you would need a title like that anyway, but it won't work. it will just cut off at My name is. Next, you can use html or text or whatever you want. Or, you can start using AutoIt. everything between <?au3 and ?> is considered AutoIt, and anything outside it is considered html (or plain text or whatever if you changed the content typo) You can use whatever autoit you want inside the <?au3 ?> tags, and whatever html you want outside them. Note that I will eventually release a version of AuCGI that lets you block certain commands. Note: For people who have used Web-based AutoIt before, you no longer need to use _StartWebApp. That is done for you automatically when you use the #WebApp line. Note: You do not need to include Web.au3. this is done for you AUTOMATICALLY. You can use any functions in Web.au3, but you do not need to include it. I guess you can if you really want, but it won't make any difference... That's about it. If you have not used web-based autoit before, sorry, I don't have the instructions on how to use all the functions. I will type up a formal help file soon. If you have used web-based autoit before, it's exactly the same functions as before. Just use autoit inside <?au3 ?> tags and html outside. HOWEVER, _Post doesn't work. I don't think. So, don't even try. Or you can try and see if you can get it to work, but I couldn't. If you want it, here is the source to AuCGI.exe (click).
    1 point
  3. ADO (ActiveX Data Objects) is a set of Component Object Model (COM) objects for accessing data sources like text files, Excel workbooks, databases (e.g. MS SQL, Oracle, MySQL), directory services (e.g. Active Directory, OpenLDAP). There are many examples on the forum but a documentation that puts it all together is missing. If you would like to see such a section in the Wiki then please answer the question in the poll and post the data source you would like to see documented (text file, MS SQL, Excel ...) (Stripped down) Example by GreenCan: $sPath_to_database = "C:\Temp\text delimited files" $connection = "DRIVER={Microsoft Text Driver (*.txt; *.csv)};Dbq=" & $sPath_to_database & ";Extensions=asc,csv,tab,txt;" $adoCon = ObjCreate("ADODB.Connection") $adoCon.Open($connection) If @error Then Exit MsgBox(48, "Error", "error " & @error) $adoRs = ObjCreate("ADODB.Recordset") $adoSQL = "SELECT * FROM Countries.csv" $adoRs.CursorType = 2 $adoRs.LockType = 3 $adoRs.Open($adoSQL, $adoCon) With $adoRs If .RecordCount Then While Not .EOF $sResult = $sResult & "" & .Fields("Continent").Value & "|" & .Fields("alpha_2").Value & "|" & .Fields("English_Country_Name").Value & @CR .MoveNext WEnd EndIf EndWith $adoCon.Close MsgBox(0, "Result", $sResult)
    1 point
  4. jrsofsd, I understand your request perfectly - I am just not prepared, for the reasons I gave above, to add this functionality to the UDF. dynamitemedia, The UDF tracks the content of the ListView, not the selection status. If you have checkboxes then the _GUIListViewEx_ReturnArray function can return the overall state of these when you set the $iCheck parameter. If you want to know which rows have been selected, then you need to use the _GUICtrlListView_GetSelectedIndices function in the standard GuiListView UDF. M23
    1 point
  5. Hi water, Microsoft ODBC for Oracle DRIVER={Microsoft ODBC for Oracle};SERVER=xxxxxxxxx;User Id=xxxxxxxxx;Password=xxxxxxxxx; Oracle (11g in this example): DRIVER={Oracle in OraClient11g_home1};DBQ=xxxxxxxxx;uid=xxxxxxxxx;pwd=xxxxxxxxx; MSSQL DRIVER={SQL Server};SERVER=xxxxxxxxx;DATABASE=xxxxxxxxx;Trusted_Connection=no;uid=xxxxxxxxx;pwd=xxxxxxxxx; Microsoft text (a database? yes of course) DRIVER={Microsoft Text Driver (*.txt; *.csv)};Dbq=xxxxxxxxx;Extensions=asc,csv,tab,txt; dBase, Clipper, Borland... (remember the good old times...): DRIVER={Microsoft dBase Driver (*.dbf)};Dbq=xxxxxxxxx; MSAccess: DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=xxxxxxxxx;uid=xxxxxxxxx;pwd=xxxxxxxxx; SQLite ODBC: DRIVER={SQLite3 ODBC Driver (*)};Database=xxxxxxxxx; Adaptive Server Anywhere (Not tested !!!!) DRIVER={Adaptive Server Anywhere 9.0 (*)};Srvr=xxxxxxxxx;Dbf=xxxxxxxxx;uid=xxxxxxxxx;pwd=xxxxxxxxx; MySQL DRIVER={MySQL ODBC 5.1 Driver (*)};Server==xxxxxxxxx;Database==xxxxxxxxx;Option=16834;Uid==xxxxxxxxx;Pwd==xxxxxxxxx; Excel DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};dbq=xxxxxxxxx; Word: Are you crazy? this is no database...
    1 point
  6. I'm going to throw my two cents in here, from an extensive background in security analysis (I get paid to reverse-engineer/compromise systems by the owner(s), and then tell them how to close the holes.) Don't use AutoIt to deal extremely sensitive data. Period. AutoIt is at heart an interpreted language and is very vulnerable to reverse engineering attacks. Obfuscation is like putting a second lock on a door that is being pounded with a battering ram. It may slow things down, but it will not prevent entry. Trust me. An external DAT file will not even slow down a determined opponent. One of the first orders of business in compromising any program is monitoring the filesystem, network, and registry APIs. A file access on an obscure, seemingly unrelated file will raise instant suspicion. My advice, write the sensitive portions (at least) of your app in C/C++, and wrap them in a DLL to call from your main AutoIt program. Any security-related logic should not be native AutoIt. Native code can be reverse engineered, but not as easily or as quickly. A good optimizer can also help obscure the logic and decrease the feasibility of an automated decompiler. Also, look into using asymmetric encryption for communication with the server. (Public/private key pairs.) Lastly, if you really cannot abide something being discovered, don't put it on another user's system. If it's there, it can be compromised. Always.
    1 point
  7. When I use a DAT file for storing data, I use _StringEncrypt to encrypt the data. I then keep the DAT file separate from the main script, somewhere on the PC that it will be used on. I also use delimiters when I encrypt and I do not identify what the values are in the DAT file. You then decrypt the file and parse the data in main script to extract the data. Also extract the _StringEncrypt from String.au3, rename the function and the variables in it to something totally unrelated to encryption, when you use it to decrypt the file in the main script. This makes it a little harder, if someone gets your source, to determine what the function is doing. An Example to create DAT file. #include <String.au3> ;Data to encrypt. $sDB1 = "DB1" $sUserName1 = "User1" $sPassword1 = "Password1" $sDB2 = "DB2" $sUserName2 = "User2" $sPassword2 = "Password2" $sDB3 = "DB3" $sUserName3 = "User3" $sPassword3 = "Password3" $sDATFile = "Test.dat" $sData = $sDB1 & "," & $sDB2 & "," & $sDB3 & @CRLF & $sUserName1 & "," & $sUserName2 & "," & $sUserName3 & @CRLF & $sPassword1 & "," & $sPassword2 & "," & $sPassword3 & @CRLF $sDataEncrypted = _StringEncrypt(1, $sData, "EncryptPassword", 10) FileWrite($sDATFile, $sDataEncrypted) In this example, when this file is decrypted, it can be parsed from a CSV format into an array with function with the -1 format option. You are then able to use the data in the main script. This example uses an unrenamed _StringEncrypt function for demonstration to decrypt the DAT file, and _ParseCSV to parse the unencrypted string. Using the previously created DAT file from above. Array.au3 used for _ArrayDisplay only. #include <String.au3> #include <Array.au3> $sDATFile = "Test.dat" $sData = FileRead($sDATFile) $sData = _StringEncrypt(0, $sData, "EncryptPassword", 10) $aData = _ParseCSV($sData, "", "", -1) _ArrayDisplay($aData) ; #FUNCTION# ==================================================================================================================== ; Name...........: _ParseCSV ; Description ...: Reads a CSV-file ; Syntax.........: _ParseCSV($sFile, $sDelimiters=',', $sQuote='"', $iFormat=0) ; Parameters ....: $sFile - File to read or string to parse ; $sDelimiters - [optional] Fieldseparators of CSV, mulitple are allowed (default: ,;) ; $sQuote - [optional] Character to quote strings (default: ") ; $iFormat - [optional] Encoding of the file (default: 0): ; |-1 - No file, plain data given ; |0 or 1 - automatic (ASCII) ; |2 - Unicode UTF16 Little Endian reading ; |3 - Unicode UTF16 Big Endian reading ; |4 or 5 - Unicode UTF8 reading ; Return values .: Success - 2D-Array with CSV data (0-based) ; Failure - 0, sets @error to: ; |1 - could not open file ; |2 - error on parsing data ; |3 - wrong format chosen ; Author ........: ProgAndy ; Modified.......: ; Remarks .......: ; Related .......: _WriteCSV ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _ParseCSV($sFile, $sDelimiters=',;', $sQuote='"', $iFormat=0) Local Static $aEncoding[6] = [0, 0, 32, 64, 128, 256] If $iFormat < -1 Or $iFormat > 6 Then Return SetError(3,0,0) ElseIf $iFormat > -1 Then Local $hFile = FileOpen($sFile, $aEncoding[$iFormat]), $sLine, $aTemp, $aCSV[1], $iReserved, $iCount If @error Then Return SetError(1,@error,0) $sFile = FileRead($hFile) FileClose($hFile) EndIf If $sDelimiters = "" Or IsKeyword($sDelimiters) Then $sDelimiters = ',;' If $sQuote = "" Or IsKeyword($sQuote) Then $sQuote = '"' $sQuote = StringLeft($sQuote, 1) Local $srDelimiters = StringRegExpReplace($sDelimiters, '[\\\^\-\[\]]', '\\\0') Local $srQuote = StringRegExpReplace($sQuote, '[\\\^\-\[\]]', '\\\0') Local $sPattern = StringReplace(StringReplace('(?m)(?:^|[,])\h*(["](?:[^"]|["]{2})*["]|[^,\r\n]*)(\v+)?',',', $srDelimiters, 0, 1),'"', $srQuote, 0, 1) Local $aREgex = StringRegExp($sFile, $sPattern, 3) If @error Then Return SetError(2,@error,0) $sFile = '' ; save memory Local $iBound = UBound($aREgex), $iIndex=0, $iSubBound = 1, $iSub = 0 Local $aResult[$iBound][$iSubBound] For $i = 0 To $iBound-1 If $iSub = $iSubBound Then $iSubBound += 1 ReDim $aResult[$iBound][$iSubBound] EndIf Select Case StringLen($aREgex[$i])<3 And StringInStr(@CRLF, $aREgex[$i]) $iIndex += 1 $iSub = 0 ContinueLoop Case StringLeft(StringStripWS($aREgex[$i], 1),1)=$sQuote $aREgex[$i] = StringStripWS($aREgex[$i], 3) $aResult[$iIndex][$iSub] = StringReplace(StringMid($aREgex[$i], 2, StringLen($aREgex[$i])-2), $sQuote&$sQuote, $sQuote, 0, 1) Case Else $aResult[$iIndex][$iSub] = $aREgex[$i] EndSelect $aREgex[$i]=0 ; save memory $iSub += 1 Next If $iIndex = 0 Then $iIndex=1 ReDim $aResult[$iIndex][$iSubBound] Return $aResult EndFunc Edit: Added #include <String.au3> to the second example. Adam
    1 point
  8. Thanks taurus. I have added the changes since I really like them; with some alterations of course I have added a variable renamer that will replace variables with a random 15-digit variable. It will check for duplicates if by any chance it generates the same number twice. It will generate a new script with the changes at n&"_VarRename.au3". Some limitations this script has is: You will need to manually change variables when using: IsDeclared(), Eval(), etc where it checks a variable through a string. $Var = 1 If IsDeclared("Var") Then Exit You will need to manually change the "Var" inside the IsDeclared to the newly renamed variable. Another problem is with variables starting with the same characters as another variable. $n = 1 $new = 2 Will result in: $098237561294762 = 1 $098237561294762ew = 2 because of the string replace of $n. However they will both still be different variables so it shouldn't affect performance. Finally, all $ signs will be considered a variable and will replace them ALL with a variable. One workaround is using Chr(36) when wanting to display a $ sign rather than actually typing it. #include <File.au3> #include <Array.au3> $Source = FileOpenDialog("Choose a script to find Variables in:", @DesktopCommonDir, "Scripts (*.au3)", 3) If @error Then Exit $Results = StringTrimRight($Source, 4) & "_VarRename.au3" Dim $File $Char = Chr(36)&"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_" $Variables = _ArrayCreate(1) _FileReadToArray($Source, $File) For $i = 1 To (UBound($File, 1) - 1) $Instance = 0 $Line = StringSplit($File[$i], "") Do $VarStart = _ArraySearch($Line, Chr(36), $Instance) $Instance = $VarStart + 1 If $VarStart > 0 Then $Var = "" For $t = $VarStart To UBound($Line, 1) - 1 If StringInStr($Char, $Line[$t]) > 0 Then $Var = $Var&$Line[$t] Else ExitLoop EndIf Next If $Var <> "" And _ArraySearch($Variables, $Var) = -1 Then _ArrayAdd($Variables, $Var) EndIf Until $VarStart <= 0 Next $Variables[0] = UBound($Variables, 1) - 1 Dim $NewVariables[UBound($Variables, 1)] $Replace = FileRead($Source) For $r = 1 To UBound($Variables, 1) - 1 While 1 $NewVariables[$r] = Chr(36)&Random(100, 999, 1)&Random(0, 9, 1)&Random(0, 9, 1)&Random(0, 9, 1)&Random(0, 9, 1)&Random(0, 9, 1)&Random(0, 9, 1)&Random(0, 9, 1)&Random(0, 9, 1)&Random(0, 9, 1)&Random(0, 9, 1)&Random(0, 9, 1)&Random(0, 9, 1) If _ArraySearch($NewVariables, $NewVariables[$r]) = $r Then ExitLoop WEnd $Replace = StringReplace($Replace, $Variables[$r], $NewVariables[$r], 0) Next If FileExists($Results) Then FileDelete($Results) FileWrite($Results, $Replace) Any bugs, suggestions, improvements, or changes to the code that would speed it up or fix any limitations are greaty appreciated. -JKnight
    1 point
×
×
  • Create New...