Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/09/2018 in all areas

  1. Hi, guys, I want to share my findings and hard work with the community. I wanted to disconnect an OpenVPN connection. There're two options. Option 1: kill process openvpn.exe. Option 2: send 'signal SIGTERM' (graceful exit). Let's work option 2. I need to start openvpn.exe with '--management IP port' option to enable the management interface. http://openvpn.net/index.php/open-source/documentation/manuals/65-openvpn-20x-manpage.html Because I want my script to interact and know all the status messages, I need to access stdin/stdout streams. My first idea was to use Windows Telnet client. (You have to install it via Control Panel > Windows Features). AutoIt manages correctly the I/O streams with Run(), $STDIN_CHILD + $STDOUT_CHILD options, and StdoutRead, StdinWrite functions. I can start a console with Run(@ComSpec & " /k telnet") and interact till the Telnet> prompt, but after sending the 'open localhost 7505' command, the stream stops responding. After hours trying, I learned that Windows Telnet can't redirect (pipe output) stdin/stdout. Here's an explanation: http://comp.terminals.narkive.com/oHwvdYmf/hang-crash-in-plink-with-windows-telnet-server I delved into this forum looking for telnet info. First suggestion was to use an alternative program called 'Console Telnet' http://consoletelnet.sourceforge.net/, and use the script by 'Chimp' Also '?do=embed' frameborder='0' data-embedContent>> I tried ConsoleTelnet directly (standalone exe) but, after connecting to OpenVPN, the console stops the keyboard input. (I don't know what strange configuration I'm missing.) Then I tried the script. It connects, but then no more data can be sent. Update: I tested the ConsoleTelnet + script with a public telnet server and it worked. Finally, I found out that the problem was with the termination characters! Keep in mind that some servers (localhost Windows) require @CRLF. If you just send a @CR, it will hang. So the correction is: StdinWrite(pid, "cmd" & @CRLF). Remember to edit config file 'telnet.ini' and enable option Telnet_Redir=1. Desperated, I opted for the quick-and-dirty workaround of reading the console by copying to the clipboard. Send("!{SPACE}ES") Send("{ENTER}"). But I wasn't willing to give up, and continued my research. I tried third-party consoles dtelnet.sourceforge and console.sourceforge, but cannot redirect stdin/stdout. Finally I stumbled upon plink.exe (a command-line interface to the PuTTY back end). http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html plink -raw -P 7505 localhost But it happened as with ConsoleTelnet: keyboard input stucks after connection to OpenVPN. I even tried with netcat. It works as standalone (netcat localhost 7505) but there's a problem with I/O stream piping with AutoIt. After an exhausting day, I finally decided to give TCP a try. And it worked! with just a few lines of code. Here is the minimalistic version. You should add more code to watch for errors. TCPStartup() $Socket = TCPConnect("127.0.0.1", 7505) ;ConsoleWrite(TCPRecv($Socket, 500)) Sleep(3000) TCPSend($Socket, "signal SIGTERM" & @CRLF) ;ConsoleWrite(TCPRecv($Socket, 500)) TCPCloseSocket($Socket) TCPShutdown() Here is the connection snippet. $cmd = 'openvpn --config "C:\Program Files (x86)\OpenVPN\config\myconfig.ovpn" --remote 1.2.2.4 443 --management localhost 7505' $pid = Run(@ComSpec & " /c " & $cmd, "", @SW_HIDE, $STDOUT_CHILD) Local $line While 1 $line = StdoutRead($pid) If @error Then ExitLoop ConsoleWrite($line) If StringInStr($line, "Initialization Sequence Completed") Then ExitLoop Sleep(100) WEnd If ProcessExists($pid) Then ProcessClose($pid) ProcessWaitClose($pid, 5) EndIf I hope this info will be useful for someone, somewhere, sometime.
    2 points
  2. ok. I will be back in office tomorrow to look further at it. I bet some hot shot here answers it faster/better though.
    1 point
  3. im gonna look at it too. thanks,
    1 point
  4. I am willing to bet dollars to donuts that if you post your code, even not working code, that someone, nay, several code guru's will probably work it out or help you
    1 point
  5. I would love to help but my RegEx skillz positively stink. However, I bet that the guru's will spot this and have an answer at some point soon. This sure looks like a regular expression search through an array to me.
    1 point
  6. i am using UISpy for object finding. in large script i have mixed. in large script both objects not highlighted. i am trying to get log and see what it comes up and then i will update you guys. thanks for help
    1 point
  7. I think you answered your question with the additional information that you provided. You need to spend some time understanding the differences between SQLite and other relational databases like MySQL, MS SQL, Oracle, etc. First of all, SQLite does not have a datatype or storage type of DATE. Everything in a SQLite database is stored as either null, text, blob (binary), or a number (real or integer). Second, if you read the sqlite documentation on the datetime function, you will see that "mm/dd/yyyy hh:mm:ss" is not an acceptable time string. If you do not want to have to go thru all sort of conversion gymnastics, it would be much easier to store your dates in a commonly accepted SQLDATE format (YYYY-MM-DD HH:MM:SS) or numeric format like Julian or Epoch. As far as SQLite is concerned, your dates are strings and are being sorted as such. Obviously it cannot sort your dates correctly if the are stored in a MM/DD/YYYY format. You can start learning more about SQLite datatype and date/time functions by going to the following links: https://www.sqlite.org/datatype3.html https://www.sqlite.org/lang_datefunc.html
    1 point
  8. I'll definitely be taking a look at WinTask. I wonder how it compares to UIPath?
    1 point
  9. And, looking into WinTask, that looks like an amazing wrapper for UIAutomation using a VB syntax and a script generator/recorder. $299 for two years support, but it might be well worth it. I know i could whip up all the regression scripts for our products fast with it, and, if it worked with our old VB6 apps and controls, it would rule. this research lead me to that product. It can easily handle any WPF or WinForms, I am going to get the free trial to see if I can automate that horrid vb6 ocx.
    1 point
  10. AZWDrop updated to v2.0 - Just an update for the Dropbox part of the program, so still requires AZWPlug itself. See Post #3. NOTES - No doubt this update will be included in the next full update of AZWPlug (i.e. v4.0). P.S. AZWPlug was developed on my old Win XP Laptop with AutoIt v3.3.0.0. and still updated there. AZWDrop on the other hand, was created on my Win 7 Netbook with AutoIt v3.3.14.2 and is updated there. A marriage blessed by Dog and celebrated by all Donuteers everywhere. P.S.S. Uploaded from my Win 7 Netbook .... in case you were wondering.
    1 point
  11. Thanks for the reply but I managed to get it working through Task scheduler. I compiled a new script which kills all the necessary processes and set it to trigger on user disconnecting from session in Task Scheduler. Seems to work seamlessly.
    1 point
  12. There is a library written specifically for dealing with Outlook. Take a look at the links below: OutlookEX UDF Help and Support topic for Outlook UDF (read through the questions and you will find many examples doing just what you're trying to do) Outlook UDF Examples Wiki - Many Examples of what you can do with the UDF Read through some of these, try the examples out on your own. If you run into issues, please post your code and we will do our best to help
    1 point
  13. try https://docs.microsoft.com/en-us/sysinternals/downloads/autoruns If you still can't find it Don't forget to uncheck the hide microsoft entries option
    1 point
  14. Bilgus

    How to pause this script

    Where is the functionality for once notPaused = true?? Edit: Ah nevermind I see where you made it not update Mouse Move.. Something like this.. Global Enum $iState_None = 0, $iState_Paused = 1, $iState_Running = 2 Global $iState = $iState_None Global $sDots = "." HotKeySet("{ENTER}", _Start) HotKeySet("{ESC}", _Pause) While True ;Endless loop Sleep(250) WEnd Func _Start() If $iState = $iState_None Then ;Keeps start from being called multiple times $iState = $iState_Running While True ;Endless loop While $iState = $iState_Running ;Loop for running state $pxs = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0xFFFFFF) If IsArray($pxs) And $iState = $iState_Running Then MouseMove($pxs[0], $pxs[1], 0) ;MouseClick("Left") EndIf WEnd While $iState = $iState_Paused ;Sit in a loop for paused state $sDots &= "." If StringLen($sDots) > 10 Then $sDots = "." ToolTip("Paused" & $sDots) ;Tooltip @ cursor position Sleep(250) WEnd ToolTip("") ;Erases tooltip WEnd ElseIf $iState = $iState_Paused Then _Pause() ;Could toggle the state here as well EndIf EndFunc Func _Pause() If $iState <> $iState_None Then ;Not running yet disable Pause... If $iState = $iState_Paused Then $iState = $iState_Running ToolTip("Running") ;Tooltip @ cursor position Else $iState = $iState_Paused EndIf EndIf EndFunc
    1 point
  15. just have a control variable in your loop, and have your hotkey function (pause) toggle that value. HotKeySet ("{ENTER}", "Start") HotKeySet ("{ESC}", "_Paused") While 1 Sleep(250) WEnd Func Start() $notPaused = true While 1 $pxs = PixelSearch(0,0,1919.1078,959.541,0x01FF00) If isArray($pxs) and $notPaused then MouseMove($pxs[0],$pxs[1], 0) MouseClick("Left") EndIf WEnd EndFunc Func _Paused() $notPaused = !$notPaused EndFunc syntax may be wrong, but that's what you're going for. I haven't kept up with this language in a while, so i'm not sure if you can do !$notPaused like that, but if not you can just do an if $notPaused then $notPaused = false else $notPaused = true endif or whatever
    1 point
  16. @Digdeep I found it more reliable to use netsh Func FirewallBlockOutbound($sName, $sPath) ;msgbox(0,$sName,"netsh advfirewall firewall add rule name = " & $sName & " dir = out action = block program = " & Chr(34)& $sPath & Chr(34)& " enable = yes") RunWait(@ComSpec & " /c " & "netsh advfirewall firewall delete rule name = " & Chr(34) & $sName & Chr(34) & " program = " & Chr(34) & $sPath & Chr(34) & " dir = out", "", @SW_HIDE) Run(@ComSpec & " /c " & "netsh advfirewall firewall add rule name = " & Chr(34) & $sName & Chr(34) & " dir = out action = block program = " & Chr(34) & $sPath & Chr(34) & " enable = yes", "", @SW_HIDE) ; don't forget " " before "/c" Sleep(100) EndFunc ;==>FirewallBlockOutbound Func FirewallAllowOutbound($sName, $sPath) ;msgbox(0,$sName,"netsh advfirewall firewall add rule name = " & $sName & " dir = out action = allow program = " & Chr(34)& $sPath & Chr(34)& " enable = yes") RunWait(@ComSpec & " /c " & "netsh advfirewall firewall delete rule name = " & Chr(34) & $sName & Chr(34) & " program = " & Chr(34) & $sPath & Chr(34) & " dir = out", "", @SW_HIDE) Run(@ComSpec & " /c " & "netsh advfirewall firewall add rule name = " & Chr(34) & $sName & Chr(34) & " dir = out action = allow program = " & Chr(34) & $sPath & Chr(34) & " enable = yes", "", @SW_HIDE) ; don't forget " " before "/c" Sleep(100) EndFunc ;==>FirewallAllowOutbound Func FirewallBlockInbound($sName, $sPath) ;msgbox(0,$sName,"netsh advfirewall firewall add rule name = " & $sName & " dir = in action = block program = " & Chr(34)& $sPath & Chr(34)& " enable = yes") RunWait(@ComSpec & " /c " & "netsh advfirewall firewall delete rule name = " & Chr(34) & $sName & Chr(34) & " program = " & Chr(34) & $sPath & Chr(34) & " dir = in", "", @SW_HIDE) Run(@ComSpec & " /c " & "netsh advfirewall firewall add rule name = " & Chr(34) & $sName & Chr(34) & " dir = in action = block program = " & Chr(34) & $sPath & Chr(34) & " enable = yes", "", @SW_HIDE) ; don't forget " " before "/c" Sleep(100) EndFunc ;==>FirewallBlockInbound Func FirewallAllowInbound($sName, $sPath) ;msgbox(0,$sName,"netsh advfirewall firewall add rule name = " & $sName & " dir = in action = allow program = " & Chr(34)& $sPath & Chr(34)& " enable = yes") RunWait(@ComSpec & " /c " & "netsh advfirewall firewall delete rule name = " & Chr(34) & $sName & Chr(34) & " program = " & Chr(34) & $sPath & Chr(34) & " dir = in", "", @SW_HIDE) Run(@ComSpec & " /c " & "netsh advfirewall firewall add rule name = " & Chr(34) & $sName & Chr(34) & " dir = in action = allow program = " & Chr(34) & $sPath & Chr(34) & " enable = yes", "", @SW_HIDE) ; don't forget " " before "/c" Sleep(100) EndFunc ;==>FirewallAllowInbound
    1 point
  17. Melba23

    New MVPs

    Hi, Some good news today: Danp2, RTFC and junkew have accepted the invitation to become MVPs. I am sure you will all join me in congratulating them on their new status. M23
    1 point
  18. Version 1.0.0.0

    1,676 downloads

    ADAT is a tool to simplify common AD administration tasks. Every administration task has its own tab. It is easy to add new functions (tabs) to the tool. Some often used functions are already available: list users, computers, OUs. File ADAT.ini can be customized to hold the AD logon information if necessary. Known Bugs: 2018-03-07: If the Script started from SciTE works but the "Process" button in the compiled exe does not do anything then please add the following line at the top of your script: #Au3Stripper_Ignore_Funcs=Process_Tab* BTW: If you like this tool please click the "I like this" button. This tells me where to next put my development effort
    1 point
  19. Jon

    Forum Rules

    We want the forum to be a pleasant place for everyone to discuss AutoIt scripting, and we also want to protect the reputation of AutoIt. So we ask you to respect these simple rules while you are here: Forum Posting 1. Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects: Malware of any form - trojan, virus, keylogger, spam tool, "joke/spoof" script, etc. Bypassing of security measures - log-in and security dialogs, CAPTCHAs, anti-bot agents, software activation, etc. Automation of software/sites contrary to their EULA (see Reporting bullet below). Launching, automation or script interaction with games or game servers, regardless of the game. Running or injecting any code (in any form) intended to alter the original functionality of another process. Decompilation of AutoIt scripts or details of decompiler software. This list is non-exhaustive - the Moderating team reserve the right to close any thread that they feel is contrary to the ethos of the forum. 2. Do not post material that could be considered pornographic, violent or explicit - or express personal opinions that would not be acceptable in a civilized society. Do not post any copyrighted material unless the copyright is owned by you or by this site. 3. To protect this community, any files posted by you are subject to checks to ensure that they do not contain malware. This includes, but is not limited to, decompilation and reverse engineering. 4. Do not flame or insult other members - and just report the thread to a Moderator (see below) if you are so attacked. 5. Do not PM other users asking for support - that is why the forum exists, so post there instead. 6. Do not create multiple accounts - if you inadvertently created multiple accounts then contact a Moderator to close the unwanted ones. 7. Do not repost the same question if the previous thread has been locked - particularly if you merely reword the question to get around one of the prohibitions listed above. 8. Do not delete your posts, nor completely remove their content, if doing so will interrupt the flow of the thread. 9. Do not post in a thread while the Moderating team are actively trying to determine whether it is legal. The Moderation team will do their best to act in fair and reasonable manner. Sanctions will only be applied as a last resort and any action taken will be explained in the relevant thread. If moderation action is taken, you will need to acknowledge this through a dialog or you will be unable to post further in the forum. Please note that this dialog is not an agreement that the warning was justified - it is only there so that members are aware that moderation action has been taken and that they may have certain restrictions applied to their account. If you feel that you have been unfairly moderated then contact the Moderator concerned - using a PM or the "Report" button is preferable to opening a new thread (although new members may have to do this). But do be aware that the Moderation team has the final word - the rules are set out by the site owner and you are only welcome here if you respect his wishes. Signatures and Avatars There is no formal policy for the use of signatures but if a moderator thinks it is too big and/or distracting then you may be asked to tone it down. No-one likes wading through signatures that are a page high. Similarly for avatars, expect distracting flashing and animated gifs to be removed. Reporting If you feel a post needs Moderator attention, please use the "Report" button next to the post date at the top. You can then enter details of why you have reported the post - but there is no need to include the content of the post as that is done automatically. The Moderating team will be alerted to the post and will deal with it as soon as they can. If you suspect a EULA violation, do not expect the Moderating team to do all the work - please provide some evidence in the report such as a copy of (or link to) the EULA in question, as well as the section you believe has been violated. Finally, please do not enter into an argument with the original poster - that is why we have Moderators. Spam Please do not react to spam in any way other than reporting it. Multiple reports are combined by the forum software, so there is no need to announce that you have reported the spam - in fact doing so only increases the work for the Moderator who deals with it. Interacting with this website Anyone found abusing the website is subject to harsh punishment without warning. A non-exhaustive list of potential abuses include: Automated forum registration or login. Automated posting or sending messages on the forum. Automated manipulation of polls, user reputation or other forum features. Automated creation or comments on issue tracker tickets. Automated creation or editing of wiki pages. Other abuses which are either examples of excessive bandwidth usage or automation of the site. Use common sense. If you do not have common sense, don't do anything. Do not automate the forum, wiki or issue tracker in any way at all. Scripts which automatically update AutoIt such as AutoUpdateIt are acceptable as long as they are not abused and do not generate excessive bandwidth usage.
    1 point
×
×
  • Create New...