watobo 0.9.8.680 → 0.9.8.686

Sign up to get free protection for your applications and to get access to all the features.
data/.yardopts CHANGED
@@ -1,3 +1,24 @@
1
+ # .
2
+ # .yardopts
3
+ #
4
+ # Copyright 2012 by siberas, http://www.siberas.de
5
+ #
6
+ # This file is part of WATOBO (Web Application Tool Box)
7
+ # http://watobo.sourceforge.com
8
+ #
9
+ # WATOBO is free software; you can redistribute it and/or modify
10
+ # it under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation version 2 of the License.
12
+ #
13
+ # WATOBO is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with WATOBO; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ # .
1
22
  --no-private
2
23
  *.xxx
3
24
  - CHANGELOG
data/README CHANGED
@@ -28,8 +28,11 @@ Note: Ruby 1.8 is crap, so get rid of it!
28
28
  gem install watobo
29
29
 
30
30
  === BackTrack 5
31
- gem install selenium-webdriver
32
- gem install watobo
31
+ gem install --user-install selenium-webdriver
32
+ gem install --user-install watobo
33
+
34
+ Add the following line to your ~/.bashrc file:
35
+ export PATH=$PATH:/root/.gem/ruby/1.9.2/bin/
33
36
 
34
37
  === Generic Linux (with APT)
35
38
  * Install Ruby via RVM
data/bin/watobo ADDED
@@ -0,0 +1,2 @@
1
+ #!/bin/ruby
2
+ puts "Please use the command watobo_gui.rb to start watobo."
data/bin/watobo_gui.rb CHANGED
@@ -25,15 +25,19 @@ if $0 == __FILE__
25
25
  $: << inc_path
26
26
  end
27
27
 
28
- require 'watobo'
29
-
30
28
  puts "#############################################################"
31
29
  puts
32
- puts " W A T O B O - Web Application Toolbox (#{Watobo::VERSION})"
30
+ puts " W A T O B O - THE Web Application Toolbox"
31
+
33
32
  puts " brought to you by siberas http://www.siberas.de"
34
33
  puts
35
34
  puts "#############################################################"
36
35
 
36
+ require 'watobo'
37
+
38
+ Watobo.print_summary
39
+
40
+ puts ">> Starting GUI ..."
37
41
  require 'watobo/gui'
38
42
 
39
43
  Watobo::Gui.start
@@ -141,20 +141,20 @@ module Watobo
141
141
 
142
142
  wsp = Watobo.workspace_path
143
143
  return false unless File.exist? wsp
144
- puts "* using workspace path: #{wsp}"
144
+ puts "* using workspace path: #{wsp}" if $DEBUG
145
145
  project_path = File.join(wsp, project_name)
146
146
  unless File.exist? project_path
147
- puts "* create project path: #{project_path}"
147
+ puts "* create project path: #{project_path}" if $DEBUG
148
148
  Dir.mkdir(project_path)
149
149
  end
150
150
  session_path = File.join(project_path, session_name)
151
151
 
152
152
  unless File.exist? session_path
153
- puts "* create session path: #{session_path}"
153
+ puts "* create session path: #{session_path}" if $DEBUG
154
154
  Dir.mkdir(session_path)
155
155
  end
156
156
  sext = Watobo::Conf::General.session_settings_file_ext
157
- puts "SEXT: #{sext}"
157
+
158
158
  @session_file = File.join(session_path, session_name + sext)
159
159
  @project_file = File.join(project_path, project_name + Watobo::Conf::General.project_settings_file_ext)
160
160
 
data/lib/watobo/config.rb CHANGED
@@ -48,10 +48,8 @@ module Watobo
48
48
  file = filename unless filename.nil?
49
49
  file = File.join( Watobo::Conf::General.working_directory, n )
50
50
  if File.exist? file
51
- puts " [#{self}] update settings from file #{file}"
51
+ puts " [#{self}] update settings from file #{file}" if $DEBUG
52
52
  @settings.update YAML.load_file(file)
53
- puts @settings.to_yaml
54
- puts self.dump if $DEBUG
55
53
  else
56
54
  puts "! [#{self}] could not update settings from file #{file}" if $DEBUG
57
55
  end
@@ -88,5 +88,11 @@ module Watobo
88
88
 
89
89
  DEFAULT_PORT_HTTP = 80
90
90
  DEFAULT_PORT_HTTPS = 443
