Module: Watobo::Gui

Includes:
Diff::LCS
Included in:
MainWindow, TranscoderWindow, Plugin2, PluginGui, Template::Plugin
Defined in:
lib/watobo/gui.rb,
lib/watobo/gui/list_box.rb,
lib/watobo/gui/chat_diff.rb,
lib/watobo/gui/dashboard.rb,
lib/watobo/gui/page_tree.rb,
lib/watobo/gui/fuzzer_gui.rb,
lib/watobo/gui/hex_viewer.rb,
lib/watobo/gui/log_viewer.rb,
lib/watobo/gui/sites_tree.rb,
lib/watobo/gui/status_bar.rb,
lib/watobo/gui/html_viewer.rb,
lib/watobo/gui/json_viewer.rb,
lib/watobo/gui/main_window.rb,
lib/watobo/gui/text_viewer.rb,
lib/watobo/gui/about_watobo.rb,
lib/watobo/gui/checkboxtree.rb,
lib/watobo/gui/checkboxtree.rb,
lib/watobo/gui/differ_frame.rb,
lib/watobo/gui/edit_comment.rb,
lib/watobo/gui/finding_info.rb,
lib/watobo/gui/plugin_board.rb,
lib/watobo/gui/proxy_dialog.rb,
lib/watobo/gui/table_editor.rb,
lib/watobo/gui/custom_viewer.rb,
lib/watobo/gui/export_dialog.rb,
lib/watobo/gui/findings_tree.rb,
lib/watobo/gui/request_editor.rb,
lib/watobo/gui/tagless_viewer.rb,
lib/watobo/gui/browser_preview.rb,
lib/watobo/gui/goto_url_dialog.rb,
lib/watobo/gui/interceptor_gui.rb,
lib/watobo/gui/log_file_viewer.rb,
lib/watobo/gui/progress_window.rb,
lib/watobo/gui/project_wizzard.rb,
lib/watobo/gui/utils/gui_utils.rb,
lib/watobo/gui/www_auth_dialog.rb,
lib/watobo/gui/chatviewer_frame.rb,
lib/watobo/gui/full_scan_dialog.rb,
lib/watobo/gui/master_pw_dialog.rb,
lib/watobo/gui/save_chat_dialog.rb,
lib/watobo/gui/utils/init_icons.rb,
lib/watobo/gui/utils/load_icons.rb,
lib/watobo/gui/workspace_dialog.rb,
lib/watobo/gui/xml_viewer_frame.rb,
lib/watobo/gui/csrf_token_dialog.rb,
lib/watobo/gui/edit_scope_dialog.rb,
lib/watobo/gui/quick_scan_dialog.rb,
lib/watobo/gui/transcoder_window.rb,
lib/watobo/gui/certificate_dialog.rb,
lib/watobo/gui/client_cert_dialog.rb,
lib/watobo/gui/conversation_table.rb,
lib/watobo/gui/define_scope_frame.rb,
lib/watobo/gui/preferences_dialog.rb,
lib/watobo/gui/select_chat_dialog.rb,
lib/watobo/gui/utils/load_plugins.rb,
lib/watobo/gui/checks_policy_frame.rb,
lib/watobo/gui/confirm_scan_dialog.rb,
lib/watobo/gui/mixins/gui_settings.rb,
lib/watobo/gui/rewrite_rules_dialog.rb,
lib/watobo/gui/manual_request_editor.rb,
lib/watobo/gui/request_builder_frame.rb,
lib/watobo/gui/utils/master_password.rb,
lib/watobo/gui/utils/session_history.rb,
lib/watobo/gui/password_policy_dialog.rb,
lib/watobo/gui/rewrite_filters_dialog.rb,
lib/watobo/gui/conversation_table_ctrl.rb,
lib/watobo/gui/intercept_filter_dialog.rb,
lib/watobo/gui/scanner_settings_dialog.rb,
lib/watobo/gui/conversation_table_ctrl2.rb,
lib/watobo/gui/session_management_dialog.rb,
lib/watobo/gui/interceptor_settings_dialog.rb,
lib/watobo/gui/utils/save_default_settings.rb,
lib/watobo/gui/utils/save_scanner_settings.rb

