watobo 0.9.14 → 0.9.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/CHANGELOG.md +29 -0
  2. data/config/interceptor.yml +1 -0
  3. data/lib/watobo/core/active_check.rb +1 -2
  4. data/lib/watobo/core/client_cert_store.rb +47 -0
  5. data/lib/watobo/core/scanner3.rb +124 -88
  6. data/lib/watobo/core/session.rb +52 -47
  7. data/lib/watobo/core.rb +1 -11
  8. data/lib/watobo/gui/chatviewer_frame.rb +5 -3
  9. data/lib/watobo/gui/checkboxtree.rb +59 -14
  10. data/lib/watobo/gui/checks_policy_frame.rb +1 -5
  11. data/lib/watobo/gui/client_cert_dialog.rb +260 -96
  12. data/lib/watobo/gui/conversation_table.rb +7 -1
  13. data/lib/watobo/gui/conversation_table_ctrl2.rb +14 -5
  14. data/lib/watobo/gui/edit_comment.rb +1 -1
  15. data/lib/watobo/gui/main_window.rb +40 -5
  16. data/lib/watobo/gui/manual_request_editor.rb +10 -8
  17. data/lib/watobo/gui/quick_scan_dialog.rb +8 -6
  18. data/lib/watobo/gui/scanner_settings_dialog.rb +1 -0
  19. data/lib/watobo/gui/text_viewer.rb +5 -3
  20. data/lib/watobo/http/cookies/cookies.rb +3 -1
  21. data/lib/watobo/http_socket/agent.rb +1 -1
  22. data/lib/watobo/http_socket/client_socket.rb +409 -98
  23. data/lib/watobo/http_socket/connection.rb +1 -1
  24. data/lib/watobo/http_socket/http_socket.rb +47 -39
  25. data/lib/watobo/interceptor/proxy.rb +41 -212
  26. data/lib/watobo/mixins/httpparser.rb +17 -16
  27. data/lib/watobo/mixins/shapers.rb +3 -7
  28. data/lib/watobo.rb +2 -1
  29. data/modules/active/domino/domino_db.rb +5 -7
  30. data/modules/active/struts2/default_handler_ognl.rb +128 -0
  31. data/modules/active/struts2/include_params_ognl.rb +127 -0
  32. data/modules/passive/ajax.rb +5 -3
  33. data/modules/passive/detect_infrastructure.rb +2 -3
  34. data/modules/passive/dirindexing.rb +8 -6
  35. data/modules/passive/disclosure_emails.rb +13 -14
  36. data/modules/passive/disclosure_ipaddr.rb +13 -13
  37. data/modules/passive/hotspots.rb +6 -4
  38. data/modules/passive/in_script_parameter.rb +25 -19
  39. data/modules/passive/redirectionz.rb +1 -1
  40. data/modules/passive/sap-headers.rb +78 -0
  41. data/modules/passive/xss_dom.rb +5 -3
  42. data/plugins/catalog/catalog.rb +7 -2
  43. data/plugins/crawler/gui/auth_frame.rb +20 -5
  44. data/plugins/crawler/gui/crawler_gui.rb +56 -9
  45. data/plugins/crawler/lib/engine.rb +12 -14
  46. data/plugins/filefinder/dbs/sap.db +157 -0
  47. metadata +23 -2
@@ -102,18 +102,18 @@ module Watobo#:nodoc: all
102
102
  @sid_cache.update_request(request) if current_prefs[:update_session] == true
103
103
 
104
104
  #---------------------------------------
105
- request.removeHeader("^Proxy-Connection") #if not use_proxy
106
- #request.removeHeader("^Connection") #if not use_proxy
107
- request.removeHeader("^Accept-Encoding")
105
+ # request.removeHeader("^Proxy-Connection") #if not use_proxy
106
+ # request.removeHeader("^Connection") #if not use_proxy
107
+ #request.removeHeader("^Accept-Encoding")
108
108
  # If-Modified-Since: Tue, 28 Oct 2008 11:06:43 GMT
109
109
  # If-None-Match: W/"3975-1225192003000"
110
- request.removeHeader("^If-")
110
+ # request.removeHeader("^If-")
111
111
  # puts
112
112
  # request.each do |line|
113
113
  # puts line.unpack("H*")
114
114
  #end
115
115
  #puts
116
- if current_prefs[:update_contentlength] == true then
116
+ if current_prefs[:update_contentlength] == true and request.has_body? then
117
117
  request.fix_content_length()
118
118
  end
119
119
 
