watobo 0.9.9.pre3 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/.yardopts +24 -0
  2. data/CHANGELOG +17 -7
  3. data/README +4 -60
  4. data/bin/nfq_server.rb +191 -0
  5. data/config/interceptor.yml +2 -6
  6. data/lib/watobo/adapters/data_store.rb +1 -1
  7. data/lib/watobo/adapters/file/file_store.rb +50 -33
  8. data/lib/watobo/ca.rb +22 -0
  9. data/lib/watobo/config.rb +6 -0
  10. data/lib/watobo/core/ca.rb +411 -0
  11. data/lib/watobo/core/cert_store.rb +56 -0
  12. data/lib/watobo/core/forwarding_proxy.rb +38 -0
  13. data/lib/watobo/core/http_socket.rb +18 -0
  14. data/lib/watobo/core/intercept_carver.rb +179 -0
  15. data/lib/watobo/core/intercept_filter.rb +257 -0
  16. data/lib/watobo/core/interceptor.rb +342 -79
  17. data/lib/watobo/core/netfilter_queue.rb +191 -0
  18. data/lib/watobo/core/project.rb +84 -138
  19. data/lib/watobo/core/proxy.rb +61 -0
  20. data/lib/watobo/core/request.rb +40 -0
  21. data/lib/watobo/core/response.rb +30 -0
  22. data/lib/watobo/core/scanner.rb +64 -58
  23. data/lib/watobo/core/session.rb +70 -77
  24. data/lib/watobo/core.rb +1 -1
  25. data/lib/watobo/framework/create_project.rb +25 -10
  26. data/lib/watobo/framework/init.rb +13 -0
  27. data/lib/watobo/gui/browser_preview.rb +5 -4
  28. data/lib/watobo/gui/checks_policy_frame.rb +1 -0
  29. data/lib/watobo/gui/client_cert_dialog.rb +11 -6
  30. data/lib/watobo/gui/conversation_table.rb +7 -4
  31. data/lib/watobo/gui/fuzzer_gui.rb +9 -11
  32. data/lib/watobo/gui/intercept_filter_dialog.rb +210 -0
  33. data/lib/watobo/gui/interceptor_gui.rb +59 -21
  34. data/lib/watobo/gui/interceptor_settings_dialog.rb +39 -5
  35. data/lib/watobo/gui/list_box.rb +2 -1
  36. data/lib/watobo/gui/log_viewer.rb +79 -5
  37. data/lib/watobo/gui/main_window.rb +159 -113
  38. data/lib/watobo/gui/manual_request_editor.rb +11 -5
  39. data/lib/watobo/gui/mixins/subscriber.rb +47 -0
  40. data/lib/watobo/gui/project_wizzard.rb +3 -3
  41. data/lib/watobo/gui/proxy_dialog.rb +17 -18
  42. data/lib/watobo/gui/request_editor.rb +1 -1
  43. data/lib/watobo/gui/rewrite_filters_dialog.rb +416 -0
  44. data/lib/watobo/gui/rewrite_rules_dialog.rb +394 -0
  45. data/lib/watobo/gui/scanner_settings_dialog.rb +9 -6
  46. data/lib/watobo/gui/session_management_dialog.rb +33 -23
  47. data/lib/watobo/gui/sites_tree.rb +5 -6
  48. data/lib/watobo/gui/status_bar.rb +101 -49
  49. data/lib/watobo/gui/table_editor.rb +1 -1
  50. data/lib/watobo/gui/templates/plugin2.rb +23 -27
  51. data/lib/watobo/gui/utils/save_default_settings.rb +9 -9
  52. data/lib/watobo/gui/utils/save_proxy_settings.rb +25 -9
  53. data/lib/watobo/gui/utils/save_scanner_settings.rb +10 -7
  54. data/lib/watobo/gui/utils/session_history.rb +1 -1
  55. data/lib/watobo/gui/www_auth_dialog.rb +25 -21
  56. data/lib/watobo/gui.rb +3 -1
  57. data/lib/watobo/mixins/httpparser.rb +47 -40
  58. data/lib/watobo/mixins/request_parser.rb +126 -41
  59. data/lib/watobo/mixins/shapers.rb +124 -15
  60. data/lib/watobo/utils/hexprint.rb +31 -0
  61. data/lib/watobo/utils/load_chat.rb +2 -0
  62. data/lib/watobo/utils/response_builder.rb +111 -0
  63. data/lib/watobo.rb +4 -1
  64. data/modules/active/discovery/http_methods.rb +6 -4
  65. data/modules/active/fileinclusion/lfi_simple.rb +3 -3
  66. data/modules/active/sqlinjection/sqli_timing.rb +6 -6
  67. data/modules/passive/redirectionz.rb +5 -6
  68. data/plugins/catalog/catalog.rb +240 -56
  69. data/plugins/catalog/db_tests +1 -6483
  70. data/plugins/catalog/db_variables +2 -29
  71. data/plugins/crawler/gui/auth_frame.rb +15 -3
  72. data/plugins/crawler/gui/crawler_gui.rb +24 -0
  73. data/plugins/crawler/gui/hooks_frame.rb +7 -2
  74. data/plugins/crawler/gui/settings_tabbook.rb +4 -0
  75. data/plugins/crawler/gui.rb +3 -3
  76. data/plugins/crawler/lib/engine.rb +1 -1
  77. data/plugins/filefinder/filefinder.rb +21 -17
  78. data/plugins/sqlmap/bin/test.rb +100 -0
  79. data/plugins/sqlmap/gui/main.rb +227 -0
  80. data/plugins/sqlmap/gui/options_frame.rb +119 -0
  81. data/plugins/sqlmap/gui.rb +27 -0
  82. data/plugins/sqlmap/icons/sqlmap.ico +0 -0
  83. data/plugins/sqlmap/lib/sqlmap_ctrl.rb +116 -0
  84. data/plugins/sqlmap/sqlmap.rb +26 -0
  85. data/plugins/sslchecker/gui/gui.rb +45 -30
  86. metadata +32 -9
  87. data/certificates/cert.pem +0 -19
  88. data/certificates/privkey.pem +0 -15
  89. data/certificates/watobo_dh.key +0 -5
  90. data/lib/watobo/core/simple_ca.rb +0 -393