91
+
92
+ # Status Messages
93
+ SCAN_STARTED = 0x00
94
+ SCAN_FINISHED = 0x01
95
+ SCAN_PAUSED = 0x02
96
+ SCAN_CANCELED = 0x04
91
97
  end
92
98
  end
@@ -217,8 +217,10 @@ module Watobo
217
217
  begin
218
218
  t_request, t_response = doRequest(request, prefs)
219
219
  #puts t_response.status
220
- return true, t_request, t_response if t_response.status =~ /^403/
221
- return false, t_request, t_response if t_response.status =~ /^40\d/
220
+ status = t_response.status
221
+ return false if status.empty?
222
+ return true, t_request, t_response if status =~ /^403/
223
+ return false, t_request, t_response if status =~ /^40\d/
222
224
 
223
225
  puts @settings[:custom_error_patterns] if $debug_active_check
224
226
 
@@ -43,6 +43,7 @@ module Watobo
43
43
  puts "!!! Timeout: read_body (max_bytes=#{max_bytes})"
44
44
  #puts "* last data seen on socket:"
45
45
  # puts buf
46
+ puts $!.backtrace if $DEBUG
46
47
  return
47
48
  rescue => bang
48
49
  print "E!"
@@ -369,7 +369,6 @@ module Watobo
369
369
  end
370
370
 
371
371
  # @ctx = OpenSSL::SSL::SSLContext.new('SSLv23_server')
372
- puts "* read certificat (#{crt_path})"
373
372
  @cert = OpenSSL::X509::Certificate.new(File.read(crt_filename))
374
373
  @key = OpenSSL::PKey::RSA.new(File.read(key_filename))
375
374
 
@@ -218,22 +218,7 @@ module Watobo
218
218
  end
219
219
 
220
220
  class Project
221
- # SessionManager
222
- #
223
- # class SessionManager < Watobo::Session
224
- # def initialize(project)
225
- # super(project.session )
226
-
227
- # end
228
- # def runLogin
229
- # print "[L"
230
- # @project.loginscript_ids.each do |chatid|
231
- # test_req = @project.getChat(chatid).copyRequest
232
- # request, response = doRequest(test_req, :update_sids => true, :update_session => true, :update_contentlength => true)
233
- # end
234
-
235
- # end
236
- # end
221
+
237
222
  attr :chats
238
223
  attr_accessor :findings
239
224
  attr :scan_settings
@@ -244,19 +229,11 @@ module Watobo
244
229
  attr :session_store
245
230
  attr_accessor :settings
246
231
 
247
- # attr_accessor :numRunningChecks
248
-
249
- # attr_accessor :valid_sids
250
- ## attr_accessor :loginscript_ids
251
232
  attr :active_checks
252
233
  attr :passive_checks
253
234
  attr_accessor :plugins
254
235
  attr_accessor :excluded_chats
255
236
 
256
- # attr_accessor :intercept_request
257
- # attr_accessor :intercept_response
258
- # attr_accessor :interceptor
259
-
260
237
  attr :target_filter
261
238
  def subscribe(event, &callback)
262
239
  (@event_dispatcher_listeners[event] ||= []) << callback
@@ -824,7 +801,6 @@ module Watobo
824
801
  # @active_checks = @settings[:active_checks]
825
802
  @settings[:active_checks].each do |am|
826
803
  ac = am.new(self)
827
- puts "+#{ac.class}"
828
804
  ac.subscribe(:new_finding){ |nf| addFinding(nf) }
829
805
  @active_checks << ac
830
806
  end
@@ -969,7 +945,7 @@ module Watobo
969
945
  =end
970
946
  end
971
947
 
