Class: Watobo::Plugin::Filefinder::Filefinder

Inherits:
Template::Plugin show all
Defined in:
plugins/filefinder/filefinder.rb

Defined Under Namespace

Classes: DBSelectFrame

Constant Summary

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

Constants included from Gui::Icons

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

Constants included from Gui

Gui::DIFF_TYPE_NEW, Gui::DIFF_TYPE_ORIG, Gui::SEL_TYPE_GREP, Gui::SEL_TYPE_HIGHLIGHT, Gui::TABLE_COL_COMMENT, Gui::TABLE_COL_COOKIE, Gui::TABLE_COL_HOST, Gui::TABLE_COL_METHOD, Gui::TABLE_COL_PARMS, Gui::TABLE_COL_PATH, Gui::TABLE_COL_SSL, Gui::TABLE_COL_STATUS

Constants included from Diff::LCS

Diff::LCS::BalancedCallbacks, Diff::LCS::PATCH_MAP, Diff::LCS::SequenceCallbacks, Diff::LCS::VERSION

Instance Attribute Summary

Attributes inherited from Template::Plugin

#icon, #plugin_name

Instance Method Summary collapse

Methods inherited from Template::Plugin

#clearEvents, #load_icon, #notify, #subscribe

Methods included from Diff::LCS

LCS, __diff_direction, __inverse_vector, __lcs, __normalize_patchset, __position_hash, __replace_next_larger, diff, #diff, #lcs, patch, #patch, #patch!, patch!, sdiff, #sdiff, traverse_balanced, #traverse_balanced, traverse_sequences, #traverse_sequences, #unpatch, #unpatch!, unpatch!

Constructor Details

#initialize(owner, project) ⇒ Filefinder

Returns a new instance of Filefinder.



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
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
# File 'plugins/filefinder/filefinder.rb', line 228

