Sign in to follow this  
Followers 0

Gmail Support with openssl

3 posts in this topic

#1 ·  Posted (edited)


This sends out an email using a gmail account. It connects to the sever with OpenSSL using TLS or Transport Layer Security.

In order to get this script to run you need to grab openssl

Or (its the same)

and then copy the _Base64.au3 and the ssl.au3 into C:\OpenSSL

This program redirects the cmd output to a txt file and then sends input back into the cmd window. Got the info on how to do this from here

So yes this does read the output from the command line in "real time", some said it couldn't be done... anyway if i could somehow get this hide processes method to work as well, then I think this could be quite useful.

I put in a link from Microsoft, in this thread, on how to hide processes using VBscript. I want to hide cmd.exe from the taskbar but still have the gui active (@SW_HIDE doesn't work, i can't use Send()).

But my main question is why isn't this working? it appears that openssl is flaking out on me... any ideas?

You need to fill in some variables to test this.

EDIT this example code again, files are the same

Here is the code to make it read the command line output. It appears that some commands like netstat dont output till the buffer is full, where as the openssl flushes the buffer... just some intersting points. to kill netstat from the command line use CRTL Pause. CRTL C doesn't work for some reason.

#include <file.au3>
#include <Array.au3>
opt("OnExitFunc", "endscript")
opt("WinTitleMatchMode", 2)

;kill previous run
While ProcessExists("cmd.exe")

GUICreate("Command Trace",660,400)  
$mylist=GUICtrlCreateEdit("", -1,-1, 660, 400)

;set files
$Command = "netstat -a -o 5";this is the command to run
$tempFileA = "output.txt"
$tempFileB = "run.bat"

;clean up from last run

;write bat file
$file = FileOpen($tempFileB, 2)
FileWriteLine($file, $Command)

;run bat with output sent to $tempFileA
Run($tempFileB & ' >' & $tempFileA)

;wait for window to popup
WinWait(@SystemDir & "\cmd.exe")
Dim $aArray
;$aArray = ""
;_FileReadToArray($tempFileA, $aArray)
$FileSized = 0

;###HIDES THE WINDOW### comment this line out to see the cmd window
;WinMove(@SystemDir & "\cmd.exe", "", @DesktopWidth, @DesktopHeight)

GUISetState ()

;set var's
$State_R = 0
$FileLineStart = 0
$new = 0
While 1
    _FileReadToArray($tempFileA, $aArray)
    $new = 0
    ToolTip(UBound($aArray) - 1 & @CRLF & $FileSized)
    While $FileSized < UBound($aArray) - 1
        $new = 1
        $FileSized = $FileSized + 1
    If $new = 1 Then
        For $i = $FileLineStart To UBound($aArray) - 1 Step + 1
            If StringInStr($aArray[$i], "autoitscript") And $State_R = 0 Then
                WinActivate(@SystemDir & "\cmd.exe")
                WinWaitActive(@SystemDir & "\cmd.exe")
                MsgBox(0,"Example", "Go you!")
                $State_R = 1
                $FileLineStart = $i + 1
            ElseIf StringInStr($aArray[$i], "More Output") And $State_R = 1 Then
                WinActivate(@SystemDir & "\cmd.exe")
                WinWaitActive(@SystemDir & "\cmd.exe")
                Send("Another Command{ENTER}")
                $State_R = 2
                $FileLineStart = $i + 1

Func _SmtpTrace($s_DisplayString, $i_Timeout = 0)
    GUICtrlSetData($mylist,$s_DisplayString & @CRLF, 1)

Func endscript()
    $s = MsgBox(4, "Kill Child Processes?", "Do you want to kill the command prompt?")
    If $s = 6 Then
        While ProcessExists("cmd.exe")
            WinClose(@SystemDir & "\cmd.exe")

Well i hope my lure works... check out the rest of the code


Edited by mikeytown2

Share this post

Link to post
Share on other sites

#2 ·  Posted (edited)

I found some c++ Code that redirects all command Input/Output to its gui... its only a 18k exe as well.

I wonder if autoit can do this? i peeked at the code it just makes handles to redirect the output into a buffer in memory... It looks like i could do this by using file handles, but I'm not so sure about the input, I'm all ready doing this for the output.

Any help?


Edited by mikeytown2

Share this post

Link to post
Share on other sites

Hi - Can we use this as the basis for a gmail notifier replacement.... ?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0