@@ -170,23 +170,30 @@ module Watobo#:nodoc: all
170
170
  # timeout(6) do
171
171
  #puts "* no proxy - direct connection"
172
172
  tcp_socket = TCPSocket.new( host, port )
173
- optval = [1, 5000].pack("I_2")
174
- tcp_socket.setsockopt Socket::SOL_SOCKET, Socket::SO_RCVTIMEO, optval
175
- tcp_socket.setsockopt Socket::SOL_SOCKET, Socket::SO_SNDTIMEO, optval
173
+ #optval = [1, 5000].pack("I_2")
174
+ #tcp_socket.setsockopt Socket::SOL_SOCKET, Socket::SO_RCVTIMEO, optval
175
+ #tcp_socket.setsockopt Socket::SOL_SOCKET, Socket::SO_SNDTIMEO, optval
176
176
  tcp_socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
177
- tcp_socket.setsockopt Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1
177
+ #tcp_socket.setsockopt Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1
178
+ tcp_socket.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR, true)
179
+
178
180
  tcp_socket.sync = true
179
181
 
180
182
  socket = tcp_socket
181
183
  if request.is_ssl?
182
184
  ssl_prefs = {}
183
185
  ssl_prefs[:ssl_cipher] = current_prefs[:ssl_cipher] if current_prefs.has_key? :ssl_cipher
184
- if current_prefs.has_key? :client_certificates
185
- if current_prefs[:client_certificates].has_key? request.site
186
- puts "* use ssl client certificate for site #{request.site}" if $DEBUG
187
- ssl_prefs[:ssl_client_cert] = current_prefs[:client_certificates][request.site][:ssl_client_cert]
188
- ssl_prefs[:ssl_client_key] = current_prefs[:client_certificates][request.site][:ssl_client_key]
189
- end
186
+ #if current_prefs.has_key? :client_certificates
187
+ # if current_prefs[:client_certificates].has_key? request.site
188
+ # puts "* use ssl client certificate for site #{request.site}" if $DEBUG
189
+ # ssl_prefs[:ssl_client_cert] = current_prefs[:client_certificates][request.site][:ssl_client_cert]
190
+ # ssl_prefs[:ssl_client_key] = current_prefs[:client_certificates][request.site][:ssl_client_key]
191
+ # end
192
+ #end
193
+ unless Watobo::ClientCertStore.get(site).nil?
194
+ # puts "* using client cert for site #{site}"
195
+ client_cert = Watobo::ClientCertStore.get(site)
196
+ ssl_prefs[:client_certificate] = client_cert
190
197
  end
191
198
  socket = sslConnect(tcp_socket, ssl_prefs)
192
199
  end
@@ -194,11 +201,10 @@ module Watobo#:nodoc: all
194
201
  # remove URI before sending request but cache it for restoring request
195
202
  uri_cache = nil
196
203
  uri_cache = request.removeURI #if proxy.nil?
197
-
198
-
199
- # request.addHeader("Proxy-Connection", "Close") unless proxy.nil?
200
- # request.addHeader("Accept-Encoding", "gzip;q=0;identity; q=0.5, *;q=0") #don't want encoding
204
+ # request.addHeader("Proxy-Connection", "Close") unless proxy.nil?
205
+ # request.set_header("Accept-Encoding", "gzip;q=0;identity; q=0.5, *;q=0") #don't want encoding
201
206
 
207
+ # request.set_header("Connection", "close") unless request.has_header?("Upgrade")
202
208
 
203
209
  if current_prefs[:www_auth].has_key?(site)
204
210
  case current_prefs[:www_auth][site][:type]
@@ -212,25 +218,20 @@ module Watobo#:nodoc: all
212
218
  end
213
219
  else
214
220
  # puts "========== Add Headers"
215
- # request.addHeader("Connection", "Close") #if not use_proxy
221
+
222
+ request.addHeader("Connection", "Close") #if not use_proxy
216
223
 
217
224
  data = request.join
218
225
  unless request.has_body?
219
226
  data << "\r\n" unless data =~ /\r\n\r\n$/
220
227
  end
221
- # puts "= SESSION ="
222
- # puts data
228
+ # puts "= SESSION ="
229
+ # puts data
223
230
  # puts data.unpack("H*")[0]#.gsub(/0d0a/,"0d0a\n")
224
-
231
+ # puts "---"
225
232
  unless socket.nil?
226
233
  socket.print data
227
234
  socket.flush
