Jump to content

SSL Gmail with OpenSSL


mikeytown2
 Share

Recommended Posts

I have some problems with example script. Each time I run it _GetMessage(1) show different mail... seems I dont know how it works, OpenSSL docs arent so clear and smooth like AutoIT docs :mellow:. I want to make two applications using SSL: one for receiving unreaded mails and second for checking my bank account. Started some research today and didnt expected it will be so hard... I will read about POP3 now

Edited by ViRnik
Link to comment
Share on other sites

  • Replies 63
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I have some problems with example script. Each time I run it _GetMessage(1) show different mail...

It's because it's marking that email as read. I should probably have a PeekMessage() function. I'll be gone till mid December so if anyone wants to code it, do it, otherwise I'll pick this up in 3-4 weeks.

The bank account would best be handled by something like the IE functions. Using OpenSSL to do it, although possible, is kinda nuts.

Link to comment
Share on other sites

It's because it's marking that email as read. I should probably have a PeekMessage() function. I'll be gone till mid December so if anyone wants to code it, do it, otherwise I'll pick this up in 3-4 weeks.

The bank account would best be handled by something like the IE functions. Using OpenSSL to do it, although possible, is kinda nuts.

Thanks, reading POP specs really helps :mellow:

Link to comment
Share on other sites

  • 1 month later...

Thank you for this great code. I tried to run SSL example code in Autoit after I install the openssl listed in the first post and vc++ distributable software which I don't have in my computer. But after I ran the Pop SSL code, I got the openssl problem windown pop up saying "openssl.exe has encountered a problem and needs to close". Autoit also printed out the message:

Read : Loading 'screen' into random state -

ReadBuffer_Lock ran 0 times

Connection Failed

Write: USER xxxxxx

Read : ReadBuffer_Lock ran 251 times

Wrong Username

Write: STAT

Read : ReadBuffer_Lock ran 251 times

Stats Not Available

Is that openssl problem window caused by the action of "close the process" in the code?

Link to comment
Share on other sites

Thank you for this great code. I tried to run SSL example code in Autoit after I install the openssl listed in the first post and vc++ distributable software which I don't have in my computer. But after I ran the Pop SSL code, I got the openssl problem windown pop up saying "openssl.exe has encountered a problem and needs to close". Autoit also printed out the message:

...

Is that openssl problem window caused by the action of "close the process" in the code?

It's an OpenSSL problem

Run the test command from ptrex, and let me know what it says

http://www.autoitscript.com/forum/index.ph...st&p=592662

Link to comment
Share on other sites

No matter what I use or put in, Gmail always returns "Bad Username/Password"...

I've done username@gmail.com and just "username", my port is 995 and even when I use the AutoIt example code it fails as well. What am I missing/forgetting?

Key-Arg : None
Start Time: 1230675117
Timeout : 300 (sec)
Verify return code: 21 (unable to verify the first certificate)
---
+OK Gpop ready for requests from 175.216.43.7 k35pf15223467waf.31
ReadBuffer_Lock ran 1 times
Write: PASS password123
Read : ReadBuffer_Lock ran 251 times

Sent in a bad username/password
Write: QUIT
+>16:12:27 AutoIT3.exe ended.rc:0
+>16:12:28 AutoIt3Wrapper Finished
Edited by Yorn
Link to comment
Share on other sites

Not that it's a huge deal, but this seems to have quit working for me entirely, though Friday it was working fine when I changed your example AU3 to include "POP_ssl_V3.1.au3" instead of "POP_ssl_V3.0.au3"

Read : Loading 'screen' into random state -
ReadBuffer_Lock ran 13 times

Connection Failed
Write-GUI: QUIT

Edit: also weird, it works if I do this instead of the POPConnect function:

$_POP_RunPID = Run(@ComSpec & " /c " & $SSL_Exe_loc & " s_client -crlf -ign_eof -connect " & $POP_Server & ":" & $POP_Port, "", @SW_HIDE, $STDOUT_CHILD + $STDIN_CHILD + $STDERR_CHILD + $STDERR_MERGED)
Edited by Yorn
Link to comment
Share on other sites

POP has no search command

Thus you would have to download every message and search it locally, if you wanted to find a specific message.

The other option would be to code to the google api; and execute the search remotely -- of course, this has nothing whatsoever to do w/ pop/smtp.

@mikey...

Great work -- i've been using stunnel w/ blat -- I like the idea of a more native solution. Will play with it as I get time.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

  • 2 months later...

Mikey,

When I try your code, I get the following error in my console:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Program Files\AutoIt3\Examples\Helpfile\SMTP_ssl_V3.1_Example.au3"    
Read : Loading 'screen' into random state -
ReadBuffer_Lock ran 10 times

