Class: Watobo::Gui::ManualRequestEditor

Inherits:
FXDialogBox
  • Object
show all
Includes:
Icons
Defined in:
lib/watobo/gui/manual_request_editor.rb

Overview


Constant Summary collapse

SCANNER_IDLE =

include Responder ID_CTRL_S = ID_LAST ID_LAST = ID_CTRL_S + 1

0x00
SCANNER_STARTED =
0x01
SCANNER_FINISHED =
0x02
SCANNER_CANCELED =
0x04

Constants included from Icons

Icons::ICON_ADD_PROJECT, Icons::ICON_BROWSER_MEDIUM, Icons::ICON_BROWSER_SMALL, Icons::ICON_BTN_DOWN, Icons::ICON_BTN_UP, Icons::ICON_CB_CHECKED, Icons::ICON_CB_CHECKED_ORANGE, Icons::ICON_CB_UNCHECKED, Icons::ICON_CONVERSATION, Icons::ICON_DASHBOARD, Icons::ICON_DIFFER, Icons::ICON_FOLDER, Icons::ICON_FOLDER_SMALL, Icons::ICON_FUZZER, Icons::ICON_FUZZER_MEDIUM, Icons::ICON_FUZZER_SMALL, Icons::ICON_FUZZ_FILTER, Icons::ICON_FUZZ_GENERATOR, Icons::ICON_FUZZ_TAG, Icons::ICON_HINTS, Icons::ICON_HINTS_INFO, Icons::ICON_HINTS_INFO_SMALL, Icons::ICON_HINTS_SMALL, Icons::ICON_INFO, Icons::ICON_INFO_INFO, Icons::ICON_INFO_INFO_SMALL, Icons::ICON_INFO_SMALL, Icons::ICON_INFO_USER, Icons::ICON_INFO_USER_SMALL, Icons::ICON_INTERCEPTOR, Icons::ICON_LOGIN_WIZZARD, Icons::ICON_MANUAL_REQUEST, Icons::ICON_MANUAL_REQUEST_MEDIUM, Icons::ICON_MANUAL_REQUEST_SMALL, Icons::ICON_PAUSE, Icons::ICON_PLUGIN, Icons::ICON_PROJECT, Icons::ICON_PROJECT_SMALL, Icons::ICON_REPORT, Icons::ICON_REQUEST, Icons::ICON_REQUEST_SMALL, Icons::ICON_SEND_REQUEST, Icons::ICON_SITE, Icons::ICON_SITE_SMALL, Icons::ICON_START, Icons::ICON_STOP, Icons::ICON_TOKEN, Icons::ICON_TRANSCODER, Icons::ICON_VULN, Icons::ICON_VULN_BP, Icons::ICON_VULN_BP_SMALL, Icons::ICON_VULN_CRITICAL, Icons::ICON_VULN_CRITICAL_SMALL, Icons::ICON_VULN_HIGH, Icons::ICON_VULN_HIGH_SMALL, Icons::ICON_VULN_LOW, Icons::ICON_VULN_LOW_SMALL, Icons::ICON_VULN_MEDIUM, Icons::ICON_VULN_MEDIUM_SMALL, Icons::ICON_VULN_SMALL, Icons::ICON_WATOBO, Icons::SIBERAS_ICON, Icons::TBL_ICON_LOCK, Icons::WATOBO_LOGO

Constants included from Constants

