Jump to content

rc1986

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by rc1986

  1. Ignore me I've found a few posts to assist, clearly didn't look hard enough the first time.
  2. Good morning, I currently have a little application that I have used the Crypt.au3 include to provide a basic form of encryption. I have a little GUI which prompts the user to enter their passwords, this is then encrypted and written to a text file in its encrypted form. When this user/password is required the code decrypts it and uses it on the fly. The way I am currently doing this is by using a passkey or master key withing the script itself to decrypt/encrypt. This is the bit that concerns me as of course this isn't very secure. Initially this didn't matter to me as what I'd created was much better than previous plain sight passwords in batch files etc however now I'd like to find a way of improving the security. Would anyone be able to offer any insight or other techniques/3rd party app integration etc to assist with my problem?
  3. Thanks, I've edited my original post with an example. Apologies for lack of detail!
  4. Hi All, I've been playing around with creating a Windows custom event log using AutoIT and have come up with the following so far. ; Event Log Creation Reg Entries RegWrite("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\TestApp\TestApp", "CustomSource", "REG_DWORD", "1") RegWrite("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\TestApp\TestApp", "EventMessageFile", "REG_EXPAND_SZ", "%SystemRoot%\System32\EventCreate.exe") RegWrite("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\TestApp", "Sources", "REG_MULTI_SZ", "TestApp") RegWrite("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\TestApp", "File", "REG_EXPAND_SZ", "%SystemRoot%\system32\winevt\Logs\TestApp.evtx") RegWrite("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\TestApp", "Retention", "REG_DWORD", "0") RegWrite("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\TestApp", "MaxSize", "REG_DWORD", "524288") ; My little function based on the EventLog.au3 to make it easier within my code. ; Create Event Log | 1=Error, 2=Warning, 4=Information Func _CreateEventLog($Type,$EventID,$Desc) local $aEmpty[1] = [0] $hEventLog = _EventLog__Open("", "TestApp") _EventLog__Report($hEventLog, $Type, 0, $EventID, 0,$Desc, $aEmpty) _EventLog__Close($hEventLog) logging("EVENT" & @TAB & "An event has been logged to the TestApp Event Log." & @CRLF) EndFunc ; Creating an event log entry _CreateEventLog(1,900,@CRLF & 'Test Message') This seems to work nice and well however I'm receiving some strange entries in the custom event log every now and then: And then my message shows. Does anyone have any clue why this would be? I think my code is OK that bit seems to send the message to the event log however something is missing. I've read up on message files and putting an entry for them in the registry however that will give me very specific event log entries and I want mine to be dynamic within my code. Any ideas anyone? Thanks, Rob
  5. Thank you both very much, very helpful I'll attempt to get something going!
  6. Thanks, I did look at this post but ideally didn't want to use a UDF. Ideally I want to make use of the WMI queries I'm just unsure of how best to use it. Thanks again.
  7. Hi, I'm trying to find a way to query the setup Windows Scheduled Tasks on a local machine. I have used scriptomatic's tool to find the WMI call as can be seen below: ; Generated by AutoIt Scriptomatic $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ScheduledJob", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $Output = $Output & "Command: " & $objItem.Command & @CRLF $Output = $Output & "DaysOfMonth: " & $objItem.DaysOfMonth & @CRLF $Output = $Output & "DaysOfWeek: " & $objItem.DaysOfWeek & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "ElapsedTime: " & WMIDateStringToDate($objItem.ElapsedTime) & @CRLF $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output = $Output & "InteractWithDesktop: " & $objItem.InteractWithDesktop & @CRLF $Output = $Output & "JobId: " & $objItem.JobId & @CRLF $Output = $Output & "JobStatus: " & $objItem.JobStatus & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "Notify: " & $objItem.Notify & @CRLF $Output = $Output & "Owner: " & $objItem.Owner & @CRLF $Output = $Output & "Priority: " & $objItem.Priority & @CRLF $Output = $Output & "RunRepeatedly: " & $objItem.RunRepeatedly & @CRLF $Output = $Output & "StartTime: " & WMIDateStringToDate($objItem.StartTime) & @CRLF $Output = $Output & "Status: " & $objItem.Status & @CRLF $Output = $Output & "TimeSubmitted: " & WMIDateStringToDate($objItem.TimeSubmitted) & @CRLF $Output = $Output & "UntilTime: " & WMIDateStringToDate($objItem.UntilTime) & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ScheduledJob" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc When running this on any machine I appear to get nothing. Can anyone advise into how I'd use this to find out for example the statuses of the current scheduled tasks on my machine? Thanks, Rob
  8. Hi, Just refer to the help file and have a look through the functions you are after. There's a guide on the downloads section called AutoIT 1-2-3 which is pretty good at starting you off and is accompanied by a walkthrough GUI interface ('?do=embed' frameborder='0' data-embedContent>>) Below is an incredibly simple use of a consolewrite. I use consolewrites and messagebox to debug a lot of my code when I'm first writing so I can check the variables are what I think they are. ; Define your variable as below then use consolewrite to display it within the console. Local $var = "hello" consolewrite( $var & @CR ) ; display the variable within a message box msgbox( 0, "Test Box", $var) If you write yourself a simple statement, assign it a variable and then call a consolewrite as I've done above after it to ensure the result is as you expected.
  9. Hi All, I am currently trying to find the best way to log into a web page using a username/password to create a cookie. This will then enable me to access a webpage within that site and obtain the source code from it for my use. Currently I have used the following: #include <IE.au3> #Include <String.au3> #include <Array.au3> ; login and user status URLs $loginurl = 'http://localhost:8080/TestSite/checkLogin.jsp?uid=bob&pwd=bob' $processurl = 'http://localhost:8080/TestSite/UserStatuses.jsp' ; Register IE error handler _IEErrorHandlerRegister() ; Create the webpage and login to test site then close the webpage to create cookie $loginpage = _IECreate($loginurl, 0, 0, 1, 0) $pageText = _IEBodyReadText($loginpage) $check = StringInStr($pageText, "Internet Explorer cannot display", 1) $check2 = StringInStr($pageText, "The password you entered is incorrect", 1) IF $check <> 0 Then ; error checking to tell me if i've hit the page or if cannot access ConsoleWrite("Error - Cannot Open Login Page" & @LF) _IEQuit($loginpage) Exit ElseIf $check2 <> 0 Then ; further error checking to tell me if i've managed to get to my page or failing login ConsoleWrite("Error - Cannot Login To Test Site" & @LF) _IEQuit($loginpage) Exit EndIf ; Input element commands for login page ; This is old code i was using to input username/password into fields. ;Local $oForm = _IEFormGetObjByName($oIE, "frmLogin") ;Local $oText = _IEFormElementGetObjByName($oForm, "uid") ;_IEFormElementSetValue($oText, "bob") ;Local $oText = _IEFormElementGetObjByName($oForm, "pwd") ;_IEFormElementSetValue($oText, "bob") ;_IEFormSubmit($oForm) ;Sleep(5000) ;$processSource = _INetGetSource($processurl, 'True') ; Create webpage navigate to user status and read the source. Close the page $processpage = _IECreate($processurl, 0, 0, 1, 0) $processSource = _IEBodyReadHTML($processpage) $check = StringInStr($processSource, "Internet Explorer cannot display", 1) $check2 = StringInStr($processSource, "The password you entered is incorrect", 1) IF $check <> 0 Then ConsoleWrite("Error - Cannot Open Login Page" & @LF) _IEQuit($processpage) Exit ElseIf $check2 <> 0 Then ConsoleWrite("Error - Cannot Login To test site" & @LF) _IEQuit($processpage) Exit EndIf _IEQuit($loginpage) _IEQuit($processpage) This I've noticed opens an instance of Internet Explorer to perform the work which obviously can be a bit resource intensive. I'd like to find another way of doing this, is there such a way to just send a webpage the revelant url with login details to create a cookie to then allow me to just navigate to collect the source from my users page? I've tried to use _INetGetSource($myURL, 'true') to get the source which works fine but of course I cannot use this unless I have a nice way of passing the login details to the first page to give me access to this second page. Any ideas?? Kind regards, Rob
  10. Thanks a lot i'll read into these and get back to this post if i need some help! Thanks again!
  11. Hi, I have written a large AutoIT script which monitors multiple aspects of a program. It is contains service checking as well as specific db connection and look ups. Currently the way I've designed this is to define each of these functions on one script and then write a separate script with an include to call them. I would like to find a way that I can schedule certain functions within this script at different times to others. I am aware that I can compile this script and use windows scheduler to call it but I wanted to know if there is a way I can call specific functions or parts of the script without having to compile multiple different exes? Thanks, Rob
  12. Hi Bob, That seems pretty straight forward, I've amended your script to my settings and my script didn't error, I presume this has made a connection successfully. I have wrote a simple select statement in the $sqlcmd=" section but am unsure as to how I'd get this information it's querying to display. Would you be able to show me that one last thing so I can ensure I am definitely getting connection to the DB then I'll have to take it from there. Thanks a lot, very much appreciated. Rob
  13. Hi, I'm incredibly new to the AutoIT world but have managed to put together a few simple scripts. Now I have a need to use AutoIT to connect to a Microsoft SQL database and run a query on a table then export the results somewhere. So far I've read numerous articles about _sql.au3, ADO, COM etc and if I'm honest I don't have much of a clue! Would anyone be able to guide me towards creating a simple script? Kind regards, Rob
×
×
  • Create New...