Jump to content

hevoxer

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by hevoxer

  1. Hi. I had the same problem and resolve them but in another way. Look: here and here: if you click second link, one post above there will be code with POP3 functions that dont deal with ssl, but with stunnel they will work. Regards
  2. Thanks FlutterShy! It is easy to do that these functions to work with SSL. All we need is install stunnel. Configure it in that way: [POP3 configuration] <- This is comment about what below lines apply to client = yes ;This means that stunnel works in client mode accept = 127.0.0.1:110 ;Port number on our machine on which stunnel will be listen to incoming non-ciphered connection. By default if POP3 is non secured 110 is the port on which it works. That could be any other free port. connect = you.email.ssl.service.provider:995 As I describe here To connect with POP3 ssl server we call _POP3Connect("username","pass","127.0.0.1","110"). Easy to do! :-) Remember to comment-out Example section in the beginning of the script. FlutterShy Thanks for the code, You saved me a lot of work.
  3. This functions don't works properly in my case. It seems that problem is in stdoutread when using openssl running as child process in cmd window. I don't know what exactly, but something is buggy with communication in that way, sending some characters to cmd active window sometimes unblock something and StdoutRead works but this is unreliable. The same method of fixing bug I saw in script when I look closer to it. I spend a lot of hours trying to solve this problem and I gave up. Finally, I started to search some other method to connect with POP3 server using SSL, and I found :-D. Everything what is needed is stunnel program which was written by my fellow-countryman Michał Trojnara. This program wrapped around POP3 protocol (and others protocols too) in SSL. You must only write few line in configuration file, and start this program as Windows service and connect to your localhost first time using for example putty to try manually how it works and second time you can write some AutoIt script with TCPStartup(), TCPConnect(), TCPSend(), TCPRecv(), TCPShutdown() commands. It is realy simple and no problems with outputs data which are receiving with TCPRecv() to string variable. Configuration file for stunnel for POP3. First backup existing file - copy it and change name. ---------------------------------------------------------------- STUNEL CONFIGURATION FILE ------------------------------------ ; Sample stunnel configuration file for Win32 by Michal Trojnara 2002-2012 ; Some options used here may be inadequate for your particular configuration ; This sample file does *not* represent stunnel.conf defaults ; Please consult the manual for detailed description of available options ; ************************************************************************** ; * Global options * ; ************************************************************************** ; Debugging stuff (may useful for troubleshooting) ;debug = 7 ;output = stunnel.log ; Disable FIPS mode to allow non-approved protocols and algorithms ;fips = no ; ************************************************************************** ; * Service defaults may also be specified in individual service sections * ; ************************************************************************** ; Certificate/key is needed in server mode and optional in client mode cert = stunnel.pem ;key = stunnel.pem ; Authentication stuff needs to be configured to prevent MITM attacks ; It is not enabled by default! ;verify = 2 ; Don't forget to c_rehash CApath ;CApath = certs ; It's often easier to use CAfile ;CAfile = certs.pem ; Don't forget to c_rehash CRLpath ;CRLpath = crls ; Alternatively CRLfile can be used ;CRLfile = crls.pem ; Disable support for insecure SSLv2 protocol options = NO_SSLv2 ; Workaround for Eudora bug ;options = DONT_INSERT_EMPTY_FRAGMENTS ; These options provide additional security at some performance degradation ;options = SINGLE_ECDH_USE ;options = SINGLE_DH_USE ; ************************************************************************** ; * Service definitions (at least one service has to be defined) * ; ************************************************************************** ; Example SSL server mode services ;[pop3s] ;accept = 995 ;connect = 110 ;[imaps] ;accept = 993 ;connect = 143 ;[ssmtp] ;accept = 465 ;connect = 25 ; Example SSL client mode services [pop3] ;This is about what below lines apply to client = yes ;This means that stunnel works in client mode accept = 127.0.0.1:110 ;Port number on our machine on which stunnel will be listen to incoming non-ciphered connection. By default if POP3 is non secured 110 is the port on which it works. That could be any other free port. connect = poczta.o2.pl:995 ;on this server and port, stunnel redirect connection incoming on localhost 110 but now it will be ssl secured. And that's it! CHANGE SERVER NAME TO YOUR OWN!!! ;[gmail-imap] ;client = yes ;accept = 127.0.0.1:143 ;connect = imap.gmail.com:993 ;[gmail-smtp] ;client = yes ;accept = 127.0.0.1:25 ;connect = smtp.gmail.com:465 ; Example SSL front-end to a web server ;[https] ;accept = 443 ;connect = 80 ; "TIMEOUTclose = 0" is a workaround for a design flaw in Microsoft SSL ; Microsoft implementations do not use SSL close-notify alert and thus ; they are vulnerable to truncation attacks ;TIMEOUTclose = 0 ; vim:ft=dosini ------------------------------------------------- END STUNEL CONFIGURATION FILE --------------------------------------- Now. Install stunnel service, run stunnel service. Now we can run putty and connect to localhost using telnet but on port 110 and we will see +OK your.email.service.provider Ready next login with USER username +OK PASS password +OK LIST .... etc... The same sequence of commands we can send with TCP autoit function and write errors handling if someting is not correct. Easy ehh??!! :-) Sample of code in which I took only a positive scenario, it saves content of email nr 2 in C:file.txt. Target server is poczta.o2.pl, popular polish email service provider. Config file looks like that: ;[POP3 configuration] <- This is comment about what below lines apply to client = yes ;This means that stunnel works in client mode accept = 127.0.0.1:110 ;Port number on our machine on which stunnel will be listen to incoming non-ciphered connection. By default if POP3 is non secured 110 is the port on which it works. That could be any other free port. connect = poczta.o2.pl:995 Global $LOGIN="username_login" Global $PASS="password_123" Global $TIMEOUT=5000; TCPStartup() $SOCKET=TCPConnect("127.0.0.1","110") sleep($TIMEOUT);time for server to respond $receive=TCPRecv($SOCKET,65536); ;MsgBox(1,"",$receive) If StringRegExp($receive,"+OKsPOP3spoczta.o2.plsReady",0) Then MsgBox(1,"","Connected with poczta.o2.pl!",1); Else MsgBox(1,"","Error when connecting with poczta.o2.pl",1); EndIf sleep(1000); $request="USER "&$LOGIN&@CRLF TCPSend($SOCKET,$request); sleep($TIMEOUT);time for server to respond $receive=TCPRecv($SOCKET,65536) If StringRegExp($receive,"+OK",0) Then MsgBox(1,"","Login correct",1); Else MsgBox(1,"","Login incorrect",1); EndIf sleep(1000); $request="PASS "&$PASS&@CRLF TCPSend($SOCKET,$request); Sleep($TIMEOUT);time for server to respond $receive=TCPRecv($SOCKET,65536) If StringRegExp($receive,"+OK",0) Then MsgBox(1,"","Password correct",1); Else MsgBox(1,"","Password incorrect",1); EndIf sleep(1000); $request="RETR 2"&@CRLF TCPSend($SOCKET,$request) Sleep($TIMEOUT) $receive=TCPRecv($SOCKET,65536) $hwnd=FileOpen("C:mail.txt",2) FileWrite($hwnd,$receive); FileClose($hwnd); sleep(1000); $request="QUIT"&@CRLF TCPSend($SOCKET,$request); Sleep($TIMEOUT) $receive=TCPRecv($SOCKET,65536) If StringRegExp($receive,"+OK",0) Then MsgBox(1,"","POP3 session complete."); TCPShutdown() Great ready UDF's are here:
  4. ok, thanks! I also think so, maybe there is something wrong with dll library? I checked including resources with AutoIt3Wrapper v.2.0.1.24 and finally everything is fine, uff. I see my strings in message box. The strangest thing is that on the autoitscript download page ('http://www.autoitscript.com/site/autoit-script-editor/downloads/') there is still version 2.0.0.1 inside ScieTe install package and the newest Wrapper to download as separate file is 2.0.1.24. From where did you get version 2.0.1.34? At the end I would like to thank you taiatel for your attention without it I will never solve my problem.
  5. Starting AutoIt3Wrapper v.2.0.0.1 Environment(Language:0415 Keyboard:00000415 OS:WIN_XP/Dodatek Service Pack 3 CPU:X86 OS:X86) interesting what cause this bug?
  6. I have compiled script to exe without UPX compression and there is my string inside, so function _ResourceGetAsString() didn't work
  7. Ohh, I forgot that the exe is compressed ;p thats why I didn't saw my string
  8. taietel, thanks for trying to help but this don't solve my problem. I checked the exe file with hex editor and there is no string from txt file so the conclusion is that the converter au3 2 exe didn't include resource.
  9. I have a problem with including resources into the exe file, I don't know what I'm doing wrong. Sample of code (very simple): #AutoIt3Wrapper_Res_File_Add=imie.txt, rt_rcdata, FILE0 #include <resources.au3> $text=_ResourceGetAsString("FILE0") MsgBox(0,'',$text) Why this don't work?! Why why why??? resources.au3 file is in "include" directory and in the same directory as the file imie.txt is. Thank you all for AutoIt
×
×
  • Create New...