228
- # tell finished sending data
229
- if socket.is_a? OpenSSL::SSL::SSLSocket
230
- socket.io.shutdown(Socket::SHUT_WR)
231
- else
232
- socket.shutdown(Socket::SHUT_WR)
233
- end
234
235
  response_header = readHTTPHeader(socket, current_prefs)
235
236
  end
236
237
  # RESTORE URI FOR HISTORY/LOG
@@ -297,6 +298,7 @@ module Watobo#:nodoc: all
297
298
  # unless @session[:csrf_requests].empty? or @session[:csrf_patterns].empty?
298
299
  unless Watobo::OTTCache.requests(request).empty? or @session[:update_otts] == false
299
300
  Watobo::OTTCache.requests(request).each do |req|
301
+
300
302
  copy = Watobo::Request.new YAML.load(YAML.dump(req))
301
303
 
302
304
  #updateCSRFToken(csrf_cache, copy)
@@ -338,8 +340,8 @@ module Watobo#:nodoc: all
338
340
  if @session[:follow_redirect]
339
341
  # puts response.status
340
342
  if response.status =~ /^302/
341
- response.extend Watobo::Mixin::Parser::Web10
342
- request.extend Watobo::Mixin::Shaper::Web10
343
+ #response.extend Watobo::Mixin::Parser::Web10
344
+ #request.extend Watobo::Mixin::Shaper::Web10
343
345
 
344
346
  loc_header = response.headers("Location:").first
345
347
  new_location = loc_header.gsub(/^[^:]*:/,'').strip
@@ -597,10 +599,10 @@ end
597
599
  {:workstation => ntlm_credentials[:workstation], :ntlmv2 => true})
598
600
 
599
601
  # puts "* NTLM-Credentials: #{ntlm_credentials[:username]},#{ntlm_credentials[:password]}, #{ntlm_credentials[:domain]}, #{ntlm_credentials[:workstation]}"
600
- auth_request.removeHeader("Authorization")
601
- auth_request.removeHeader("Connection")
602
+ #auth_request.removeHeader("Authorization")
603
+ #auth_request.removeHeader("Connection")
602
604
 
603
- auth_request.addHeader("Connection", "Close")
605
+ auth_request.set_header("Connection", "Close")
604
606
 
605
607
  msg = "NTLM " + t3.encode64
606
608
  auth_request.addHeader("Authorization", msg)
@@ -666,19 +668,24 @@ end
666
668
  puts "= KEY ="
667
669
  puts ctx.key.display
668
670
  puts "---"
669
- end
670
-
671
+ end
671
672
 
672
673
  end
673
674
  # @ctx.tmp_dh_callback = proc { |*args|
674
675
  # OpenSSL::PKey::DH.new(128)
675
676
  #}
677
+ if current_prefs.has_key? :client_certificate
678
+ ccp = current_prefs[:client_certificate]
679
+ ctx.cert = ccp[:ssl_client_cert]
680
+ ctx.key = ccp[:ssl_client_key]
681
+ ctx.extra_chain_cert = ccp[:extra_chain_certs] if ccp.has_key?(:extra_chain_certs)
682
+ end
676
683
 
677
684
  socket = OpenSSL::SSL::SSLSocket.new(tcp_socket, ctx)
678
685
  socket.sync_close = true
679
686
 
680
687
  socket.connect
681
- socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1)
688
+ #socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1)
682
689
  puts "[SSLconnect]: #{socket.state}" if $DEBUG
683
690
  return socket
684
691
  rescue => bang
@@ -705,7 +712,9 @@ end
705
712
  # timeout(6) do
706
713
 
707
714
  tcp_socket = TCPSocket.new( proxy.host, proxy.port)
708
- tcp_socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1)
715
+ tcp_socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
716
+ #tcp_socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1)
717
+ tcp_socket.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR, true)
709
718
  tcp_socket.sync = true
710
719
  # end
711
720
  # puts "* sslProxyConnect"
@@ -907,7 +916,7 @@ end
907
916
 
908
917
  t2 = Net::NTLM::Message.decode64(ntlm_challenge)
909
918
  t3 = t2.response({:user => proxy.username, :password => proxy.password, :workstation => proxy.workstation, :domain => proxy.domain}, {:ntlmv2 => true})
910
- request.removeHeader("Proxy-Authorization")
919
+ #request.removeHeader("Proxy-Authorization")
911
920
  # request.removeHeader("Proxy-Connection")
912
921
 
913
922
  # request.addHeader("Proxy-Connection", "Close")
@@ -974,6 +983,8 @@ end
974
983
 