@@ -52,7 +52,8 @@ module Watobo
52
52
  end
53
53
 
54
54
  def savePasswords?()
55
- @save_pws_cbt.checked?
55
+ return false
56
+ # @save_pws_cbt.checked?
56
57
  end
57
58
 
58
59
  def onAccept(sender, sel, event)
@@ -91,15 +92,15 @@ module Watobo
91
92
  return 0
92
93
  end
93
94
 
94
- @password_policy[:save_passwords] = @save_pws_cbt.checked?
95
- puts @password_policy.to_yaml
95
+ # @password_policy[:save_passwords] = @save_pws_cbt.checked?
96
+ # puts @password_policy.to_yaml
96
97
  getApp().stopModal(self, 1)
97
98
  self.hide()
98
99
  return 1
99
100
 
100
101
  end
101
102
 
102
- def initialize(owner, proxy=nil, password_policy={})
103
+ def initialize(owner, proxy=nil)
103
104
 
104
105
  super(owner, "Proxy Settings", :opts => DECOR_TITLE|DECOR_BORDER)
105
106
 
@@ -133,8 +134,8 @@ module Watobo
133
134
 
134
135
  end
135
136
 
136
- @password_policy = Hash.new
137
- @password_policy.update password_policy
137
+ # @password_policy = Hash.new
138
+ # @password_policy.update password_policy
138
139
  main = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
139
140
 
140
141
  matrix = FXMatrix.new(main, 2, :opts => MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)
@@ -217,11 +218,11 @@ module Watobo
217
218
  :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)
218
219
  domain.handle(self, FXSEL(SEL_UPDATE, 0), nil)
219
220
 
220
- frame = FXVerticalFrame.new(main, :opts => LAYOUT_FILL_X)
221
- @save_pws_cbt = FXCheckButton.new(frame, "save passwords")
222
- @save_pws_cbt.checkState = false
223
- @save_pws_cbt.checkState = true if password_policy[:save_passwords] == true
224
- note_label = FXLabel.new(frame, "This setting affects all passwords!!!")
221
+ # frame = FXVerticalFrame.new(main, :opts => LAYOUT_FILL_X)
222
+ # @save_pws_cbt = FXCheckButton.new(frame, "save passwords")
223
+ # @save_pws_cbt.checkState = false
224
+ # @save_pws_cbt.checkState = true if password_policy[:save_passwords] == true
225
+ # note_label = FXLabel.new(frame, "This setting affects all passwords!!!")
225
226
 