Overview

:nodoc: all

Defined Under Namespace

Modules: CheckboxMixin, Icons, MasterPW, Settings, Utils Classes: AboutWatobo, Action, ActionSelect, AddProxyDialog, AddTableParmDialog, AdvancedSettingsFrame, AuthTable, BrowserControl, BrowserPreview, CSRFTokenDialog, CertificateDialog, ChatDiffFrame, ChatDiffViewer, CheckBoxTreeItem, CheckBoxTreeList, ChecksPolicyFrame, ClientCertDialog, ConfirmScanDialog, ConversationFilterDialog, ConversationTable, ConversationTableCtrl, ConversationTableCtrl2, CreateActionDlg, CreateFilterDlg, CreateFuzzerDlg, CreateGeneratorDlg, CustomViewer, Dashboard, DefineScopeFrame, DiffFrame, EditCommentDialog, EditScopeDetailsDialog, EditScopeDialog, ExportDialog, Filter, FilterFrame, FilterTable, FilterTableCtrl, FindingInfo, FindingsTree, FullScanDialog, FuzzRequestEditor, FuzzerCheck, FuzzerGenSelect, FuzzerGui, FuzzerTag, FuzzerTree, GotoUrlDialog, HTMLViewer, HTMLViewerFrame, HexViewer, HistoryItem, IEControl, InterceptEditor, InterceptFilterDialog, InterceptorFilterSettingsDialog, InterceptorSettingsDialog, InterceptorSettingsFrame, InterceptorUI, JsonViewer, ListBox, LogFileViewer, LogViewer, LoginScriptSettings, LogoutSettings, MainWindow, ManualRequestEditor, ManualRequestSender, MasterPWDialog, NewProjectWizzard, PageTree, PasswordPolicyDialog, PluginBoard, PreferencesDialog_UNUSED, ProgressInfo, ProgressWindow, ProjectInfo, ProxyDialog, QuickScanDialog, QuickScanOptionsFrame, RequestBuilder, RequestEditor, RequestFilterCtrl, RequestFilterDialog, RequestFilterTable, RequestRulesCtrl, RequestRulesTable, RequestViewer, ResponseFilterCtrl, ResponseFilterDialog, ResponseRulesCtrl, ResponseViewer, RewriteRulesDialog, RulesTable, RulesTableCtrl, SIDCacheFrame, SaveChatDialog, ScanProgressFrame, ScannerSettingsDialog, ScannerSettingsFrame, ScopeDetailsFrame, SelectChatDialog, SelectionInfo, SeleniumRC, SessionHistory, SessionIdSettings, SessionManagementDialog, SidTable, SimpleTextView, SitesTree, StatisticsFrame, StatusBar, TableEditor, TableEditorFrame, TaglessViewer, TestGui, TextView2, TextViewer, TokenScriptSettings, TokenSettings, TranscoderWindow, ViewerHandlerCtrl, WorkspaceDialog, WwwAuthDialog, XmlTree, XmlViewerFrame

Constant Summary collapse

DIFF_TYPE_ORIG =
0
DIFF_TYPE_NEW =
1
SEL_TYPE_GREP =
0
SEL_TYPE_HIGHLIGHT =
1
TABLE_COL_METHOD =
0x0001
TABLE_COL_HOST =
0x0002
TABLE_COL_PATH =
0x0004
TABLE_COL_PARMS =
0x0008
TABLE_COL_STATUS =
0x0010
0x0020
TABLE_COL_COMMENT =
0x0040
TABLE_COL_SSL =
0x0100

Constants included from Diff::LCS

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

Class Method Summary collapse

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!

Class Method Details

.add_plugin(p) ⇒ Object



5
6
7
# File 'lib/watobo/gui/utils/load_plugins.rb', line 5

def self.add_plugin(p)
  @plugin_list << p
end

.applicationObject



84
85
86
# File 'lib/watobo/gui.rb', line 84