975
984
  tcp_socket = TCPSocket.new( proxy.host, proxy.port)
976
985
  tcp_socket.setsockopt( Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1)
986
+ tcp_socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
987
+ tcp_socket.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR, true)
977
988
  tcp_socket.sync = true
978
989
  # end
979
990
 
@@ -1060,15 +1071,9 @@ end
1060
1071
  header = []
1061
1072
  msg = nil
1062
1073
  begin
1063
- # signal finished sending before reading
1064
- # if socket.is_a? OpenSSL::SSL::SSLSocket
1065
- # socket.io.close_write
1066
- # else
1067
- # socket.close_write
1068
- # end
1069
-
1074
+
1070
1075
  Watobo::HTTPSocket.read_header(socket) do |line|
1071
- #puts line
1076
+ # puts line
1072
1077
  # puts line.unpack("H*")
1073
1078
  header.push line
1074
1079
  end
data/lib/watobo/core.rb CHANGED
@@ -19,16 +19,6 @@
19
19
  # along with WATOBO; if not, write to the Free Software
20
20
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
21
  # .
22
- =begin
23
- lib_folder = "core"
24
- path = File.expand_path(File.join(File.dirname(__FILE__), lib_folder))
25
- puts "* loading #{lib_folder}"
26
- Dir.glob("#{path}/*.rb").each do |cf|
27
- puts "+ #{cf}" if $DEBUG
28
- require cf
29
-
30
- end
31
- =end
32
- %w( subscriber sid_cache ott_cache parameter conversation chat findings chats active_checks passive_checks scope passive_scanner scanner3 finding project scanner proxy session fuzz_gen interceptor passive_check active_check cookie request response intercept_filter intercept_carver plugin forwarding_proxy cert_store netfilter_queue ).each do |lib|
22
+ %w( subscriber client_cert_store sid_cache ott_cache parameter conversation chat findings chats active_checks passive_checks scope passive_scanner scanner3 finding project scanner proxy session fuzz_gen interceptor passive_check active_check cookie request response intercept_filter intercept_carver plugin forwarding_proxy cert_store netfilter_queue ).each do |lib|
33
23
  require File.join( "watobo", "core", lib)
34
24
  end
@@ -37,11 +37,12 @@ module Watobo#:nodoc: all
37
37
  end
38
38
 
39
39
  def setText(text, prefs={})
40
+
40
41
  normalized_text = text
41
42
  if text.is_a? String
42
43
  normalized_text = text.gsub(/[^[:print:]]/,".")
43
44
  elsif text.respond_to? :has_body?
44
- if text.content_type =~ /(html|xml)/
45
+ if text.content_type =~ /(xml)/
45
46
  doc = Nokogiri::XML(text.body, &:noblanks)
46
47
  fbody = doc.to_xhtml( indent:3, indent_text:" ")
47
48
  normalized_text = text.headers.map{|h| h.strip }.join("\n")
@@ -54,10 +55,10 @@ module Watobo#:nodoc: all
54
55
  end
55
56
  end
56
57
 
57
- @text = normalized_text
58
+ @text = normalized_text
58
59
  #@text = text
59
60
  @simple_text_view.max_len = @max_len
60
- @simple_text_view.setText(@text, prefs)
61
+ @simple_text_view.setText(text, prefs)
61
62
  @match_pos_label.text = "0/0"
62
63
  @match_pos_label.textColor = 'grey'
63
64
 
@@ -420,6 +421,7 @@ module Watobo#:nodoc: all
420
421
  textviewer_tab = FXTabItem.new(@tabBook, "Text", nil)
421
422
  tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