Constants::AC_GROUP_APACHE, Constants::AC_GROUP_DOMINO, Constants::AC_GROUP_ENUMERATION, Constants::AC_GROUP_FILE_INCLUSION, Constants::AC_GROUP_FLASH, Constants::AC_GROUP_GENERIC, Constants::AC_GROUP_JBOSS, Constants::AC_GROUP_JOOMLA, Constants::AC_GROUP_SAP, Constants::AC_GROUP_SQL, Constants::AC_GROUP_TYPO3, Constants::AC_GROUP_XSS, Constants::AUTH_TYPE_BASIC, Constants::AUTH_TYPE_DIGEST, Constants::AUTH_TYPE_NONE, Constants::AUTH_TYPE_NTLM, Constants::CHAT_SOURCE_AUTO_SCAN, Constants::CHAT_SOURCE_FUZZER, Constants::CHAT_SOURCE_INTERCEPT, Constants::CHAT_SOURCE_MANUAL, Constants::CHAT_SOURCE_MANUAL_SCAN, Constants::CHAT_SOURCE_PROXY, Constants::CHAT_SOURCE_UNDEF, Constants::DEFAULT_PORT_HTTP, Constants::DEFAULT_PORT_HTTPS, Constants::FINDING_TYPE_HINT, Constants::FINDING_TYPE_INFO, Constants::FINDING_TYPE_UNDEFINED, Constants::FINDING_TYPE_VULN, Constants::FIRST_TIME_FILE, Constants::GUI_REGULAR_FONT_SIZE, Constants::GUI_SMALL_FONT_SIZE, Constants::ICON_PATH, Constants::LOG_DEBUG, Constants::LOG_INFO, Constants::SCAN_CANCELED, Constants::SCAN_FINISHED, Constants::SCAN_PAUSED, Constants::SCAN_STARTED, Constants::TE_CHUNKED, Constants::TE_COMPRESS, Constants::TE_DEFLATE, Constants::TE_GZIP, Constants::TE_IDENTITY, Constants::TE_NONE, Constants::VULN_RATING_CRITICAL, Constants::VULN_RATING_HIGH, Constants::VULN_RATING_INFO, Constants::VULN_RATING_LOW, Constants::VULN_RATING_MEDIUM, Constants::VULN_RATING_UNDEFINED

Instance Method Summary collapse

Constructor Details

#initialize(owner, project, chat) ⇒ ManualRequestEditor

Returns a new instance of ManualRequestEditor.



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/watobo/gui/manual_request_editor.rb', line 270

