From da05fa0415116d7781b7c04f096a1383f13a953f Mon Sep 17 00:00:00 2001 From: Matt Miller Date: Thu, 3 Nov 2005 04:43:19 +0000 Subject: [PATCH] somewhat gracefully handle missing ossl, fix missing method git-svn-id: file:///home/svn/incoming/trunk@3014 4d416f70-5f16-0410-b530-b9f4589650da --- lib/rex/proto/smb/crypt.rb | 9 +++++++-- lib/rex/socket/ssl_tcp.rb | 7 ++++++- lib/rex/ui/text/input/stdio.rb | 5 +++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/rex/proto/smb/crypt.rb b/lib/rex/proto/smb/crypt.rb index 346c5ba006..92134f8e80 100644 --- a/lib/rex/proto/smb/crypt.rb +++ b/lib/rex/proto/smb/crypt.rb @@ -1,10 +1,11 @@ -require 'openssl' - module Rex module Proto module SMB class Crypt +begin + require 'openssl' + def self.lanman_des(pass, chal) e_p24( [ e_p16( [ pass.upcase()[0,14] ].pack('a14') ) ].pack('a21'), chal) end @@ -53,6 +54,10 @@ class Crypt def self.md5_hash(data) digest = OpenSSL::Digest::Digest.digest('md5', data) end + +rescue LoadError +end + end end end diff --git a/lib/rex/socket/ssl_tcp.rb b/lib/rex/socket/ssl_tcp.rb index d17ada7337..4f2e8c387d 100644 --- a/lib/rex/socket/ssl_tcp.rb +++ b/lib/rex/socket/ssl_tcp.rb @@ -1,4 +1,3 @@ -require 'openssl' require 'rex/socket' ### @@ -9,6 +8,9 @@ require 'rex/socket' ### module Rex::Socket::SslTcp +begin + require 'openssl' + include Rex::Socket::Tcp ## @@ -75,4 +77,7 @@ protected attr_accessor :sslsock, :sslctx +rescue LoadError +end + end diff --git a/lib/rex/ui/text/input/stdio.rb b/lib/rex/ui/text/input/stdio.rb index f755344921..7dab7accf6 100644 --- a/lib/rex/ui/text/input/stdio.rb +++ b/lib/rex/ui/text/input/stdio.rb @@ -14,6 +14,11 @@ class Input::Stdio < Rex::Ui::Text::Input return $stdin.gets end + def _print_prompt(prompt) + $stdout.print(prompt) + $stdout.flush + end + def eof? return $stdin.eof? end