422
423
  @textviewer = TextViewer.new( tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
424
+ # @textviewer = TextView2.new( tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
423
425
 
424
426
  @textviewer.style = 2
425
427
  @textviewer.editable = false
@@ -36,6 +36,51 @@ end
36
36
  # @private
37
37
  module Watobo#:nodoc: all
38
38
  module Gui
39
+
40
+ module CheckboxMixin
41
+ include Watobo::Gui::Icons
42
+
43
+ def check
44
+ begin
45
+ @checked ||= true
46
+ self.setOpenIcon(ICON_CB_CHECKED)
47
+ self.setClosedIcon(ICON_CB_CHECKED)
48
+ # opened = true
49
+ rescue => bang
50
+ puts "!!!ERROR: could not check item"
51
+ puts bang
52
+ puts bang.backtrace
53
+ end
54
+ end
55
+
56
+ def checked
57
+ @checked ||= false
58
+ end
59
+
60
+ def uncheck
61
+ begin
62
+ @checked ||= false
63
+ self.setOpenIcon(ICON_CB_UNCHECKED)
64
+ self.setClosedIcon(ICON_CB_UNCHECKED)
65
+ #opened = false
66
+ rescue => bang
67
+ puts "!!!ERROR: could not uncheck item"
68
+ puts bang
69
+ puts bang.backtrace
70
+ end
71
+ end
72
+
73
+ def toggle
74
+ @checked ||= false
75
+ if @checked
76
+ uncheck
77
+ else
78
+ check
79
+ end
80
+ end
81
+
82
+ end
83
+
39
84
  class CheckBoxTreeItem < FXTreeItem
40
85
  attr_accessor :checked
41
86
 
@@ -70,7 +115,7 @@ module Watobo#:nodoc: all
70
115
  end
71
116
  end
72
117
 
73
- def initialize(item_text, item_status, item_data)
118
+ def initialize(item_text, item_status )
74
119
  super item_text
75
120
  @checked = item_status
76
121
  #icon = ICON_CB_CHECKED
@@ -97,19 +142,22 @@ module Watobo#:nodoc: all
97
142
  # }, {..} ]
98
143
  def elements=(elements)
99
144
  self.clearItems()
145
+ #return false if elements.length > 0
100
146
  elements.each do |e|
101
147
 
102
148
  # puts icon.class.to_s
103
149
  node = nil
104
150
  levels = e[:name].split('|')
151
+ begin
105
152
  # puts "Processing: #{e[:name]} > #{e[:data].class}" if $DEBUG
106
153
  levels.each_with_index do |l,i|
107
154
  #puts "#{l} - #{l.class}"
108
155
  item = self.findItem(l, node, SEARCH_FORWARD|SEARCH_IGNORECASE)
109
156
 
110
157
  if item.nil? then
111
- # new_item = CheckBoxTreeItem.new(l, e[:enabled], nil)
112
- new_item = CheckBoxTreeItem.new(l, e[:enabled], :none)
158
+ # new_item = FXTreeItem.new(l, ICON_CB_CHECKED, ICON_CB_CHECKED)
159
+ # new_item.extend CheckboxMixin
160
+ new_item = CheckBoxTreeItem.new(l, e[:enabled] )
113
161
  # item = self.appendItem(node, l, ICON_CB_CHECKED, ICON_CB_CHECKED)
114
162
  item = self.appendItem(node, new_item)
115
163
  # if e[:enabled] then
@@ -125,6 +173,10 @@ module Watobo#:nodoc: all
125
173
  end
126
174
 
127
175
  end
176
+ rescue => bang
177
+ puts bang
178
+ puts bang.backtrace
179
+ end
128
180
  end
129
181
  end
130
182
 
@@ -277,12 +329,13 @@ module Watobo#:nodoc: all
277
329
 
278
330
  @application ||= FXApp.new('LayoutTester', 'FoxTest')
279
331
  class TestGui < FXMainWindow
332
+
280
333
  class TreeDlg < FXDialogBox
281
334
 
282
- include Responder
335
+ # include Responder
283
336
  def initialize(parent, project=nil, prefs={} )
284
337
  super(parent, "CheckBox Dialog", DECOR_ALL, :width => 300, :height => 400)
285
- FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)
338
+ # FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)
286
339
  frame = FXVerticalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)
287
340
  elements = []
288
341
  num_root_nodes = 4
@@ -299,15 +352,7 @@ module Watobo#:nodoc: all
299
352
  @cbtree.elements = elements
300
353
 
301
354
  end
302
- private
303
-
304
- def onAccept(sender, sel, event)
305
- puts "#{self} closed"
306
-
307
- getApp().stopModal(self, 1)
308
- self.hide()
309
- return 1
310
- end
355
+
311
356
  end
312
357
 
313
358
  def leave
@@ -30,11 +30,6 @@ module Watobo#:nodoc: all
30
30
  applyPolicy(policy)
31
31
  end
32
32
 
33
- def isElementChecked_UNUSED(data)
34
- item = @tree.findItemByData(data)
35
- item.checked
36
- end
37
-
38
33
  def applyPolicy(policy=nil)
39
34
  #return false if policy.nil?
40
35
  tree_elements = []
@@ -65,6 +60,7 @@ module Watobo#:nodoc: all
65
60
  :enabled => false,
66
61
  :data => check
67
62
  }
63
+ puts a[:name]
68
64
  tree_elements.push a
69
65
  end
70
66