226
227
  buttons = FXHorizontalFrame.new(main, :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,
227
228
  :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)
@@ -313,7 +314,7 @@ module Watobo
313
314
  # puts proxy.to_yaml
314
315
  @proxy_list[proxy[:name]] = proxy
315
316
  end
316
- @password_policy[:save_passwords] = @save_passwords
317
+ # @password_policy[:save_passwords] = @save_passwords
317
318
  getApp().stopModal(self, 1)
318
319
  self.hide()
319
320
  return 1
@@ -327,7 +328,7 @@ module Watobo
327
328
  end
328
329
 
329
330
  def addProxy(proxy=nil)
330
- pdlg = AddProxyDialog.new(self, proxy, @password_policy)
331
+ pdlg = AddProxyDialog.new(self, proxy)
331
332
 
332
333
  if pdlg.execute != 0
333
334
  @acceptBtn.enable
@@ -449,17 +450,15 @@ module Watobo
449
450
  @proxyTable.getItem(lastRowIndex,1).justify = FXTableItem::LEFT
450
451
  end
451
452
 
452
- def initialize(owner, proxy_settings={}, password_policy={})
453
+ def initialize(owner)
453
454
  super(owner, "Use Proxy", :opts => DECOR_ALL, :width => 250, :height => 400)
454
455
  @new_proxy = FXDataTarget.new('')
455
456
  @save_passwords = false
456
457
 
457
- puts proxy_settings.to_yaml
458
-
459
458
  @proxy_settings = Hash.new
460
- @proxy_settings.update(proxy_settings)
459
+ @proxy_settings.update(Watobo::Conf::ForwardingProxy.to_h)
461
460
 
462
- @password_policy = password_policy
461
+ # @password_policy = password_policy
463
462
 
464
463
  @proxy = nil
465
464
  pname = @proxy_settings[:default_proxy]
@@ -136,7 +136,7 @@ module Watobo
136
136
  FXMenuSeparator.new(menu_pane)
137
137
  send2transcoder = FXMenuCommand.new(menu_pane,"send to transcoder")
138
138
  send2transcoder.connect(SEL_COMMAND) {
139
- t = FXTranscoder.new(FXApp.instance, selection)
139
+ t = TranscoderWindow.new(FXApp.instance, selection)
140
140
  t.create
141
141
  t.show(Fox::PLACEMENT_SCREEN)
142
142
  }