Connection Failed
Write: AUTH LOGIN
Read : CONNECTED(00000750)
---
Certificate chain
0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=smtp.gmail.com
i:/C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Consulting cc/OU=Certification Services Division/CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIDYzCCAsygAwIBAgIQUR2EgGT4+hGKEhCgLMX2sjANBgkqhkiG9w0BAQUFADCB
zjELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJ
Q2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UE
CxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhh
d3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNl
cnZlckB0aGF3dGUuY29tMB4XDTA3MDczMDAwMDAwMFoXDTEwMDcyOTIzNTk1OVow
aDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDU1v
dW50YWluIFZpZXcxEzARBgNVBAoTCkdvb2dsZSBJbmMxFzAVBgNVBAMTDnNtdHAu
Z21haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD+RiG+G3Mo9Q9C
tcwDjpp6dJGifjiR5M2DbEbrsIOlth80nk5A7xstKCUfKobHkf/G9Y/DO24JP5yT
s3hWep05ybyiCmOzGL5K0zy3jIq0vOWy+4pLv2GsDjYi9mQBhobAAx3z38tTrTL+
WF4p0/Kl014+wnukIpj4MdF35rIkgQIDAQABo4GmMIGjMB0GA1UdJQQWMBQGCCsG
AQUFBwMBBggrBgEFBQcDAjBABgNVHR8EOTA3MDWgM6Axhi9odHRwOi8vY3JsLnRo
YXd0ZS5jb20vVGhhd3RlUHJlbWl1bVNlcnZlckNBLmNybDAyBggrBgEFBQcBAQQm
MCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnRoYXd0ZS5jb20wDAYDVR0TAQH/
BAIwADANBgkqhkiG9w0BAQUFAAOBgQBeNYOZwMVQ7bd6b4sueAkgm57Cyv2p1Xv1
52e8bLnWqd03mWgn/+TQtrwbE1E6pVuQaZJY33ILpt8IfzwVf2TGQI+M5yazZ2fC
xwArHo20iAss3MLQR8tDXWfBoH2Lk9BBsEKDRP4hp83yfpZgdY3pinHTCbqHpsiS
v97epiiFBA==
-----END CERTIFICATE-----
subject=/C=US/ST=California/L=Mountain View/O=Google Inc/CN=smtp.gmail.com
issuer=/C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Consulting cc/OU=Certification Services Division/CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com
---
No client certificate CA names sent
---
SSL handshake has read 1017 bytes and written 306 bytes
---
New, TLSv1/SSLv3, Cipher is RC4-MD5
Server public key is 1024 bit
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1
Cipher : RC4-MD5
Session-ID: 2F6A5594FFA11D037BF63A5C930D670452EE5915E3308A67FF4A2146B7B5A3EA
Session-ID-ctx: Master-Key: F6EEB5FBAF4439E1FBEFCDE25ECCCD2F3BCF026FBF20E0FAADC9258881DEA0CFDA8F27A3E3E6A9644CD19D01E99B8B01
Key-Arg : None
Start Time: 1237916387
Timeout : 300 (sec)
Verify return code: 21 (unable to verify the first certificate)
---
220 mx.google.com ESMTP b37sm3455606ana.37
ReadBuffer_Lock ran 10 times

Doesn't support Authenticated Logins
Write: MAIL FROM: <antnjen@gmail.com>
Read : ReadBuffer_Lock ran 251 times

Sent a bad From Address
Write: Quit
>Exit code: 0   Time: 29.013

Any ideas?

Thanks,

A

Link to comment
Share on other sites

  • 3 weeks later...
  • 10 months later...

Hey guys, sorry to reopen such and old thread but I'm having an issue with the POP_ssl_V3.2_Example.au3. When I run it, it will get a list of the emails in the inbox and display the first message. The next time I run it, the first message is no longer in the list. The 3rd time I run it, the 2nd message is gone and so on.

Can anyone tell me why this is?

Thanks!

Link to comment
Share on other sites

  • 5 months later...

Hi,

Not sure if this is still supposed to work?

I'm trying the example script, and i keep getting this error:

Wrong Username
Write: USER gwendolynedwardo766
Read : done
depth=1 C = US, O = Google Inc, CN = Google Internet Authority
verify error:num=20:unable to get local issuer certificate
verify return:0
read:errno=0
ReadBuffer_Lock ran 7 times

Wrong Username

which is Wrong Username but also unable to get local issuer certificate...

i'm definitely using the right username (tried both with and without @gmail.com), is there anything else i'm supposed to do?

is the unable to get local issuer certificate a problem or just a warning?

Thanks.

Link to comment
Share on other sites

  • 3 months later...

First, i know this is an old topic, however, the code still works just fine... ;)

But, there is one problem :

I have several accounts on GMail (For anti spam issues) so, i would like to clear all mails from all mail accounts every once in a while.

When connecting with the first user, i get the incoming mails and all is good.

When i disconnect from the first user and trying to connect with the next in list i get "Wrong user".

After reading a little about this issue, i discovered that the certificate is not valid for new user, and i must do "REQ -new" first to receive new certificate.

Well, This not working.

I there a solution for multiple logins from the same machine?

Or can i delete the certificate? How?

Thanks,

Ofer

Link to comment
Share on other sites

  • 2 weeks later...

Excellent job man! Just one suggestion if you have the time, XMPP!

Keep it up.

Hypoz

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...