def initialize(owner, project)
  super(owner, "File Finder", project, :opts => DECOR_ALL, :width=>800, :height=>600)
  load_icon(__FILE__)
  
  @event_dispatcher_listeners = Hash.new
  @scanner = nil
  @plugin_name = "File-Finder"
  @project = project
  @path = Dir.getwd
  
  
  @site = nil
  @dir = nil
  @db_list = []
  @db_name = ""
  @file_name = ""
  
  config = load_config

  
  if config.respond_to? :has_key?
  if config.has_key? :db_list
    config[:db_list].each do |db|
      @db_list << db if File.exist? db              
    end
  end
  
  if config.has_key? :name
    @db_list.each do |db|
      @db_name = db if config[:name] == db
    end
    @file_name = config[:name] if @db_name.empty?            
  end
  end
  puts @db_list
  
  begin            
    hs_green = FXHiliteStyle.new
    hs_green.normalForeColor = FXRGBA(255,255,255,255) #FXColor::Red
    hs_green.normalBackColor = FXRGBA(0,255,0,1)   # FXColor::White
    hs_green.style = FXText::STYLE_BOLD
    
    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
    
    
    path = Dir.getwd
    
    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)
    
    @settings_tab = FXTabBook.new(top_splitter, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
     FXTabItem.new(@settings_tab, "Settings", nil)
    @settings_frame = FXVerticalFrame.new(@settings_tab, :opts => LAYOUT_FILL_Y|LAYOUT_FILL_Y|FRAME_RAISED)
    
    FXTabItem.new(@settings_tab, "Logging", nil)
    @logging_frame = FXVerticalFrame.new(@settings_tab, :opts => LAYOUT_FILL_Y|LAYOUT_FILL_Y|FRAME_RAISED)
    
     request_frame = FXVerticalFrame.new(top_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
     @requestCombo = FXComboBox.new(request_frame, 5, nil, 0,
                                   COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
    #@filterCombo.width =200
    
    @requestCombo.numVisible = 0
    @requestCombo.numColumns = 50
    @requestCombo.editable = false
    @requestCombo.connect(SEL_COMMAND, method(:onSelectRequest))
    
    log_text_frame = FXVerticalFrame.new(request_frame, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding=>0)
    @request_editor = RequestEditor.new(log_text_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
    
   #   @scope_only_cb = FXCheckButton.new(@settings_frame, "target scope only", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
   # @scope_only_cb.setCheck(false)
   # @scope_only_cb.connect(SEL_COMMAND) { updateView() }
    
    FXLabel.new(@settings_frame, "Select Site:")
    @sites_combo = FXComboBox.new(@settings_frame, 5, nil, 0,
                                  COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
    #@filterCombo.width =200
    
    @sites_combo.numVisible = 20
    @sites_combo.numColumns = 35
    @sites_combo.editable = false
    @sites_combo.connect(SEL_COMMAND, method(:onSiteSelect))
    
    
    
    FXLabel.new(@settings_frame, "Root Directory:")
    @dir_combo = FXComboBox.new(@settings_frame, 5, nil, 0,
                                COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
    @dir_combo.numVisible = 20
    @dir_combo.numColumns = 35
    @dir_combo.editable = false
    @dir_combo.connect(SEL_COMMAND, method(:onDirSelect))
    
    @test_all_dirs = FXCheckButton.new(@settings_frame, "test all sub-directories", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
    @test_all_dirs.setCheck(false)
    
    
    @finder_tab = FXTabBook.new(@settings_frame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT)
    
    FXTabItem.new(@finder_tab, "Filename", nil)
    frame = FXVerticalFrame.new(@finder_tab, :opts => LAYOUT_FILL_X|FRAME_RAISED)
    @search_name_dt = FXDataTarget.new(@file_name)
   
    @dbfile_text = FXTextField.new(frame, 30,
                                   :target => @search_name_dt, :selector => FXDataTarget::ID_VALUE,
                                   :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X)
    @dbfile_text.handle(self, FXSEL(SEL_UPDATE, 0), nil)
    

    FXTabItem.new(@finder_tab, "Database", nil)     
    @db_select_frame = DBSelectFrame.new(@finder_tab, @db_list, :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X)
    
    unless @db_name.empty?
      @db_select_frame.select_db @db_name
      @finder_tab.current = 1
    end
    
    @fmode_dt = FXDataTarget.new(0)
    group_box = FXGroupBox.new(@settings_frame, "Mode", LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
    mode_frame = FXVerticalFrame.new(group_box, :opts => LAYOUT_FILL_X)
    @append_slash_cb = FXCheckButton.new(mode_frame, "append /", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|LAYOUT_FILL_Y)
   
    @append_extensions_cb = FXCheckButton.new(mode_frame, "append extensions", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|LAYOUT_FILL_Y)
    frame = FXVerticalFrame.new(mode_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
    @extensions_text = FXText.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP)
    ext = "bak;php;asp;aspx;tgz;tar.gz;gz;tmp;temp;old;_"        
    
    @extensions_text.setText(ext)
    
    frame = @logging_frame
    @logScanChats = FXCheckButton.new(frame, "enable", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
    @logScanChats.checkState = false

    @logScanChats.connect(SEL_COMMAND) do |sender, sel, item|
      if @logScanChats.checked? then
        @scanlog_name_text.enabled = true
        @scanlog_name_text.backColor = FXColor::White
      else
        @scanlog_name_text.enabled = false
        @scanlog_name_text.backColor = @scanlog_name_text.parent.backColor 
      end
    end

    @scanlog_name_dt = FXDataTarget.new('')
   # @scanlog_name_dt.value = @project.scanLogDirectory() if File.exist?(@project.scanLogDirectory())
    @scanlog_dir_label = FXLabel.new(frame, "Scan Name:" )
    scanlog_frame = FXHorizontalFrame.new(frame,:opts => LAYOUT_FILL_X|LAYOUT_SIDE_TOP)
    @scanlog_name_text = FXTextField.new(scanlog_frame, 20,
    :target => @scanlog_name_dt, :selector => FXDataTarget::ID_VALUE,
    :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X)
    @scanlog_name_text.handle(self, FXSEL(SEL_UPDATE, 0), nil)
    unless @logScanChats.checked?
      @scanlog_name_text.enabled = false
      @scanlog_name_text.backColor = @scanlog_name_text.parent.backColor
    end 
     
    
    @pbar = FXProgressBar.new(@settings_frame, nil, 0, LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK|PROGRESSBAR_HORIZONTAL)
    @pbar.progress = 0
    @pbar.total = 0
    @pbar.barColor=0
    @pbar.barColor = 'grey' #FXRGB(255,0,0)
    
    @speed = FXLabel.new(@settings_frame, "Checks per second: -")
    @speed.disable
    
    @start_button = FXButton.new(@settings_frame, "start")
    @start_button.connect(SEL_COMMAND, method(:start))
    @start_button.disable
    
    log_frame_header = FXHorizontalFrame.new(log_frame, :opts => LAYOUT_FILL_X)
    FXLabel.new(log_frame_header, "Logs:" )
    
    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)
    
    updateView()
    start_update_timer()
  rescue => bang
    puts bang
    puts bang.backtrace if $DEBUG
  end
end

Instance Method Details

#createObject



419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'plugins/filefinder/filefinder.rb', line 419

def create
  super
  
  @log_viewer.purge_logs
  @request_editor.setText('')
  @requestCombo.clearItems()
  @start_button.text = "Start"
  
  updateView()
           # Create the windows
  show(PLACEMENT_SCREEN) # Make the main window appear
  disableOptions()
end

#updateViewObject



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
# File 'plugins/filefinder/filefinder.rb', line 199

def updateView()
  #@project = project
  @sites_combo.clearItems()
  @dir_combo.clearItems()
  @dir_combo.disable
  
      
    @sites_combo.appendItem("no site selected", nil)
    Watobo::Chats.sites(:in_scope => Watobo::Scope.exist? ).each do |site|
      #puts "Site: #{site}"
      @sites_combo.appendItem(site.slice(0..35), site)
    end
    @sites_combo.setCurrentItem(0) if @sites_combo.numItems > 0
    ci = @sites_combo.currentItem
    site = ( ci >= 0 ) ? @sites_combo.getItemData(ci) : nil
     @sites_combo.numVisible = @sites_combo.numItems
    @sites_combo.numColumns = 35
    
    if site
      @dir_combo.enable
      Watobo::Chats.dirs(@site) do |dir|
        @dir_combo.appendItem(dir.slice(0..35), dir)
      end
      @dir_combo.setCurrentItem(0, true) if @dir_combo.numItems > 0
      
    end
end