@@ -0,0 +1,416 @@
1
+ # .
2
+ # rewrite_filters_dialog.rb
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
+ # .
22
+ module Watobo
23
+ module Gui
24
+ class FilterTableCtrl < FXHorizontalFrame
25
+ attr_accessor :target
26
+
27
+ def initialize(owner,target = nil, opts)
28
+ @target = target
29
+ super owner, opts
30
+ matrix = FXMatrix.new(self, 4, :opts => MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y)
31
+
32
+ %w( Location Match Pattern Flags ).each do |l|
33
+ FXLabel.new(matrix, l)
34
+ end
35
+
36
+ @locations_combo = FXComboBox.new(matrix, 10, nil, 0, COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK)
37
+ #@filterCombo.width =200
38
+
39
+ @locations_combo.numVisible = 0
40
+ @locations_combo.numColumns = 10
41
+ @locations_combo.editable = false
42
+ @locations_combo.connect(SEL_COMMAND){}
43
+
44
+ @match_type_combo = FXComboBox.new(matrix, 10, nil, 0, COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK)
45
+ #@filterCombo.width =200
46
+
47
+ @match_type_combo.numVisible = 0
48
+ @match_type_combo.numColumns = 10
49
+ @match_type_combo.editable = false
50
+ @match_type_combo.connect(SEL_COMMAND){}
51
+
52
+ @pattern_txt = FXTextField.new(matrix, 20, nil, 0, :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN)
53
+
54
+ @flags_combo = FXComboBox.new(matrix, 10, nil, 0, COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK)
55
+ #@filterCombo.width =200
56
+
57
+ @flags_combo.numVisible = 0
58
+ @flags_combo.numColumns = 10
59
+ @flags_combo.editable = false
60
+ @flags_combo.connect(SEL_COMMAND){}
61
+
62
+ frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
63
+ top_btn_frame = FXHorizontalFrame.new(frame,:opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
64
+
65
+ @del_btn = FXButton.new(top_btn_frame, "Del" , nil, nil)
66
+ @del_btn.enable
67
+ @del_btn.connect(SEL_COMMAND){ delete_filter }
68
+
69
+ # @edit_btn = FXButton.new(top_btn_frame, "Edit ..." , nil, nil)
70
+ # @edit_btn.enable
71
+ # @edit_btn.connect(SEL_COMMAND){ delete_filter }
72
+
73
+ @up_btn = FXButton.new(top_btn_frame, "Up" , nil, nil)
74
+ @up_btn.enable
75
+
76
+ @down_btn = FXButton.new(top_btn_frame, "Down" , nil, nil)
77
+ @down_btn.enable
78
+
79
+ add_btn_frame = FXHorizontalFrame.new(frame,:opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
80
+ @add_btn = FXButton.new(add_btn_frame, "Add ..." , nil, nil, )
81
+ @add_btn.enable
82
+ @add_btn.connect(SEL_COMMAND){ add_filter }
83
+
84
+ end
85
+
86
+ private
87
+
88
+ def init_handlers()
89
+
90
+ end
91
+
92
+
93
+ def add_match_type(l)
94
+ @match_type_combo.appendItem(l.to_s, l)
95
+ @match_type_combo.numVisible = @match_type_combo.numItems
96
+ end
97
+
98
+ def add_location(l)
99
+ @locations_combo.appendItem(l.to_s, l)
100
+ @locations_combo.numVisible = @locations_combo.numItems
101
+ end
102
+
103
+ def add_flag(l)
104
+ @flags_combo.appendItem(l.to_s, l)
105
+ @flags_combo.numVisible = @flags_combo.numItems
106
+ end
107
+
108
+ def delete_filter
109
+ @target.delete_current_row if @target.respond_to? :delete_current_row
110
+
111
+ end
112
+
113
+ def add_filter
114
+ return false if @target.nil?
115
+ #TODO: Add some checks if filter is ok
116
+ location = @locations_combo.getItemData(@locations_combo.currentItem)
117
+ pattern = @pattern_txt.text
118
+ match_type = @match_type_combo.getItemData(@match_type_combo.currentItem)
119
+ flag = @flags_combo.getItemData(@flags_combo.currentItem)
120
+
121
+ prefs = {
122
+ :match_type => match_type,
123
+ :flags => ( flag != :none ) ? [flag] : []
124
+ }
125
+
126
+ filter = case location
127
+ when :url
128
+ Watobo::Interceptor::UrlFilter.new(pattern, prefs)
129
+ when :method
130
+ Watobo::Interceptor::MethodFilter.new(pattern, prefs)
131
+ when :url_parms
132
+ Watobo::Interceptor::HttpParmsFilter.new(pattern, prefs)
133
+ when :status
134
+ Watobo::Interceptor::StatusFilter.new(pattern, prefs)
135
+ when :flags
136
+ Watobo::Interceptor::FlagFilter.new('', prefs)
137
+ end
138
+ @target.add_filter filter
139
+ end
140
+
141
+ end
142
+
143
+ class RequestFilterCtrl < FilterTableCtrl
144
+ def initialize(owner, target, opts)
145
+ super owner, target, opts
146
+ add_location :url
147
+ add_location :method
148
+ #add_location :header
149
+ #add_location :cookie
150
+ add_location :url_parms
151
+
152
+ add_match_type :match
153
+ add_match_type :not_match
154
+
155
+ add_flag :none
156
+ add_flag :request
157
+ end
158
+ end
159
+
160
+ class ResponseFilterCtrl < FilterTableCtrl
161
+ def initialize(owner, target, opts)
162
+ super owner, target, opts
163
+ # add_location :body
164
+ # add_location :header
165
+ add_location :status
166
+ add_location :header
167
+ add_location :flags
168
+
169
+ add_match_type :match
170
+ add_match_type :not_match
171
+
172
+ add_flag :none
173
+ add_flag :request
174
+ end
175
+ end
176
+
177
+ class FilterTable < FXTable
178
+ attr :filters
179
+ def add_filter(filter)
180
+ @filters << filter
181
+ add_filter_row(filter)
182
+ end
183
+
184
+ def get_current_filter
185
+ puts self.currentRow
186
+ end
187
+
188
+ def delete_row_by_index(index)
189
+ return false if index < 0
190
+ return false if index > self.numRows-1
191
+ @filters.delete_at index
192
+ self.clearItems
193
+ init_columns
194
+
195
+ @filters.each do |r|
196
+ add_filter_row r
197
+ end
198
+ adjust_cell_width
199
+ self.selectRow self.currentRow if self.currentRow >= 0
200
+ true
201
+ end
202
+
203
+ def delete_current_row
204
+ i = self.currentRow
205
+ return false if i < 0
206
+ delete_row_by_index i
207
+ end
208
+
209
+ def initialize( owner, filters=[], opts={} )
210
+ @event_dispatcher_listeners = Hash.new
211
+ parms = { :opts => TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP,
212
+ :padding => 2
213
+ }
214
+ parms.update opts
215
+
216
+ super(owner, parms)
217
+
218
+ self.extend Watobo::Gui::Subscriber
219
+ self.setBackColor(FXRGB(255, 255, 255))
220
+ self.setCellColor(0, 0, FXRGB(255, 255, 255))
221
+ self.setCellColor(0, 1, FXRGB(255, 240, 240))
222
+ self.setCellColor(1, 0, FXRGB(240, 255, 240))
223
+ self.setCellColor(1, 1, FXRGB(240, 240, 255))
224
+
225
+ @columns=Hash.new
226
+
227
+ @filters = []
228
+ @filters.concat filters
229
+
230
+ add_column "Location", 80
231
+ add_column "Match", 80
232
+ add_column "Pattern", 80
233
+ add_column "Flags", 80
234
+
235
+
236
+ init_columns
237
+
238
+ @filters.each do |r|
239
+ add_filter_row r
240
+ end
241
+ adjust_cell_width
242
+
243
+ self.connect(SEL_SELECTED){|sender,sel,pos|
244
+ self.selectRow pos.row
245
+ # notify(:filter_selected, @filters[pos.row])
246
+ }
247
+ end
248
+
249
+ private
250
+
251
+ def add_filter_row(filter)
252
+ return false if filter.nil?
253
+ row_index = self.getNumRows
254
+ self.appendRows(1)
255
+
256
+ self.rowHeader.setItemJustify(row_index, FXHeaderItem::RIGHT)
257
+ self.setRowText(row_index, (row_index+1).to_s)
258
+
259
+ index = @columns[:location][:order]
260
+ self.setItemText(row_index, index, filter.name)
261
+ self.getItem(row_index, index).justify = FXTableItem::LEFT
262
+
263
+ index = @columns[:match][:order]
264
+ self.setItemText(row_index, index, filter.match_type.to_s)
265
+ self.getItem(row_index, index).justify = FXTableItem::LEFT
266
+
267
+ index = @columns[:flags][:order]
268
+ self.setItemText(row_index, index, filter.flags.join(","))
269
+ self.getItem(row_index, index).justify = FXTableItem::LEFT
270
+
271
+ index = @columns[:pattern][:order]
272
+ self.setItemText(row_index, index, filter.pattern)
273
+ self.getItem(row_index, index).justify = FXTableItem::LEFT
274
+
275
+
276
+ end
277
+ def add_column(name, width, order=0)
278
+ o = ( order == 0 ) ? @columns.length : order
279
+ @columns[name.downcase.to_sym] = { :name => name,
280
+ :width => width,
281
+ :order => o
282
+ }
283
+
284
+ end
285
+
286
+ def adjust_cell_width()
287
+ begin
288
+ self.rowHeader.width = 30
289
+ #self.fitColumnsToContents(0)
290
+ @columns.each_with_index do |v,i|
291
+
292
+ self.setColumnWidth(i, v[1][:width])
293
+ end
294
+ rescue => bang
295
+ puts "!!!ERROR: adjustCellWidth"
296
+ puts bang
297
+ puts bang.backtrace
298
+ end
299
+
300
+ end
301
+
302
+ def init_columns
303
+ self.setTableSize(0, @columns.length)
304
+ self.visibleRows = 5
305
+ self.visibleColumns = @columns.length
306
+
307
+ @columns.sort_by{|k,v| v[:order] }.each_with_index do |v,i|
308
+ self.setColumnText( i, v[1][:name] )
309
+ end
310
+
311
+ end
312
+
313
+ end
314
+
315
+ class RequestFilterTable < FilterTable
316
+ def initialize(owner, opts={})
317
+ super owner, opts
318
+ add_column "Action", 50
319
+ add_column "Location", 80
320
+ add_column "Pattern", 80
321
+ add_column "Content", 80
322
+ add_column "Filter", 80
323
+
324
+ init_columns
325
+ adjust_cell_width
326
+
327
+ end
328
+ end
329
+
330
+ class RequestFilterDialog < FXDialogBox
331
+
332
+ include Responder
333
+ def filter
334
+ f = Watobo::Interceptor::FilterChain.new
335
+ f.set_filters @table.filters
336
+ f
337
+ end
338
+
339
+ def initialize(owner, rule, settings = {} )
340
+ super(owner, "Request Rule Filter", DECOR_TITLE|DECOR_BORDER|DECOR_CLOSE, :width => 650, :height => 300)
341
+
342
+ FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)
343
+
344
+ @main_frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
345
+
346
+ @table = FilterTable.new(@main_frame, rule.filters)
347
+ @table_ctrl = RequestFilterCtrl.new(@main_frame, @table, :opts => LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK)
348
+
349
+ buttons_frame = FXHorizontalFrame.new(@main_frame, :opts => LAYOUT_FILL_X|LAYOUT_BOTTOM)
350
+ @finishButton = FXButton.new(buttons_frame, "Accept" , nil, nil, :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
351
+ @finishButton.enable
352
+ @finishButton.connect(SEL_COMMAND) do |sender, sel, item|
353
+ #self.handle(self, FXSEL(SEL_COMMAND, ID_CANCEL), nil)
354
+ self.handle(self, FXSEL(SEL_COMMAND, ID_ACCEPT), nil)
355
+ end
356
+
357
+ @cancelButton = FXButton.new(buttons_frame, "Cancel" ,
358
+ :target => self, :selector => FXDialogBox::ID_CANCEL,
359
+ :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
360
+ end
361
+
362
+ private
363
+
364
+ def onAccept(sender, sel, event)
365
+
366
+ getApp().stopModal(self, 1)
367
+ self.hide()
368
+ return 1
369
+ end
370
+
371
+
372
+ end
373
+
374
+ class ResponseFilterDialog < FXDialogBox
375
+
376
+ include Responder
377
+ def filter
378
+ f = Watobo::Interceptor::FilterChain.new
379
+ f.set_filters @table.filters
380
+ f
381
+ end
382
+
383
+ def initialize(owner, rule, settings = {} )
384
+ super(owner, "Response Rule Filters", DECOR_TITLE|DECOR_BORDER|DECOR_CLOSE, :width => 650, :height => 300)
385
+
386
+ FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)
387
+
388
+ @main_frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
389
+
390
+ @table = FilterTable.new(@main_frame, rule.filters)
391
+ @table_ctrl = ResponseFilterCtrl.new(@main_frame, @table, :opts => LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK)
392
+
393
+ buttons_frame = FXHorizontalFrame.new(@main_frame, :opts => LAYOUT_FILL_X|LAYOUT_BOTTOM)
394
+ @finishButton = FXButton.new(buttons_frame, "Accept" , nil, nil, :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
395
+ @finishButton.enable
396
+ @finishButton.connect(SEL_COMMAND) do |sender, sel, item|
397
+ #self.handle(self, FXSEL(SEL_COMMAND, ID_CANCEL), nil)
398
+ self.handle(self, FXSEL(SEL_COMMAND, ID_ACCEPT), nil)
399
+ end
400
+
401
+ @cancelButton = FXButton.new(buttons_frame, "Cancel" ,
402
+ :target => self, :selector => FXDialogBox::ID_CANCEL,
403
+ :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
404
+ end
405
+
406
+ private
407
+
408
+ def onAccept(sender, sel, event)
409
+ getApp().stopModal(self, 1)
410
+ self.hide()
411
+ return 1
412
+ end
413
+
414
+ end
415
+ end
416
+ end