972
- def setDefaults()
948
+ def setDefaults_UNUSED()
973
949
  @settings = {
974
950
  :excluded_chats => [],
975
951
  :scope => Hash.new,
@@ -21,31 +21,40 @@
21
21
  # .
22
22
  module Watobo
23
23
  class Proxy
24
- attr :login
25
- attr :name
26
- attr :host
27
- attr :port
24
+ include Watobo::Constants
25
+
28
26
  attr :login
29
27
 
30
- def unsetCredentials()
31
- @login = nil
32
- end
28
+ def method_missing(name, *args, &block)
29
+ # puts "* instance method missing (#{name})"
30
+ if @settings.has_key? name.to_sym
31
+ return @settings[name.to_sym]
32
+ else
33
+ super
34
+ end
35
+ end
33
36
 
34
- def setCredentials(creds)
35
- @login = Hash.new
36
- @login.update creds
37
- end
38
37
 
39
38
  def has_login?
40
- return false if @login.nil?
39
+ # puts @settings.to_yaml
40
+ return false if @settings[:auth_type] == AUTH_TYPE_NONE
41
41
  return true
42
42
  end
43
43
 
44
44
  def initialize(prefs)
45
45
  @login = nil
46
- @name = prefs[:name]
47
- @host = prefs[:host]
48
- @port = prefs[:port]
46
+ raise ArgumentError, "Proxy needs host, port and name" unless prefs.has_key? :host
47
+ raise ArgumentError, "Proxy needs host, port and name" unless prefs.has_key? :port
48
+ raise ArgumentError, "Proxy needs host, port and name" unless prefs.has_key? :name
49
+
50
+ @settings = {
51
+ :auth_type => AUTH_TYPE_NONE,
52
+ :username => '',
53
+ :password => '',
54
+ :domain => '',
55
+ :workstation => ''}
56
+
57
+ @settings.update prefs
49
58
 
50
59
  end
51
60
  end
@@ -183,7 +192,8 @@ include Watobo::Constants
183
192
  # check for regular proxy authentication
184
193
  if request.is_ssl?
185
194
  socket, response_header = sslProxyConnect(request, proxy, current_prefs)
186
- return socket, response_header, "WATOBO: could not connect to proxy #{proxy.name}:#{proxy.host}" if socket.nil?
195
+ return socket, response_header, error_response("Could not connect to proxy #{proxy.name} (#{proxy.host}:#{proxy.port})\nReason: #{response_header}") if socket.nil?
196
+
187
197
  if current_prefs[:www_auth].has_key?(site)
188
198
  case current_prefs[:www_auth][site][:type]
189
199
  when AUTH_TYPE_NTLM
@@ -339,6 +349,7 @@ include Watobo::Constants
339
349
 
340
350
  updateCSRFToken(csrf_cache, copy)
341
351
  socket, csrf_request, csrf_response = sendHTTPRequest(copy, opts)
352
+ next if socket.nil?
342
353
  puts "= Response Headers:"
343
354
  puts csrf_response
344
355
  puts "==="
@@ -390,14 +401,9 @@ include Watobo::Constants
390
401
  nr.removeBody()
391
402
  nr.replaceURL(new_location)
392
403
 
393
- # puts response
394
- # puts nr
395
- puts "send redirect request"
404
+
396
405
  socket, request, response = sendHTTPRequest(nr, opts)
397
- puts "= request"
398
- puts request
399
- puts "= response"
400
- puts response
406
+
401
407
  if socket.nil?
402
408
  #return nil, request
403
409
  return request, response
@@ -429,12 +435,10 @@ end
429
435
 
430
436
  def addProxy(prefs=nil)
431
437
 
432
- # puts "* add proxy"
433
- # puts prefs.to_yaml
434
438
  proxy = nil
435
439
  unless prefs.nil?
436
- proxy = Proxy.new(:name => prefs[:name], :host => prefs[:host], :port => prefs[:port])
437
- proxy.setCredentials(prefs[:credentials]) unless prefs[:credentials].nil?
440
+ proxy = Proxy.new(prefs)
441
+ # proxy.setCredentials(prefs[:credentials]) unless prefs[:credentials].nil?
438
442
  unless prefs[:site].nil?
439
443
  @@proxy[prefs[:site]] = proxy
440
444
  return
@@ -466,7 +470,8 @@ end
466
470
  # :update_valid_sids => false,
467
471
  # :update_sids => false,
468
472
  # :update_contentlength => true
469
- def initialize(session_id, prefs={})
473
+ def initialize( session_id, prefs={} )
474
+
470
475
  @event_dispatcher_listeners = Hash.new
471
476
  # @session = {}
472
477
 
@@ -572,13 +577,16 @@ end
572
577
  auth_request.addHeader("Authorization", msg)
573
578
  auth_request.addHeader("Connection", "Keep-Alive")
574
579
 
575
- # puts "============= T1 ======================="
576
- # puts auth_request
580
+ if $DEBUG
581
+ puts "============= T1 ======================="
582
+ puts auth_request
583
+ end
584
+
577
585
  data = auth_request.join + "\r\n"
578
- #puts "= REQUEST ="
579
-
580
586
  socket.print data
581
- # puts "-----------------"
587
+
588
+ puts "-----------------" if $DEBUG
589
+
582
590
  response_header = []
583
591
  rcode = nil
584
592
  clen = nil
@@ -599,21 +607,36 @@ end
599
607
  end
600
608
  # puts "==================="
601
609
 
602
- #if rcode == 200 # Ok
603
- # puts "* seems request doesn't need authentication"
604
- # return socket, response_header
605
- if rcode == 401 #Authentication Required
606
- puts "* got ntlm challenge: #{ntlm_challenge}" if $DEBUG
610
+ if $DEBUG
611
+ puts "--- T1 RESPONSE HEADERS ---"
612
+ puts response_header
613
+ puts "---"
614
+ end
615
+ if rcode == 401 #Authentication Required
616
+ puts "[NTLM] got ntlm challenge: #{ntlm_challenge}" if $DEBUG
607
617
  return socket, response_header if ntlm_challenge.nil?
618
+ elsif rcode == 200 # Ok
619
+ puts "[NTLM] seems request doesn't need authentication" if $DEBUG
620
+ return socket, response_header
608
621
  else
609
- # puts "! arrgh .... :("
610
- # puts response_header
622
+ if $DEBUG
623
+ puts "[NTLM] ... !#*+.!*peep* ...."
624
+ puts response_header
625
+ end
611
626
  return socket, response_header
612
627
  end
613
628
 
614
629
  # reading rest of response
615
- Watobo::HTTP.read_body(socket, :max_bytes => clen){ |d| }
616
-
630
+ rest = ''
631
+ Watobo::HTTP.read_body(socket, :max_bytes => clen){ |d|
632
+ rest += d
633
+ }
634
+
635
+ if $DEBUG
636
+ puts "--- T1 RESPONSE BODY ---"
637
+ puts rest
638
+ puts "---"
639
+ end
617
640
  t2 = Net::NTLM::Message.decode64(ntlm_challenge)
618
641
  t3 = t2.response({:user => ntlm_credentials[:username],
619
642
  :password => ntlm_credentials[:password],
@@ -634,8 +657,8 @@ end
634
657
 
635
658
  if $DEBUG
636
659
  puts "= NTLM Type 3 ="
637
- puts data
638
- end
660
+ puts data
661
+ end
639
662
  socket.print data
640
663
 
641
664
  response_header = []
@@ -650,11 +673,13 @@ end
650
673
  end
651
674
 
652
675
  if rcode == 200 # Ok
653
- # puts "* authentication successfull [OK]"
676
+ if $DEBUG
677
+ puts "[NTLM] Authentication Successfull" if $DEBUG
678
+ end
654
679
  elsif rcode == 401 # Authentication Required
655
680
  # TODO: authorization didn't work -> do some notification
656
681
  # ...
657
- puts "* could not authenticate with the following credentials:"
682
+ puts "[NTLM] could not authenticate. Bad credentials?"
658
683
  puts ntlm_credentials.to_yaml
659
684
  end
660
685
 
@@ -681,7 +706,7 @@ end
681
706
  ctx.cert = current_prefs[:ssl_client_cert]
682
707
  ctx.key = current_prefs[:ssl_client_key]
683
708
  if $DEBUG
684
- puts "* using client certificates"
709
+ puts "[SSLconnect] Client Certificates"
685
710
  puts "= CERT ="
686
711
  # puts @ctx.cert.methods.sort
687
712
  puts ctx.cert.display
@@ -702,11 +727,11 @@ end
702
727
 
703
728
  socket.connect
704
729
  socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1)
705
- puts "* socket status: #{socket.state}" if $DEBUG
730
+ puts "[SSLconnect]: #{socket.state}" if $DEBUG
706
731
  return socket
707
732
  rescue => bang
708
733
  if current_prefs[:ssl_cipher].nil?
709
- puts "!sslConnect"
734
+ puts "[SSLconnect] ... gr#!..*peep*.. "
710
735
  puts bang
711
736
  puts bang.backtrace if $DEBUG
712
737
  end
@@ -715,6 +740,7 @@ end
715
740
 
716
741
  # SSLProxyConnect
717
742
  # return SSLSocket, ResponseHeader of ConnectionSetup
743
+ # On error SSLSocket is nil
718
744
  def sslProxyConnect(orig_request, proxy, prefs)
719
745
  begin
720
746
  tcp_socket = nil
@@ -749,23 +775,27 @@ end
749
775
  # puts request
750
776
 
751
777
  if proxy.has_login?
752
- case proxy.login[:type]
778
+ case proxy.auth_type
753
779
  when AUTH_TYPE_NTLM
754
780
 
755
- ntlm_challenge = nil
756
781
  t1 = Net::NTLM::Message::Type1.new()
757
782
  msg = "NTLM " + t1.encode64
758
783
  request.addHeader("Proxy-Authorization", msg)
759
784
 
760
- # puts "============= T1 ======================="
761
- # puts request
785
+ if $DEBUG
786
+ puts "============= PROXY NTLM: T1 ======================="
787
+ puts request
788
+ puts "---"
789
+ end
762
790
  data = request.join + "\r\n"
763
791
 
764
792
  tcp_socket.print data
765
793
  # puts "-----------------"
794
+ cl = 0
795
+ ntlm_challenge = nil
766
796
  while (line = tcp_socket.gets)
767
797
  response_header.push line
768
- # puts line
798
+ puts line if $DEBUG
769
799
  if line =~ /^HTTP\/\d\.\d (\d+) (.*)/ then
770
800
  rcode = $1.to_i
771
801
  rmsg = $2
@@ -773,12 +803,18 @@ end
773
803
  if line =~ /^Proxy-Authenticate: (NTLM) (.+)\r\n/
774
804
  ntlm_challenge = $2
775
805
  end
806
+ if line =~ /^Content-Length: (\d*)/i
807
+ cl = $1.to_i
808
+ end
776
809
  break if line.strip.empty?
777
810
  end
778
811
 
812
+
813
+ if cl > 0
779
814
  Watobo::HTTP.read_body(tcp_socket) { |d|
780
815
  # puts d
781
816
  }
817
+ end
782
818
 
783
819
  if rcode == 200 # Ok
784
820
  puts "* seems proxy doesn't require authentication"
@@ -789,17 +825,21 @@ end
789
825
  return socket, response_header if ntlm_challenge.nil? or ntlm_challenge == ""
790
826
 
791
827
  t2 = Net::NTLM::Message.decode64(ntlm_challenge)
792
- t3 = t2.response( { :user => proxy.login[:username],
793
- :password => proxy.login[:password],
794
- :domain => proxy.login[:domain] },
795
- { :workstation => proxy.login[:workstation], :ntlmv2 => true } )
828
+ t3 = t2.response( { :user => proxy.username,
829
+ :password => proxy.password,
830
+ :domain => proxy.domain },
831
+ { :workstation => proxy.workstation, :ntlmv2 => true } )
796
832
  request.removeHeader("Proxy-Authorization")
797
833
 
798
834
  msg = "NTLM " + t3.encode64
799
835
  request.addHeader("Proxy-Authorization", msg)
800
- # puts "============= T3 ======================="
801
- # puts request
836
+
802
837
  data = request.join + "\r\n"
838
+ if $DEBUG
839
+ puts "============= T3 ======================="
840
+ puts data
841
+ puts "---"
842
+ end
803
843
 
804
844
  tcp_socket.print data
805
845
  # puts "-----------------"
@@ -809,17 +849,19 @@ end
809
849
  response_header = readHTTPHeader(tcp_socket)
810
850
  rcode = response_header.status
811
851
  if rcode =~/^200/ # Ok
812
- puts "* proxy authentication successfull"
852
+ puts "[ProxyAuth-NTLM] Authorization Successful" if $DEBUG
853
+ socket = sslConnect(tcp_socket, prefs)
854
+ return socket, response_header
813
855
  elsif rcode =~ /^407/ # ProxyAuthentication Required
814
856
  # if rcode is still 407 authentication didn't work -> break
815
- return nil
857
+ msg = "NTLM-Authentication failed!"
858
+ puts "[ProxyAuth-NTLM] #{msg}" if $DEBUG
859
+ return nil, msg
816
860
  else
817
- puts "! check proxy connection [FALSE]"
818
- puts "> #{rcode} #{rmsg} <"
819
- end
820
-
821
- socket = sslConnect(tcp_socket, prefs)
822
- return socket, response_header
861
+ puts "[SSLconnect] NTLM Authentication"
862
+ puts "> #{rcode} <"
863
+ return nil, response_header
864
+ end
823
865
  end
824
866
  end # END OF PROXY AUTH
825
867
 
@@ -837,22 +879,22 @@ end
837
879
  # if rcode is still 407 authentication didn't work -> break
838
880
 
839
881
  else
840
- puts "! check proxy connection [FALSE]"
841
- puts "> #{rcode} #{rmsg} <"
882
+ puts "[SSLconnect] Response Status"
883
+ puts "> #{rcode} <"
842
884
  end
843
885
 
844
886
  socket = sslConnect(tcp_socket, prefs)
845
887
  return socket, response_header
846
888
  rescue => bang
847
889
  puts bang
848
- return nil, bang
890
+ return nil, error_response(bang)
849
891
  end
850
892
  # return nil, nil
851
893
  end
852
894
 
853
895
  # proxyAuthNTLM
854
896
  # returns: ResponseHeaders
855
- def proxyAuthNTLM(tcp_socket, orig_request, credentials)
897
+ def proxyAuthNTLM(tcp_socket, orig_request, proxy)
856
898
 
857
899
  request = Watobo::Utils::copyObject(orig_request)
858
900
  request.extend Watobo::Mixin::Parser::Url
@@ -911,7 +953,7 @@ end
911
953
  }
912
954
 
913
955
  t2 = Net::NTLM::Message.decode64(ntlm_challenge)
914
- t3 = t2.response({:user => credentials[:username], :password => credentials[:password], :workstation => credentials[:workstation], :domain => credentials[:domain]}, {:ntlmv2 => true})
956
+ t3 = t2.response({:user => proxy.username, :password => proxy.password, :workstation => proxy.workstation, :domain => proxy.domain}, {:ntlmv2 => true})
915
957
  request.removeHeader("Proxy-Authorization")
916
958
  # request.removeHeader("Proxy-Connection")
917
959
 
@@ -949,11 +991,13 @@ end
949
991
  #
950
992
  # doProxyAuth
951
993
  #
952
- def doProxyAuth(tcp_socket, orig_request, credentials)
994
+ def doProxyAuth(tcp_socket, orig_request, proxy)
995
+ # puts "DO PROXY AUTH"
996
+ # puts proxy.to_yaml
953
997
  response_headers = nil
954
- case credentials[:type]
998
+ case proxy.auth_type
955
999
  when AUTH_TYPE_NTLM
956
- return proxyAuthNTLM(tcp_socket, orig_request, credentials)
1000
+ return proxyAuthNTLM(tcp_socket, orig_request, proxy)
957
1001
 
958
1002
  end # END OF NTLM
959
1003
 
@@ -963,7 +1007,8 @@ end
963
1007
  # doProxyRequest
964
1008
  ################################################
965
1009
  def doProxyRequest(request, proxy, prefs={})
966
-
1010
+ #puts "DO PROXY REQUEST"
1011
+ # puts prefs.to_yaml
967
1012
  begin
968
1013
  tcp_socket = nil
969
1014
  site = request.site
@@ -985,12 +1030,16 @@ end
985
1030
  auth_request.addHeader("Pragma", "no-cache")
986
1031
 
987
1032
  if proxy.has_login?
988
- request_header = doProxyAuth(tcp_socket, auth_request, proxy.login)
1033
+ response_header = doProxyAuth(tcp_socket, auth_request, proxy)
989
1034
  # puts "* got request_header from doProxy Auth"
990
1035
  # puts request_header.class
991
- return tcp_socket, request_header
1036
+ puts "[Proxy Auth] Status: #{response_header.status}" if $DEBUG
1037
+ return tcp_socket, response_header unless response_header.status =~ /401/
1038
+ return tcp_socket, response_header unless prefs[:www_auth].has_key?(site)
992
1039
  end
993
1040
 
1041
+ # puts "CHECK WWW_AUTH"
1042
+ # puts prefs.to_yaml
994
1043
  if prefs[:www_auth].has_key?(site)
995
1044
  case prefs[:www_auth][site][:type]
996
1045
  when AUTH_TYPE_NTLM
@@ -1008,8 +1057,8 @@ end
1008
1057
 
1009
1058
  tcp_socket.print data
1010
1059
 
1011
- request_header = readHTTPHeader(tcp_socket)
1012
- return tcp_socket, request_header
1060
+ response_header = readHTTPHeader(tcp_socket)
1061
+ return tcp_socket, response_header
1013
1062
  end
1014
1063
  rescue => bang
1015
1064
  puts bang
@@ -1315,4 +1364,4 @@ end
1315
1364
  end
1316
1365
 
1317
1366
  end
1318
- end
1367
+ end