def self.application
  @application
end

.browser_preview(opts) ⇒ Object



5
6
7
# File 'lib/watobo/gui/browser_preview.rb', line 5

def self.browser_preview(opts)
  
end

.check_first_runObject



96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/watobo/gui.rb', line 96

def self.check_first_run
  # file = File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "disclaimer.chk")
  file = File.join(Watobo.working_directory, "disclaimer.chk")
  unless File.exists?(file)
     first_start_info = Watobo::Gui::AboutWatobo.new(@main_window)
    if first_start_info.execute != 0 then
       File.new(file, "w")
    else
      exit
    end
  end
end

.clear_pluginsObject



13
14
15
# File 'lib/watobo/gui/utils/load_plugins.rb', line 13

def self.clear_plugins
  @plugin_list = []
end

.create_applicationObject



80
81
82
# File 'lib/watobo/gui.rb', line 80

def self.create_application
  @application = FXApp.new("Watobo", "The Webapplication Toolbox")
end

.historyObject



37
38
39
40
41
42
43
44
45
46
# File 'lib/watobo/gui.rb', line 37

def self.history
  unless defined? @history
    hf = Watobo::Conf::Gui.history_file
    wd = Watobo.working_directory
    
  history_file = File.join(wd , hf)
  @history = SessionHistory.new(history_file)
  end
  @history
end

.infoObject



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/watobo/gui.rb', line 48

def self.info
    i = []
    i << "Ruby Version: " + RUBY_VERSION
    i << "Ruby Platform: " + RUBY_PLATFORM
    i << "FXRuby Version: " + Fox.fxrubyversion
    i << "Fox Version: " + Fox.fxversion
    i << "Watobo Version: " + Watobo.version
    #i << "Working Directory: " + Watobo.working_directory
    #i << "Active Checks Location: " + Watobo.active_module_path
    #i << "Passive Checks Location: " + Watobo.passive_module_path
    i.join("\n")
end

.load_gui_icon(name) ⇒ Object



5
6
7
8
# File 'lib/watobo/gui/utils/load_icons.rb', line 5

def self.load_gui_icon(name)
  return nil if @icon_path.nil?
  icon = load_icon(File.join(@icon_path, name)) 
end

.load_icon(filename) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/watobo/gui/utils/load_icons.rb', line 10

def self.load_icon(filename)
  begin
    icon = nil
    return icon if @application.nil?
    #filename = 
    File.open(filename, "rb") do |f| 
      if filename.strip =~ /\.ico$/ then
        icon = FXICOIcon.new(@application, f.read)
        #icon = FXICOIcon.new(getApp(), f.read)
      elsif filename.strip =~ /\.png$/ then
        icon = FXPNGIcon.new(@application, f.read)
      elsif filename.strip =~ /\.gif$/ then
        icon = FXGIFIcon.new(@application, f.read)
      end
      icon.create
    end
    
    icon
  rescue => bang
    puts "Couldn't load icon: #{filename}"
    puts bang
  end
  
end

.pluginsObject



9
10
11
# File 'lib/watobo/gui/utils/load_plugins.rb', line 9

def self.plugins
  @plugin_list
end

.projectObject



88
89
90
# File 'lib/watobo/gui.rb', line 88

def self.project
  @project
end

.project=(project) ⇒ Object



92
93
94
# File 'lib/watobo/gui.rb', line 92

def self.project=(project)
  @project = project
end

.save_default_settings_UNUSED(project) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/watobo/gui/utils/save_default_settings.rb', line 47

def self.save_default_settings_UNUSED(project)
  mp = ''
  save_pws = false

  #  puts "= Master Password Settings ="
  #  puts Watobo::Gui::MasterPW.settings.to_yaml

  if Watobo::Gui::MasterPW.save_passwords?
    save_pws = true
    unless Watobo::Gui::MasterPW.set?
      save_pws = false unless Watobo::Gui::MasterPW.save_without_master?
    end
  end

  Watobo.save_proxy_settings( :save_passwords => save_pws, :key => mp )

  Watobo::Conf::General.save
  Watobo::Conf::Interceptor.save

  return true