def initialize(owner, project, chat)
   begin
      # Invoke base class initialize function first

      super(owner, "Manual Request Toolkit", :opts => DECOR_ALL,:width=>850, :height=>600)

      @event_dispatcher_listeners = Hash.new
      @chat_queue = Queue.new

      @request_sender = ManualRequestSender.new(self.object_id)
      @request_sender.subscribe(:follow_redirect){ |loc| logger( "follow redirect -> #{loc}")}
      @responseFilter = FXDataTarget.new("")

      @chat = chat
      
      if chat.respond_to? :request
        self.title = "#{chat.request.method} #{chat.request.url}"
      end

      @original_request = chat.copyRequest

      @project = project

      @csrf_requests = []

      @tselect = ""
      @sel_pos = ""
      @sel_len = ""

      @last_request = nil
      @last_response = nil

      @history_size = 10
      @history = []
      @counter = 0

      @scanner = nil
      
      @new_response = nil
      @new_request = nil
      
      @update_lock = Mutex.new
      @scan_status_lock = Mutex.new
      @scan_status = SCANNER_IDLE

     
      self.icon = ICON_MANUAL_REQUEST

      # Construct some hilite styles
      hs_red = FXHiliteStyle.new
      hs_red.normalForeColor = FXRGBA(255,255,255,255) # FXColor::Red
      hs_red.normalBackColor = FXRGBA(255,0,0,1)   # FXColor::White
      hs_red.style = FXText::STYLE_BOLD

      mr_splitter = FXSplitter.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_VERTICAL|SPLITTER_REVERSED|SPLITTER_TRACKING)
      # top = FXHorizontalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_SIDE_BOTTOM)
      top_frame = FXVerticalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y||LAYOUT_FIX_HEIGHT|LAYOUT_BOTTOM,:height => 500)
      top_splitter = FXSplitter.new(top_frame, LAYOUT_FILL_X|SPLITTER_HORIZONTAL|LAYOUT_FILL_Y|SPLITTER_TRACKING)

      log_frame = FXVerticalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM,:height => 100)

      #LAYOUT_FILL_X in combination with LAYOUT_FIX_WIDTH

      req_editor = FXVerticalFrame.new(top_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FIX_WIDTH|LAYOUT_FILL_Y|FRAME_GROOVE,:width=>400, :height=>500)

      req_edit_header = FXHorizontalFrame.new(req_editor, :opts => LAYOUT_FILL_X)

      @req_builder = RequestBuilder.new(req_editor, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding=>0)
      @req_builder.subscribe(:hotkey_ctrl_s) {
         simulatePressSendBtn()
         sendManualRequest()
      }
      @req_builder.subscribe(:hotkey_ctrl_enter) {
         simulatePressSendBtn()
         sendManualRequest()
      }

      @req_builder.subscribe(:error) { |msg| logger(msg)}

      @req_builder.setRequest(@original_request)

      history_navigation = FXHorizontalFrame.new(req_edit_header, :opts => FRAME_NONE)
      FXLabel.new(history_navigation, "History:", :opts => LAYOUT_CENTER_Y )
      hback = FXButton.new(history_navigation, "<", nil, nil, 0, FRAME_RAISED|FRAME_THICK)
      @history_pos_dt = FXDataTarget.new(0)
      @history_pos = FXTextField.new(history_navigation, 2, @history_pos_dt, FXDataTarget::ID_VALUE, :opts => LAYOUT_FILL_X|FRAME_GROOVE|FRAME_SUNKEN)
      @history_pos.justify = JUSTIFY_RIGHT
      @history_pos.handle(self, FXSEL(SEL_UPDATE, 0), nil)

      hback.connect(SEL_COMMAND){ showHistory(-1)}
      hnext = FXButton.new(history_navigation, ">", nil, nil, 0, FRAME_RAISED|FRAME_THICK)
      hnext.connect(SEL_COMMAND){ showHistory(1)}

      menu = FXMenuPane.new(self)
      FXMenuCommand.new(menu, "-> GET").connect(SEL_COMMAND, method(:trans2Get))
      FXMenuCommand.new(menu, "-> POST").connect(SEL_COMMAND, method(:trans2Post))
      #  FXMenuCommand.new(menu, "POST <=> GET").connect(SEL_COMMAND, method(:switchMethod))

      req_reset_button = FXButton.new(req_edit_header, "Reset", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_FILL_Y)
      req_reset_button.connect(SEL_COMMAND, method(:onRequestReset))

      # Button to pop menu
      FXMenuButton.new(req_edit_header, "&Transform", nil, menu, (MENUBUTTON_DOWN|FRAME_RAISED|FRAME_THICK|ICON_AFTER_TEXT|LAYOUT_RIGHT|LAYOUT_FILL_Y))

      frame = FXHorizontalFrame.new(req_editor, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM, :padding => 0)
      req_options = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
      #eq_options = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM)

      #opt = FXGroupBox.new(req_options, "Request Options", LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)

      @settings_tab = FXTabBook.new(req_options, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT)

      resp_tab = FXTabItem.new(@settings_tab, "Request Options", nil)
      opt= FXVerticalFrame.new(@settings_tab, :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y)

      @updateContentLength = FXCheckButton.new(opt, "Update Content-Length", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
      @updateContentLength.checkState = true

      @followRedirect = FXCheckButton.new(opt, "Follow Redirects", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
      @followRedirect.checkState = false

      @logChat = FXCheckButton.new(opt, "Log Chat", nil, 0,
      ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
      @logChat.checkState = false

      sess_tab = FXTabItem.new(@settings_tab, "Session Settings", nil)
      session_frame = FXVerticalFrame.new(@settings_tab, :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y)
      
      sidframe = FXHorizontalFrame.new(session_frame, :opts => FRAME_NONE|LAYOUT_FILL_X|PACK_UNIFORM_HEIGHT, :padding => 0 )
      @updateSID = FXCheckButton.new(sidframe, "Update SID Cache ...", nil, 0, JUSTIFY_LEFT|JUSTIFY_CENTER_Y|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
      @updateSID.checkState = false
      FXButton.new(sidframe, "Clear", nil, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND){
        Watobo::SIDCache.acquire(self.object_id).clear
      }

      @updateSession = FXCheckButton.new(session_frame, "Update Session", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
      @updateSession.checkState = true
      @updateSession.connect(SEL_COMMAND) do |sender, sel, item|
         @runLogin.enabled = @updateSession.checked?
      end

      @runLogin = FXCheckButton.new(session_frame, "Run Login", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
      @runLogin.checkState = false

      csrf_frame = FXHorizontalFrame.new(session_frame,:opts => LAYOUT_FILL_X|PACK_UNIFORM_HEIGHT, :padding => 0)
      @updateCSRF = FXCheckButton.new(csrf_frame, "Update One-Time-Tokens ...", nil, 0, JUSTIFY_LEFT|ICON_BEFORE_TEXT)
      @updateCSRF.checkState = false
      @csrf_settings_btn = FXButton.new(csrf_frame, "Settings", nil, nil, 0, FRAME_RAISED|FRAME_THICK)
      @csrf_settings_btn.connect(SEL_COMMAND, method(:openCSRFTokenDialog))

      @updateCSRF.connect(SEL_COMMAND) do |sender, sel, item|
         if @updateCSRF.checked? then
            @csrf_settings_btn.enable
         else
            @csrf_settings_btn.disable
         end
      end

      ##################################################

      button_frame = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_Y|LAYOUT_FIX_WIDTH|LAYOUT_RIGHT, :width => 100)
      send_frame = FXVerticalFrame.new(button_frame, :opts => LAYOUT_FILL_Y|LAYOUT_FILL_X, :padding => 2)
      send_frame.backColor = FXColor::Red
      #btn_send = FXButton.new(frame, "\nSEND", ICON_SEND_REQUEST, nil, 0, :opts => ICON_ABOVE_TEXT|FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_Y|LAYOUT_FIX_WIDTH|LAYOUT_RIGHT, :width => 100)
      @btn_send = FXButton.new(send_frame, "\nSEND", ICON_SEND_REQUEST, nil, 0, :opts => ICON_ABOVE_TEXT|FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_Y|LAYOUT_FILL_X|LAYOUT_RIGHT)
      btn_prev = FXButton.new(button_frame, "preview >>", nil, nil, 0, :opts => LAYOUT_FILL_X|FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT)
      btn_prev.connect(SEL_COMMAND,method(:onPreviewClick))

      frame = FXHorizontalFrame.new(req_editor, :opts => LAYOUT_FILL_X|FRAME_GROOVE)

      @btn_quickscan = FXButton.new(frame, "QuickScan", nil, nil, 0, FRAME_RAISED|FRAME_THICK)
      @btn_quickscan.connect(SEL_COMMAND, method(:onBtnQuickScan))
      @pbar = FXProgressBar.new(frame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK|PROGRESSBAR_HORIZONTAL)
      @pbar.progress = 0
      @pbar.total = 0
      @pbar.barColor = 'grey' #FXRGB(255,0,0)

      # TODO: Implement font sizing
      #@req_builder.font = FXFont.new(app, "courier" , 14, :encoding=>FONTENCODING_ISO_8859_1)

      result_viewer = FXVerticalFrame.new(top_splitter, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE|LAYOUT_FIX_WIDTH, :width => 400)

      # log_viewer = FXVerticalFrame.new(bottom_frame, :opts => LAYOUT_FILL_X|FRAME_GROOVE|LAYOUT_BOTTOM)

      @tabBook = FXTabBook.new(result_viewer, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT)

      resp_tab = FXTabItem.new(@tabBook, "Response", nil)
      frame = FXVerticalFrame.new(@tabBook, :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
      @response_viewer = Watobo::Gui::ResponseViewer.new(frame, LAYOUT_FILL_X|LAYOUT_FILL_Y)
      #@response_viewer.ma
      @response_viewer.max_len = 0

      options = FXHorizontalFrame.new(frame, :opts => LAYOUT_FILL_X)
      frame = FXHorizontalFrame.new(options, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN)
      frame.backColor = FXColor::White
      label = FXLabel.new(frame, "MD5: ", :opts => LAYOUT_FILL_Y|JUSTIFY_CENTER_Y)
      label.backColor = FXColor::White
      @responseMD5 = FXLabel.new(frame, "-N/A-", :opts => LAYOUT_FILL_Y|JUSTIFY_CENTER_Y)
      @responseMD5.backColor = FXColor::White

      browser_button = FXButton.new(options, "Browser-View", ICON_BROWSER_MEDIUM, nil, 0, :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
      browser_button.connect(SEL_COMMAND) {
         begin
            unless @current_chat.nil?
               #@interface.openBrowser(@last_request, @last_response)
               notify(:show_browser_preview, @current_chat.request, @current_chat.response)
            end
         rescue => bang
            puts bang

         end
      }

      req_tab = FXTabItem.new(@tabBook, "Request", nil)
      @request_viewer = Watobo::Gui::RequestViewer.new(@tabBook, FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y)

      diff_tab = FXTabItem.new(@tabBook, "Differ", nil)

      @diff_frame = DiffFrame.new(@tabBook, :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y)

      log_text_frame = FXVerticalFrame.new(log_frame, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding=>0)
      @log_viewer = LogViewer.new(log_text_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
      #--------------------------------------------------------------------------------

      @btn_send.connect(SEL_COMMAND, method(:onBtnSendClick))

      add_update_timer(50)

   rescue => bang
      puts bang
      puts bang.backtrace if $DEBUG
   end

end

Instance Method Details

#addHistoryItem(chat, raw_request) ⇒ Object



125
126
127
128
129
130
131
# File 'lib/watobo/gui/manual_request_editor.rb', line 125

def addHistoryItem(chat, raw_request)
   @history.push HistoryItem.new(chat, eval(YAML.load(YAML.dump(raw_request.inspect))))

   @history.shift if @history.length > @history_size

   @diff_frame.updateHistory(@history)
end

#clearEvents(event) ⇒ Object



104
105
106
# File 'lib/watobo/gui/manual_request_editor.rb', line 104

def clearEvents(event)
   @event_dispatcher_listener[event].clear
end

#logger(message) ⇒ Object



120
121
122
123
# File 'lib/watobo/gui/manual_request_editor.rb', line 120

def logger(message)
 @log_viewer.log( LOG_INFO, message )
 puts "[#{self.class.to_s}] #{message}" if $DEBUG
end

#notify(event, *args) ⇒ Object



108
109
110
111
112
113
114
# File 'lib/watobo/gui/manual_request_editor.rb', line 108

def notify(event, *args)
   if @event_dispatcher_listeners[event]
      @event_dispatcher_listeners[event].each do |m|
         m.call(*args) if m.respond_to? :call
      end
   end
end

#onBtnQuickScan(sender, sel, item) ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/watobo/gui/manual_request_editor.rb', line 133

def onBtnQuickScan(sender, sel, item)
   dlg = Watobo::Gui::QuickScanDialog.new(self, :target_chat => @chat, :enable_one_time_tokens => @updateCSRF.checked?)
   scan_chats = []
   if sender.text =~ /Cancel/i
      @scanner.cancel() if @scanner.respond_to? :cancel
      @scanner = nil
      logger("QuickScan canceled by user")
      @pbar.progress = 0
      @pbar.total = 0
      @pbar.barColor = 'grey' #FXRGB(255,0,0)
      sender.text = "QuickScan"
      return
   end

   if dlg.execute != 0 then
     puts "* Dialog Finished"
      scan_modules = []
      sender.text = "Cancel"
      quick_scan_options = dlg.options
      # puts quick_scan_options.to_yaml

      if quick_scan_options[:use_orig_request] == true then
         req = @original_request
      else
         req = @req_builder.parseRequest()
      end

      scan_chats.push Chat.new(Watobo::Request.new(req), Watobo::Response.new(@chat.response), :id => @chat.id, :run_passive_checks => false)
   end

   unless scan_chats.empty? then
     
      log_message = ["QuickScan Started"]
      log_message << "Target URL: #{scan_chats.first.request.url}"
      
      acc = dlg.selectedModules
      
      acc.each do |ac|
        log_message << "Module: #{ac.check_name}"
      end

     # scan_prefs = @project.getScanPreferences
     scan_prefs = Watobo::Conf::Scanner.to_h
      # we don't want logout detection during a QuickScan
      # TODO: let this decide the user!
      scan_prefs[:logout_signatures] = [] if quick_scan_options[:detect_logout] == false
      #  scan_prefs[:csrf_requests] = @project.getCSRFRequests(@original_request) if quick_scan_options[:update_csrf_tokens] == true
      scan_prefs[:run_passive_checks] = false

      # logging required ?

      if quick_scan_options[:enable_logging] and quick_scan_options[:scanlog_name]
         scan_prefs[:scanlog_name] = quick_scan_options[:scanlog_name]
      end
      
      scan_prefs.update quick_scan_options
      
      if $DEBUG
       puts "* creating scanner ..."
       puts quick_scan_options.to_yaml
       puts "- - - - - - - - -"
       puts scan_prefs.to_yaml
     end
     
     # we only can have one thread for csrf_token updates ... because it's not thread-safe ... yet
     scan_prefs[:max_parallel_checks] = 1 if scan_prefs[:update_csrf_tokens] == true

      @scanner = Watobo::Scanner3.new(scan_chats, acc, [], scan_prefs)
      
      sum_totals = 0
      @scanner.progress.each_value do |v|
        sum_totals += v[:total]
      end
      @pbar.total = sum_totals
      @pbar.progress = 0
      @pbar.barColor = FXRGB(255,0,0)

      csrf_requests = []

      if quick_scan_options[:update_csrf_tokens] == true
         csrf_requests = Watobo::OTTCache.requests(req)
         puts "* Got No CSRF Requests!!" if csrf_requests.empty?
      end

      run_prefs = {
         :update_sids => @updateSID.checked?,
         :update_session => @updateSession.checked?,
         :csrf_requests => csrf_requests,
         :csrf_patterns => scan_prefs[:csrf_patterns],
         :www_auth => scan_prefs[:www_auth],
         :follow_redirect => quick_scan_options[:follow_redirect],
      }
     
     logger("Scan Started ...")
     Watobo.log(log_message, :sender => self.class.to_s.gsub(/.*:/,""))
     
     @scan_status = SCANNER_STARTED
     @scanner.run( run_prefs)
     
   end

   # return 0

end

#onBtnSendClick(sender, sel, item) ⇒ Object



238
239
240
# File 'lib/watobo/gui/manual_request_editor.rb', line 238

def onBtnSendClick(sender,sel,item)
   sendManualRequest()
end

#onPreviewClick(sender, sel, item) ⇒ Object



242
243
244
245
246
247
248
# File 'lib/watobo/gui/manual_request_editor.rb', line 242

def onPreviewClick(sender,sel,item)
   @request_viewer.setText('')
   new_request = @req_builder.parseRequest
   #  puts "new request: #{new_request}"
   @request_viewer.setText(new_request)
   @tabBook.current = 1
end

#onRequestReset(sender, sel, item) ⇒ Object



116
117
118
# File 'lib/watobo/gui/manual_request_editor.rb', line 116

def onRequestReset(sender,sel,item)
   @req_builder.setRequest(@original_request)
end

#openCSRFTokenDialog(sender, sel, item) ⇒ Object



94
95
96
97
98
99
100
101
102
# File 'lib/watobo/gui/manual_request_editor.rb', line 94

def openCSRFTokenDialog(sender, sel, item)
   csrf_dlg = CSRFTokenDialog.new(self, @chat)
   if csrf_dlg.execute != 0 then
      csrf_ids = csrf_dlg.getTokenScriptIds()
      Watobo::OTTCache.set_chat_ids @chat, csrf_ids
      Watobo::Conf::OttCache.patterns = csrf_dlg.getTokenPatterns()
      Watobo::Conf::OttCache.save_project
   end
end

#showHistory(dist = 0, pos = nil) ⇒ Object



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/watobo/gui/manual_request_editor.rb', line 250

def showHistory(dist=0, pos=nil)
   if @history.length > 0

      current_pos = @history_pos_dt.value
      new_pos = current_pos + dist
      new_pos = 1 if new_pos <= 0
      new_pos = @history.length if new_pos > @history.length

      @req_builder.setRequest(@history[new_pos-1].raw_request)
      @req_builder.highlight("(%%[^%]*%%)")

      @response_viewer.setText(@history[new_pos-1].response)

      @history_pos_dt.value = new_pos
      @history_pos.handle(self, FXSEL(SEL_UPDATE, 0), nil)
      return new_pos
   end
   return 0 if dist == 0 and not pos
end

#subscribe(event, &callback) ⇒ Object



90
91
92
# File 'lib/watobo/gui/manual_request_editor.rb', line 90

def subscribe(event, &callback)
   (@event_dispatcher_listeners[event] ||= []) << callback
end