[Tutor] Sending a disconnect after openssl s_client command?

Kayvan Sarikhani ksarikhani at gmail.com
Fri Apr 17 23:48:10 CEST 2009


Tutors,

  I'm working on a script to verify whether a particular website supports
SSLv2 via the following:

--- BEGIN ---
#!/usr/bin/python
import os, re

checkssl_out = open('checkssl.txt','w')

website = 'somewebsitename'
sslv2 = 'Protocol  : SSLv2'

print 'Checking:', website

checksslv2 = os.popen('openssl s_client -ssl2 -connect
somewebsitename:443').read().strip()

if re.search(sslv2, checksslv2) == None:
    print >> checkssl_out, website, 'does NOT support SSLv2'
else:
    print >> checkssl_out, website, 'supports: SSLv2'

checkssl_out.close()
--- END ---

  It works, but the problem is that OpenSSL does not automatically
disconnect after end of input. I was curious if there's a way to send a
CTRL-C at the end of the command, so that it *does* capture the output, and
breaks after it. Any suggestions or help is appreciated!

K
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090417/9330c06d/attachment.htm>


More information about the Tutor mailing list