=begin
proxy_has_credentials = false

settings[:forwarding_proxy].each_key do |p|
next if p == :default_proxy
proxy = settings[:forwarding_proxy][p]

if proxy.has_key? :password and proxy[:password] != ''
#       puts " - proxy #{p} has password #{proxy_list[p][:credentials][:password]}"
proxy_has_credentials = true
end
end
end

if proxy_has_credentials == true
if settings[:password_policy][:save_passwords] == true
if settings[:password_policy][:save_without_master] == false
if Watobo::Gui.master_password.empty?
# puts "* need master password for proxy"
dlg = MasterPWDialog.new(self)
if dlg.execute != 0
Watobo::Gui.master_password = dlg.masterPassword
end
end
unless Watobo::Gui.master_password.empty?
settings[:forwarding_proxy].each_key do |p|
#creds = settings[:forwarding_proxy][p][:credentials]
#pass = "$$WPE$$" + creds[:password]
pass = settings[:forwarding_proxy][p][:password]
unless pass.empty?
creds[:password] = Crypto.encryptPassword(pass, Watobo::Gui.master_password)
creds[:encrypted] = true
end
end
else
cleanCredentials(settings)
FXMessageBox.information(self,MBOX_OK,"No MasterPassword", "Could not encrypt proxy passwords. No Passwords have been saved!")
end
else
puts "* saving passwords without protection!!!!"
end
else
cleanCredentials(settings)
end
# puts "=== DEFAULT SETTINGS PASSWORD POLICY"
# puts YAML.dump(settings)
Watobo::Utils.save_settings(@default_settings_file, settings )
=end


end

.save_scanner_settingsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/watobo/gui/utils/save_scanner_settings.rb', line 4

def self.save_scanner_settings()
  #puts "* saving scanner settings ..."
  #puts Watobo::Conf::Scanner.settings.to_yaml
  
  unless Watobo.project.nil?

    Watobo::Conf::Scanner.save_project(){ |s|
   #  puts s.to_yaml
      s.delete(:scan_name)
      s
    }

    session_filter = [ :sid_patterns, :logout_signatures, :custom_error_patterns, :max_parallel_checks, :excluded_parms, :non_unique_parms ]
    Watobo::Conf::Scanner.save_session(session_filter)
  return true
  else
    Watobo::Conf::Scanner.save
  end
end

.save_settingsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/watobo/gui/utils/save_default_settings.rb', line 5

def self.save_settings()
  begin
    puts "SAVE SETTINGS"

    mp = ''
    save_pws = false

    #   puts "= Master Password Settings ="
    #   puts Watobo::Gui::MasterPW.settings.to_yaml

    if Watobo::Gui::MasterPW.save_passwords?
      save_pws = true
      unless Watobo::Gui::MasterPW.set?
        save_pws = false unless Watobo::Gui::MasterPW.save_without_master?
      end
    end

    Watobo.save_proxy_settings( :save_passwords => save_pws, :key => mp )

    Watobo::Gui.save_scanner_settings
    
    unless Watobo.project.nil?
     # puts "- save project settings"
     # puts Watobo::Conf::General.dump.to_yaml
      Watobo::Conf::General.save_project
      Watobo::Conf::Interceptor.save_project
      Watobo::Conf::SidCache.save_project
    end
    # also save global settings here
   # puts "- save global settings"
   #   puts Watobo::Conf::General.dump.to_yaml
    Watobo::Conf::General.save
    Watobo::Conf::Interceptor.save

    return true
  rescue => bang
    puts bang
    puts bang.backtrace if $DEBUG
  end
  return false
end

.startObject



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/watobo/gui.rb', line 62

def self.start
  #  create_application
  @main_window = Watobo::Gui::MainWindow.new(@application)
  FXToolTip.new(@application)
  
  @application.create
  @application.threadsEnabled = true
  
  Thread.abort_on_exception = true
  
  @history = Gui.history

  check_first_run()

  @application.run

end