python - How to making the smtlib.SMTP synchronous functions -
i newbie python programming. writing small smtp client testing postfix smtp server implementation. have used python smtplib same. here code snippet.
import smtplib def smtptest(serverstr, mode=1): servername = serverstr server = smtplib.smtp(servername, 25) try: server.set_debuglevel(true) server.ehlo() # if can encrypt session, if server.has_extn('starttls'): server.docmd('starttls\r\n rset') finally: print "closing smtp session ...." server.quit() if __name__ == "__main__": print "closing session ..." smtptest(<ip address of smtp server>, 1)` i using docmd() should smtp server response. trying check smtp server behavior command 'starttls\r\n rset'.
response details:- expectation smtp server, if vulnerable, should give 2 response codes in sequence. 1 starttls , other rset commands. observation server gets ready tls tunnel , code enters in block close session. conclusion server not vulnerable starttls.
my query:- if reverse command string 'rset\r\n starttls', 2 response codes. reverse string of resetting , starting tls, quit function call ends session , command display starttls appears after client sends quit command. wanted synchronize call of quit after complete response server. in case, first being rset , starttls. pointers of great help.
Comments
Post a Comment