watobo 0.9.8.677
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/watobo_gui.rb +39 -0
- data/certificates/cert.pem +19 -0
- data/certificates/privkey.pem +15 -0
- data/certificates/watobo_dh.key +5 -0
- data/config/datastore.yml +5 -0
- data/config/forwarding_proxy.yml +12 -0
- data/config/general.yml +4 -0
- data/config/gui.yml +23 -0
- data/config/interceptor.yml +16 -0
- data/config/scan_policy.yml +13 -0
- data/config/scanner.yml +34 -0
- data/icons/Add.ico +0 -0
- data/icons/Add_24x24.ico +0 -0
- data/icons/Bandwidth.ico +0 -0
- data/icons/Bandwidth_24x24.ico +0 -0
- data/icons/Mr. Bomb.ico +0 -0
- data/icons/Mr. Bomb_16x16.ico +0 -0
- data/icons/Mr. Bomb_24x24.ico +0 -0
- data/icons/Orange Ball.ico +0 -0
- data/icons/Orange Ball_16x16.ico +0 -0
- data/icons/Orange Ball_24x24.ico +0 -0
- data/icons/Pause.ico +0 -0
- data/icons/Play.ico +0 -0
- data/icons/Play_24x24.ico +0 -0
- data/icons/Red Ball.ico +0 -0
- data/icons/Red Ball_16x16.ico +0 -0
- data/icons/Red Ball_24x24.ico +0 -0
- data/icons/Run.ico +0 -0
- data/icons/Stop.ico +0 -0
- data/icons/Stop_24x24.ico +0 -0
- data/icons/Terminal.ico +0 -0
- data/icons/Transfer.ico +0 -0
- data/icons/Transfer_16x16.ico +0 -0
- data/icons/User.ico +0 -0
- data/icons/User_16x16.ico +0 -0
- data/icons/User_24x24.ico +0 -0
- data/icons/Web Browser.ico +0 -0
- data/icons/Web Browser_16x16.ico +0 -0
- data/icons/Write Document.ico +0 -0
- data/icons/Yellow Ball.ico +0 -0
- data/icons/Yellow Ball_16x16.ico +0 -0
- data/icons/Yellow Ball_24x24.ico +0 -0
- data/icons/advanced.ico +0 -0
- data/icons/advanced_16x16.ico +0 -0
- data/icons/advanced_24x24.ico +0 -0
- data/icons/applications.ico +0 -0
- data/icons/applications_16x16.ico +0 -0
- data/icons/applications_24x24.ico +0 -0
- data/icons/browser_16x16.ico +0 -0
- data/icons/browser_24x24.ico +0 -0
- data/icons/burn.ico +0 -0
- data/icons/burn_16x16.ico +0 -0
- data/icons/burn_24x24.ico +0 -0
- data/icons/calculator.ico +0 -0
- data/icons/calculator_24x24.ico +0 -0
- data/icons/cb_checked.ico +0 -0
- data/icons/cb_checked_orange.ico +0 -0
- data/icons/cb_unchecked.ico +0 -0
- data/icons/coin_24x24.ico +0 -0
- data/icons/conversation.ico +0 -0
- data/icons/conversation_24x24.ico +0 -0
- data/icons/engine.ico +0 -0
- data/icons/filter.ico +0 -0
- data/icons/folder.ico +0 -0
- data/icons/folder_16x16.ico +0 -0
- data/icons/fuzzer_16x16.ico +0 -0
- data/icons/fuzzer_24x24.ico +0 -0
- data/icons/go-down_16x16.png +0 -0
- data/icons/go-up_16x16.png +0 -0
- data/icons/help.ico +0 -0
- data/icons/help_16x16.ico +0 -0
- data/icons/help_24x24.ico +0 -0
- data/icons/iChat.ico +0 -0
- data/icons/iChat_16x16.ico +0 -0
- data/icons/iChat_24x24.ico +0 -0
- data/icons/icons.txt +3 -0
- data/icons/info.ico +0 -0
- data/icons/info_16x16.ico +0 -0
- data/icons/info_24x24.ico +0 -0
- data/icons/interceptor_24x24.ico +0 -0
- data/icons/lock.ico +0 -0
- data/icons/lock_12x12.ico +0 -0
- data/icons/lock_16x16.ico +0 -0
- data/icons/monitor.ico +0 -0
- data/icons/plugin.ico +0 -0
- data/icons/plugin_24x24.ico +0 -0
- data/icons/scan_16x16.png +0 -0
- data/icons/send.ico +0 -0
- data/icons/server.ico +0 -0
- data/icons/server_16x16.ico +0 -0
- data/icons/siberas_logo_x24.gif +0 -0
- data/icons/tag_blue_32x32.ico +0 -0
- data/icons/watobo-48x48.png +0 -0
- data/icons/watobo-logo.png +0 -0
- data/icons/watobo.ico +0 -0
- data/lib/watobo/adapters/data_store.rb +38 -0
- data/lib/watobo/adapters/file/file_store.rb +211 -0
- data/lib/watobo/adapters/session_store.rb +27 -0
- data/lib/watobo/adapters.rb +26 -0
- data/lib/watobo/config.rb +143 -0
- data/lib/watobo/constants.rb +92 -0
- data/lib/watobo/core/active_check.rb +404 -0
- data/lib/watobo/core/cookie.rb +69 -0
- data/lib/watobo/core/fuzz_gen.rb +160 -0
- data/lib/watobo/core/http_socket.rb +142 -0
- data/lib/watobo/core/interceptor.rb +729 -0
- data/lib/watobo/core/passive_check.rb +141 -0
- data/lib/watobo/core/project.rb +1058 -0
- data/lib/watobo/core/scanner.rb +396 -0
- data/lib/watobo/core/session.rb +1320 -0
- data/lib/watobo/core/simple_ca.rb +393 -0
- data/lib/watobo/core.rb +34 -0
- data/lib/watobo/defaults.rb +40 -0
- data/lib/watobo/external/diff/lcs/array.rb +42 -0
- data/lib/watobo/external/diff/lcs/block.rb +72 -0
- data/lib/watobo/external/diff/lcs/callbacks.rb +343 -0
- data/lib/watobo/external/diff/lcs/change.rb +190 -0
- data/lib/watobo/external/diff/lcs/hunk.rb +279 -0
- data/lib/watobo/external/diff/lcs/ldiff.rb +247 -0
- data/lib/watobo/external/diff/lcs/string.rb +40 -0
- data/lib/watobo/external/diff/lcs.rb +1124 -0
- data/lib/watobo/external/ntlm/ntlm.rb +797 -0
- data/lib/watobo/externals.rb +28 -0
- data/lib/watobo/framework/create_project.rb +55 -0
- data/lib/watobo/framework/init.rb +149 -0
- data/lib/watobo/framework/init_modules.rb +116 -0
- data/lib/watobo/framework/license_text.rb +50 -0
- data/lib/watobo/framework.rb +26 -0
- data/lib/watobo/gui/about_watobo.rb +68 -0
- data/lib/watobo/gui/browser_preview.rb +460 -0
- data/lib/watobo/gui/certificate_dialog.rb +132 -0
- data/lib/watobo/gui/chat_diff.rb +415 -0
- data/lib/watobo/gui/chatviewer_frame.rb +427 -0
- data/lib/watobo/gui/checkboxtree.rb +221 -0
- data/lib/watobo/gui/checks_policy_frame.rb +123 -0
- data/lib/watobo/gui/client_cert_dialog.rb +227 -0
- data/lib/watobo/gui/confirm_scan_dialog.rb +67 -0
- data/lib/watobo/gui/conversation_table.rb +386 -0
- data/lib/watobo/gui/conversation_table_ctrl.rb +175 -0
- data/lib/watobo/gui/csrf_token_dialog.rb +446 -0
- data/lib/watobo/gui/dashboard.rb +341 -0
- data/lib/watobo/gui/define_scope_frame.rb +380 -0
- data/lib/watobo/gui/edit_comment.rb +70 -0
- data/lib/watobo/gui/edit_scope_dialog.rb +69 -0
- data/lib/watobo/gui/finding_info.rb +212 -0
- data/lib/watobo/gui/findings_tree.rb +459 -0
- data/lib/watobo/gui/full_scan_dialog.rb +269 -0
- data/lib/watobo/gui/fuzzer_gui.rb +1522 -0
- data/lib/watobo/gui/hex_viewer.rb +106 -0
- data/lib/watobo/gui/interceptor_gui.rb +994 -0
- data/lib/watobo/gui/interceptor_settings_dialog.rb +201 -0
- data/lib/watobo/gui/log_viewer.rb +97 -0
- data/lib/watobo/gui/login_wizzard.rb +301 -0
- data/lib/watobo/gui/main_window.rb +1815 -0
- data/lib/watobo/gui/manual_request_editor.rb +1105 -0
- data/lib/watobo/gui/master_pw_dialog.rb +142 -0
- data/lib/watobo/gui/password_policy_dialog.rb +98 -0
- data/lib/watobo/gui/plugin/base.rb +82 -0
- data/lib/watobo/gui/plugin_board.rb +95 -0
- data/lib/watobo/gui/preferences_dialog.rb +116 -0
- data/lib/watobo/gui/progress_window.rb +102 -0
- data/lib/watobo/gui/project_wizzard.rb +369 -0
- data/lib/watobo/gui/proxy_dialog.rb +550 -0
- data/lib/watobo/gui/quick_scan_dialog.rb +242 -0
- data/lib/watobo/gui/request_editor.rb +480 -0
- data/lib/watobo/gui/save_chat_dialog.rb +158 -0
- data/lib/watobo/gui/scanner_settings_dialog.rb +360 -0
- data/lib/watobo/gui/select_chat_dialog.rb +169 -0
- data/lib/watobo/gui/session_management_dialog.rb +688 -0
- data/lib/watobo/gui/sites_tree.rb +347 -0
- data/lib/watobo/gui/status_bar.rb +88 -0
- data/lib/watobo/gui/table_editor.rb +445 -0
- data/lib/watobo/gui/tagless_viewer.rb +62 -0
- data/lib/watobo/gui/templates/plugin.rb +80 -0
- data/lib/watobo/gui/templates/plugin2.rb +103 -0
- data/lib/watobo/gui/text_viewer.rb +247 -0
- data/lib/watobo/gui/transcoder_window.rb +215 -0
- data/lib/watobo/gui/utils/gui_utils.rb +129 -0
- data/lib/watobo/gui/utils/init_icons.rb +106 -0
- data/lib/watobo/gui/utils/load_icons.rb +54 -0
- data/lib/watobo/gui/utils/load_plugins.rb +94 -0
- data/lib/watobo/gui/utils/master_password.rb +90 -0
- data/lib/watobo/gui/utils/save_default_settings.rb +99 -0
- data/lib/watobo/gui/utils/save_project_settings.rb +21 -0
- data/lib/watobo/gui/utils/save_proxy_settings.rb +45 -0
- data/lib/watobo/gui/utils/save_session_settings.rb +21 -0
- data/lib/watobo/gui/utils/session_history.rb +134 -0
- data/lib/watobo/gui/workspace_dialog.rb +89 -0
- data/lib/watobo/gui/www_auth_dialog.rb +348 -0
- data/lib/watobo/gui/xml_viewer_frame.rb +114 -0
- data/lib/watobo/gui.rb +139 -0
- data/lib/watobo/mixins/httpparser.rb +664 -0
- data/lib/watobo/mixins/request_parser.rb +210 -0
- data/lib/watobo/mixins/shapers.rb +345 -0
- data/lib/watobo/mixins/transcoders.rb +88 -0
- data/lib/watobo/mixins.rb +32 -0
- data/lib/watobo/utils/check_regex.rb +36 -0
- data/lib/watobo/utils/copy_object.rb +29 -0
- data/lib/watobo/utils/crypto.rb +74 -0
- data/lib/watobo/utils/expand_range.rb +45 -0
- data/lib/watobo/utils/file_management.rb +73 -0
- data/lib/watobo/utils/load_chat.rb +219 -0
- data/lib/watobo/utils/load_icon.rb +47 -0
- data/lib/watobo/utils/print_debug.rb +34 -0
- data/lib/watobo/utils/response_hash.rb +143 -0
- data/lib/watobo/utils/secure_eval.rb +57 -0
- data/lib/watobo/utils/text2request.rb +96 -0
- data/lib/watobo/utils.rb +32 -0
- data/lib/watobo.rb +76 -0
- data/modules/active/Apache/mod_status.rb +123 -0
- data/modules/active/Flash/crossdomain.rb +102 -0
- data/modules/active/directories/dirwalker.rb +89 -0
- data/modules/active/discovery/fileextensions.rb +151 -0
- data/modules/active/discovery/http_methods.rb +135 -0
- data/modules/active/domino/domino_db.lst +164 -0
- data/modules/active/domino/domino_db.rb +128 -0
- data/modules/active/fileinclusion/lfi_simple.rb +134 -0
- data/modules/active/jboss/jboss_basic.rb +119 -0
- data/modules/active/sap/business_objects.rb +73 -0
- data/modules/active/sap/its_commands.rb +101 -0
- data/modules/active/sap/its_service_parameter.rb +105 -0
- data/modules/active/sap/its_services.rb +103 -0
- data/modules/active/sap/its_xss.rb +98 -0
- data/modules/active/sqlinjection/sql_boolean.rb +262 -0
- data/modules/active/sqlinjection/sqli_simple.rb +205 -0
- data/modules/active/xss/xss_simple.rb +179 -0
- data/modules/passive/cookie_options.rb +97 -0
- data/modules/passive/cookie_xss.rb +85 -0
- data/modules/passive/detect_code.rb +89 -0
- data/modules/passive/detect_fileupload.rb +80 -0
- data/modules/passive/detect_infrastructure.rb +98 -0
- data/modules/passive/detect_one_time_tokens.rb +86 -0
- data/modules/passive/dirindexing.rb +81 -0
- data/modules/passive/disclosure_emails.rb +82 -0
- data/modules/passive/disclosure_ipaddr.rb +87 -0
- data/modules/passive/filename_as_parameter.rb +85 -0
- data/modules/passive/form_spotter.rb +75 -0
- data/modules/passive/hotspots.rb +86 -0
- data/modules/passive/in_script_parameter.rb +92 -0
- data/modules/passive/multiple_server_headers.rb +98 -0
- data/modules/passive/possible_login.rb +134 -0
- data/modules/passive/redirect_url.rb +88 -0
- data/modules/passive/redirectionz.rb +96 -0
- data/modules/passive/xss_dom.rb +91 -0
- data/plugins/catalog/catalog.ico +0 -0
- data/plugins/catalog/catalog.rb +726 -0
- data/plugins/catalog/db_tests +6483 -0
- data/plugins/catalog/db_variables +29 -0
- data/plugins/filefinder/dbs/hbci.db +12 -0
- data/plugins/filefinder/filefinder.rb +602 -0
- data/plugins/sslchecker/cli/sslchecker_cli.rb +21 -0
- data/plugins/sslchecker/gui/cipher_table.rb +260 -0
- data/plugins/sslchecker/gui/gui.rb +245 -0
- data/plugins/sslchecker/gui/sslchecker.rb +26 -0
- data/plugins/sslchecker/icons/green_16x16.ico +0 -0
- data/plugins/sslchecker/icons/grey_16x16.ico +0 -0
- data/plugins/sslchecker/icons/red_16x16.ico +0 -0
- data/plugins/sslchecker/icons/sslchecker.ico +0 -0
- data/plugins/sslchecker/lib/check.rb +117 -0
- metadata +317 -0
@@ -0,0 +1,386 @@
|
|
1
|
+
# .
|
2
|
+
# conversation_table.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
|
+
TABLE_COL_METHOD = 0x0001
|
25
|
+
TABLE_COL_HOST = 0x0002
|
26
|
+
TABLE_COL_PATH = 0x0004
|
27
|
+
TABLE_COL_PARMS = 0x0008
|
28
|
+
TABLE_COL_STATUS = 0x0010
|
29
|
+
TABLE_COL_COOKIE = 0x0020
|
30
|
+
TABLE_COL_COMMENT = 0x0040
|
31
|
+
TABLE_COL_SSL = 0x0100
|
32
|
+
class ConversationTable < FXTable
|
33
|
+
|
34
|
+
attr_accessor :autoscroll
|
35
|
+
|
36
|
+
include Watobo::Gui::Icons
|
37
|
+
|
38
|
+
def subscribe(event, &callback)
|
39
|
+
(@event_dispatcher_listeners[event] ||= []) << callback
|
40
|
+
#puts callback.class_
|
41
|
+
puts callback.object_id
|
42
|
+
end
|
43
|
+
|
44
|
+
def clearEvents(event)
|
45
|
+
@event_dispatcher_listeners[event] ||= []
|
46
|
+
@event_dispatcher_listeners[event].clear
|
47
|
+
end
|
48
|
+
|
49
|
+
def notify(event, *args)
|
50
|
+
if @event_dispatcher_listeners[event]
|
51
|
+
puts "NOTIFY: #{self}(:#{event}) [#{@event_dispatcher_listeners[event].length}]" if $DEBUG
|
52
|
+
@event_dispatcher_listeners[event].each do |m|
|
53
|
+
m.call(*args) if m.respond_to? :call
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def num_total
|
59
|
+
@current_chat_list.length
|
60
|
+
end
|
61
|
+
|
62
|
+
def num_visible
|
63
|
+
self.numRows
|
64
|
+
end
|
65
|
+
|
66
|
+
def reset_filter
|
67
|
+
@filter = {
|
68
|
+
:show_scope_only => false,
|
69
|
+
:text => '',
|
70
|
+
:url => false,
|
71
|
+
:request => false,
|
72
|
+
:response => false,
|
73
|
+
:hide_tested => false,
|
74
|
+
:doc_filter => []
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
# :show_scope_only => false,
|
79
|
+
# :text => '',
|
80
|
+
# :url => false,
|
81
|
+
# :request => false,
|
82
|
+
# :response => false,
|
83
|
+
# :hide_tested => false
|
84
|
+
def apply_filter(filter={})
|
85
|
+
|
86
|
+
@filter.update filter
|
87
|
+
@uniq_chats.clear
|
88
|
+
puts @filter.to_yaml if $DEBUG
|
89
|
+
update_table
|
90
|
+
end
|
91
|
+
|
92
|
+
def chat_visible?(chat)
|
93
|
+
begin
|
94
|
+
#if @active_project and @active_project.settings[:site_filter]
|
95
|
+
# #puts chat.request.url
|
96
|
+
#puts @active_project.settings[:site_filter]
|
97
|
+
# return false if @active_project.settings[:site_filter] != '' and chat.request.url =~ /^http(s)?:\/\/#{Regexp.quote(@active_project.settings[:site_filter])}/
|
98
|
+
# return true
|
99
|
+
# end
|
100
|
+
|
101
|
+
if @filter[:unique]
|
102
|
+
unless Watobo::Gui.active_project.nil?
|
103
|
+
uniq_hash = Watobo::Gui.active_project.uniqueRequestHash chat.request
|
104
|
+
return false if @uniq_chats.has_key? uniq_hash
|
105
|
+
@uniq_chats[uniq_hash] = nil
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
if @filter[:show_scope_only]
|
110
|
+
unless Watobo::Gui.active_project.nil?
|
111
|
+
return false unless Watobo::Gui.active_project.siteInScope?(chat.request.site)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
# puts "* passed scope"
|
115
|
+
if @filter[:hide_tested]
|
116
|
+
return false if chat.tested?
|
117
|
+
end
|
118
|
+
# puts "* passed hide tested"
|
119
|
+
unless @filter[:doc_filter].include?(chat.request.doctype)
|
120
|
+
return true if @filter[:text].empty?
|
121
|
+
|
122
|
+
return true if @filter[:url] and chat.request.first =~ /#{@filter[:text]}/i
|
123
|
+
|
124
|
+
return true if @filter[:request] and chat.request.join =~ /#{@filter[:text]}/i
|
125
|
+
|
126
|
+
if chat.response.content_type =~ /(text|javascript)/
|
127
|
+
return true if @filter[:response] and chat.response.join.unpack("C*").pack("C*") =~ /#{@filter[:text]}/i
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
rescue => bang
|
132
|
+
puts "! could not add chat to table !".upcase
|
133
|
+
# puts chat.id
|
134
|
+
puts bang
|
135
|
+
puts bang.backtrace if $DEBUG
|
136
|
+
end
|
137
|
+
false
|
138
|
+
end
|
139
|
+
|
140
|
+
def showConversation( chat_list = [] )
|
141
|
+
clearConversation()
|
142
|
+
chat_list.each do |chat|
|
143
|
+
addChat(chat)
|
144
|
+
end
|
145
|
+
adjustCellWidth()
|
146
|
+
end
|
147
|
+
|
148
|
+
def setNewFont(font_type=nil, size=nil)
|
149
|
+
begin
|
150
|
+
new_size = size.nil? ? GUI_REGULAR_FONT_SIZE : size
|
151
|
+
new_font_type = font_type.nil? ? "helvetica" : font_type
|
152
|
+
new_font = FXFont.new(getApp(), new_font_type, new_size)
|
153
|
+
new_font.create
|
154
|
+
|
155
|
+
self.font = new_font
|
156
|
+
self.rowHeader.font = new_font
|
157
|
+
self.defRowHeight = new_size+10
|
158
|
+
|
159
|
+
update_table()
|
160
|
+
|
161
|
+
rescue => bang
|
162
|
+
puts bang
|
163
|
+
puts bang.backtrace if $DEBUG
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def updateComment(row, comment)
|
168
|
+
col = @col_order.index(TABLE_COL_COMMENT)
|
169
|
+
self.setItemText(row, col, comment.gsub(/[^[:print:]]/,' '))
|
170
|
+
end
|
171
|
+
|
172
|
+
def addChat(chat, *prefs)
|
173
|
+
if self.getNumRows <= 0 then
|
174
|
+
clearConversation()
|
175
|
+
# initColumns()
|
176
|
+
end
|
177
|
+
|
178
|
+
@current_chat_list.push chat unless chat.nil?
|
179
|
+
add_chat_row(chat) if chat_visible?(chat)
|
180
|
+
|
181
|
+
end
|
182
|
+
|
183
|
+
def initColumns()
|
184
|
+
self.setTableSize(0, @columns.length)
|
185
|
+
self.visibleRows = 20
|
186
|
+
self.visibleColumns = @columns.length
|
187
|
+
|
188
|
+
@columns.each do |type, name|
|
189
|
+
index = @col_order.index(type)
|
190
|
+
self.setColumnText( index, name )
|
191
|
+
self.setColumnIcon(@col_order.index(TABLE_COL_SSL), TBL_ICON_LOCK)# puts self.getItem(@col_order.index(col), 0 ).class.to_s
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
def initialize( owner, unused = nil )
|
197
|
+
@event_dispatcher_listeners = Hash.new
|
198
|
+
|
199
|
+
super(owner, :opts => TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2)
|
200
|
+
|
201
|
+
self.setBackColor(FXRGB(255, 255, 255))
|
202
|
+
self.setCellColor(0, 0, FXRGB(255, 255, 255))
|
203
|
+
self.setCellColor(0, 1, FXRGB(255, 240, 240))
|
204
|
+
self.setCellColor(1, 0, FXRGB(240, 255, 240))
|
205
|
+
self.setCellColor(1, 1, FXRGB(240, 240, 255))
|
206
|
+
|
207
|
+
reset_filter
|
208
|
+
# FXMAPFUNC(SEL_CLICKED, FXTable::ID_SELECT_CELL, :onSelectCell)
|
209
|
+
@current_chat_list = []
|
210
|
+
@uniq_chats = Hash.new
|
211
|
+
|
212
|
+
@columns = Hash.new
|
213
|
+
@cell_width = Hash.new
|
214
|
+
@col_order = []
|
215
|
+
@autoscroll = false
|
216
|
+
|
217
|
+
@columns = Hash.new
|
218
|
+
|
219
|
+
@columns[TABLE_COL_METHOD] = "Method"
|
220
|
+
@columns[TABLE_COL_HOST] = "Host"
|
221
|
+
@columns[TABLE_COL_PATH] = "Path"
|
222
|
+
@columns[TABLE_COL_PARMS] = "Parameters"
|
223
|
+
@columns[TABLE_COL_STATUS] = "Status"
|
224
|
+
@columns[TABLE_COL_COOKIE] = "Set-Cookie"
|
225
|
+
@columns[TABLE_COL_COMMENT] = "Comment"
|
226
|
+
@columns[TABLE_COL_SSL] = ""
|
227
|
+
|
228
|
+
# initialize columns order
|
229
|
+
@col_order = [ TABLE_COL_SSL, TABLE_COL_METHOD, TABLE_COL_HOST, TABLE_COL_PATH, TABLE_COL_PARMS, TABLE_COL_STATUS, TABLE_COL_COOKIE, TABLE_COL_COMMENT ]
|
230
|
+
|
231
|
+
# init cell width
|
232
|
+
@cell_width = Hash.new
|
233
|
+
@cell_width[TABLE_COL_METHOD] = 50
|
234
|
+
@cell_width[TABLE_COL_HOST] = 120
|
235
|
+
@cell_width[TABLE_COL_PATH] = 200
|
236
|
+
@cell_width[TABLE_COL_PARMS] = 150
|
237
|
+
@cell_width[TABLE_COL_STATUS] = 50
|
238
|
+
@cell_width[TABLE_COL_COOKIE] = 70
|
239
|
+
@cell_width[TABLE_COL_COMMENT] = 100
|
240
|
+
@cell_width[TABLE_COL_SSL] = 20
|
241
|
+
|
242
|
+
@cell_width_defaults = Hash.new
|
243
|
+
@cell_width_defaults.update YAML.load(YAML.dump(@cell_width))
|
244
|
+
|
245
|
+
@cell_auto_max = 400
|
246
|
+
@cell_min_width = 30
|
247
|
+
|
248
|
+
initColumns()
|
249
|
+
|
250
|
+
self.columnHeader.connect(SEL_CHANGED) do |sender, sel, index|
|
251
|
+
type = @col_order[index]
|
252
|
+
@cell_width[type] = self.getColumnWidth(index)
|
253
|
+
end
|
254
|
+
|
255
|
+
self.columnHeader.connect(SEL_COMMAND) do |sender, sel, index|
|
256
|
+
type = @col_order[index]
|
257
|
+
column_width = self.getColumnWidth(index)
|
258
|
+
|
259
|
+
new_width = case column_width
|
260
|
+
when column_width > @cell_auto_max
|
261
|
+
@cell_auto_max
|
262
|
+
when ( column_width > @cell_width_defaults[type] )
|
263
|
+
@cell_width_defaults[type]
|
264
|
+
when @cell_width_defaults[type]
|
265
|
+
self.fitColumnsToContents(index)
|
266
|
+
w = self.getColumnWidth(index)
|
267
|
+
w = @cell_auto_max if self.getColumnWidth(index) > @cell_auto_max
|
268
|
+
w = @cell_width_defaults[type] if self.getColumnWidth(index) < @cell_width_defaults[type]
|
269
|
+
w
|
270
|
+
else
|
271
|
+
@cell_width_defaults[type]
|
272
|
+
end
|
273
|
+
self.setColumnWidth(index, new_width)
|
274
|
+
@cell_width[type] = new_width
|
275
|
+
|
276
|
+
adjustCellWidth()
|
277
|
+
end
|
278
|
+
|
279
|
+
adjustCellWidth()
|
280
|
+
end
|
281
|
+
|
282
|
+
def scrollUp()
|
283
|
+
self.makePositionVisible(0, 0)
|
284
|
+
end
|
285
|
+
|
286
|
+
def scrollDown()
|
287
|
+
self.makePositionVisible(self.numRows-1, 0)
|
288
|
+
end
|
289
|
+
|
290
|
+
def clearConversation()
|
291
|
+
self.clearItems
|
292
|
+
@current_chat_list = []
|
293
|
+
initColumns()
|
294
|
+
adjustCellWidth()
|
295
|
+
end
|
296
|
+
|
297
|
+
private
|
298
|
+
|
299
|
+
def add_chat_row(chat)
|
300
|
+
lastRowIndex = self.getNumRows
|
301
|
+
self.appendRows(1)
|
302
|
+
|
303
|
+
self.rowHeader.setItemJustify(lastRowIndex, FXHeaderItem::RIGHT)
|
304
|
+
self.setRowText(lastRowIndex, chat.id.to_s)
|
305
|
+
|
306
|
+
index = @col_order.index(TABLE_COL_SSL)
|
307
|
+
self.setItemIcon(lastRowIndex, index, TBL_ICON_LOCK) if chat.request.is_ssl?
|
308
|
+
|
309
|
+
index = @col_order.index(TABLE_COL_METHOD)
|
310
|
+
|
311
|
+
self.setItemText(lastRowIndex, index, chat.request.method)
|
312
|
+
self.getItem(lastRowIndex, index).justify = FXTableItem::LEFT
|
313
|
+
|
314
|
+
index = @col_order.index(TABLE_COL_HOST)
|
315
|
+
self.setItemText(lastRowIndex, index, chat.request.host)
|
316
|
+
self.getItem(lastRowIndex,index).justify = FXTableItem::LEFT
|
317
|
+
|
318
|
+
index = @col_order.index(TABLE_COL_PATH)
|
319
|
+
self.setItemText(lastRowIndex, index, chat.request.path)
|
320
|
+
self.getItem(lastRowIndex, index).justify = FXTableItem::LEFT
|
321
|
+
|
322
|
+
index = @col_order.index(TABLE_COL_PARMS)
|
323
|
+
ps = ""
|
324
|
+
if chat.request.method =~ /POST/ then
|
325
|
+
ps = chat.request.post_parms.join("&")
|
326
|
+
else
|
327
|
+
ps = chat.request.urlparms
|
328
|
+
end
|
329
|
+
parms = ""
|
330
|
+
unless ps.nil?
|
331
|
+
# parms = ps[0..50]
|
332
|
+
# parms += "..." if ps.length > 50
|
333
|
+
parms = ps
|
334
|
+
parms.gsub!(/[^[:print:]]/,'.')
|
335
|
+
end
|
336
|
+
|
337
|
+
self.setItemText(lastRowIndex, index, parms)
|
338
|
+
self.getItem(lastRowIndex, index).justify = FXTableItem::LEFT
|
339
|
+
|
340
|
+
index = @col_order.index(TABLE_COL_STATUS)
|
341
|
+
self.setItemText(lastRowIndex, index, chat.response.status)
|
342
|
+
self.getItem(lastRowIndex,index).justify = FXTableItem::LEFT
|
343
|
+
|
344
|
+
if chat.response.header_value("set-cookie").first then
|
345
|
+
index = @col_order.index(TABLE_COL_COOKIE)
|
346
|
+
self.setItemText(lastRowIndex, index, chat.response.header_value("set-cookie").first.chomp)
|
347
|
+
self.getItem(lastRowIndex, index).justify = FXTableItem::LEFT
|
348
|
+
end
|
349
|
+
|
350
|
+
if chat.comment then
|
351
|
+
index = @col_order.index(TABLE_COL_COMMENT)
|
352
|
+
comment = chat.comment.split(/\n/).join(" ")
|
353
|
+
cc = comment[0..50]
|
354
|
+
cc += "..." if comment.length > 50
|
355
|
+
self.setItemText(lastRowIndex, index, cc)
|
356
|
+
self.getItem(lastRowIndex, index).justify = FXTableItem::LEFT
|
357
|
+
end
|
358
|
+
|
359
|
+
self.makePositionVisible(self.numRows-1, 0) if @autoscroll == true
|
360
|
+
end
|
361
|
+
|
362
|
+
def update_table()
|
363
|
+
self.clearItems
|
364
|
+
initColumns()
|
365
|
+
adjustCellWidth()
|
366
|
+
@current_chat_list.each do |chat|
|
367
|
+
add_chat_row(chat) if chat_visible? chat
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
def adjustCellWidth()
|
372
|
+
begin
|
373
|
+
self.rowHeader.width = 35
|
374
|
+
@cell_width.each do |col, width|
|
375
|
+
pos = @col_order.index(col)
|
376
|
+
self.setColumnWidth(pos, width)
|
377
|
+
end
|
378
|
+
rescue => bang
|
379
|
+
puts "!!!ERROR: adjustCellWidth"
|
380
|
+
end
|
381
|
+
|
382
|
+
end
|
383
|
+
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|
@@ -0,0 +1,175 @@
|
|
1
|
+
# .
|
2
|
+
# conversation_table_ctrl.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
|
+
|
25
|
+
class ConversationTableCtrl < FXVerticalFrame
|
26
|
+
|
27
|
+
include Watobo::Constants
|
28
|
+
include Watobo::Gui::Icons
|
29
|
+
|
30
|
+
def table=(table)
|
31
|
+
@table = table
|
32
|
+
@table.subscribe(:table_changed) { update_info }
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize(owner, opts)
|
36
|
+
super(owner, opts )
|
37
|
+
@table = nil
|
38
|
+
@tabBook = FXTabBook.new(self, nil, 0, :opts => LAYOUT_FILL_X|LAYOUT_RIGHT, :padding => 0)
|
39
|
+
|
40
|
+
docfilter_tab = FXTabItem.new(@tabBook, "Doc Filter", nil)
|
41
|
+
|
42
|
+
docfilter_frame = FXHorizontalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
|
43
|
+
|
44
|
+
@foption_nopix = FXCheckButton.new(docfilter_frame, "excl. pics", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
|
45
|
+
@foption_nopix.setCheck(true)
|
46
|
+
@foption_nodocs = FXCheckButton.new(docfilter_frame, "excl. docs", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
|
47
|
+
@foption_nodocs.setCheck(true)
|
48
|
+
@foption_nojs = FXCheckButton.new(docfilter_frame, "excl. javascript", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
|
49
|
+
@foption_nojs.setCheck(true)
|
50
|
+
@foption_nocss = FXCheckButton.new(docfilter_frame, "excl. style sheets", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
|
51
|
+
@foption_nocss.setCheck(true)
|
52
|
+
|
53
|
+
search_tab = FXTabItem.new(@tabBook, "Text Filter", nil)
|
54
|
+
|
55
|
+
search_frame = FXHorizontalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
|
56
|
+
|
57
|
+
FXButton.new(search_frame, "Clear", nil, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND) { clear_text_filter }
|
58
|
+
|
59
|
+
@text_filter = FXTextField.new(search_frame, 20, nil, 0, FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X)
|
60
|
+
# filterOptionsFrame =FXHorizontalFrame.new(fbox, LAYOUT_FILL_X)
|
61
|
+
@foption_url = FXCheckButton.new(search_frame, "URL", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
|
62
|
+
@foption_url.setCheck(true)
|
63
|
+
@foption_url.connect(SEL_COMMAND){ update_text_filter }
|
64
|
+
@foption_req = FXCheckButton.new(search_frame, "Full Request", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
|
65
|
+
@foption_req .connect(SEL_COMMAND){ update_text_filter }
|
66
|
+
@foption_res = FXCheckButton.new(search_frame, "Full Response", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
|
67
|
+
@foption_res.connect(SEL_COMMAND){ update_text_filter }
|
68
|
+
|
69
|
+
options_tab = FXTabItem.new(@tabBook, "Options", nil)
|
70
|
+
options_frame = FXHorizontalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
|
71
|
+
@table_option_autoscroll = FXCheckButton.new(options_frame, "autoscroll", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
|
72
|
+
@table_option_autoscroll.setCheck(true)
|
73
|
+
|
74
|
+
@table_option_unique = FXCheckButton.new(options_frame, "unique chats", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
|
75
|
+
@table_option_unique.setCheck(false)
|
76
|
+
|
77
|
+
@table_option_scope = FXCheckButton.new(options_frame, "scope only", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
|
78
|
+
@table_option_scope.setCheck(false)
|
79
|
+
|
80
|
+
@table_option_hidetested_cb = FXCheckButton.new(options_frame, "hide tested", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
|
81
|
+
@table_option_hidetested_cb.setCheck(false)
|
82
|
+
|
83
|
+
@table_option_autoscroll.connect(SEL_COMMAND) {
|
84
|
+
@table.autoscroll = @table_option_autoscroll.checked? unless @table.nil?
|
85
|
+
}
|
86
|
+
|
87
|
+
#applyFilterButton = FXButton.new(conversation_frame, "Apply", nil, nil, 0, FRAME_RAISED|FRAME_THICK)
|
88
|
+
button_frame = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X, :padding => 0)
|
89
|
+
FXButton.new(button_frame, "Apply", nil, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND) { apply_filter }
|
90
|
+
#FXButton.new(docfilter_button_frame, "Clear", nil, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND, method(:onClear))
|
91
|
+
|
92
|
+
@text_filter.connect(SEL_COMMAND){
|
93
|
+
apply_filter
|
94
|
+
}
|
95
|
+
|
96
|
+
FXButton.new(button_frame, "", ICON_BTN_UP, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND) {
|
97
|
+
@table.scrollUp() unless @table.nil?
|
98
|
+
}
|
99
|
+
|
100
|
+
FXButton.new(button_frame, "", ICON_BTN_DOWN, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND) {
|
101
|
+
@table.scrollDown() unless @table.nil?
|
102
|
+
}
|
103
|
+
|
104
|
+
@info_txt = FXLabel.new( button_frame, "0/0", :opts => LAYOUT_RIGHT)
|
105
|
+
end
|
106
|
+
|
107
|
+
def subscribe(event, &callback)
|
108
|
+
(@event_dispatcher_listeners[event] ||= []) << callback
|
109
|
+
end
|
110
|
+
|
111
|
+
private
|
112
|
+
|
113
|
+
def update_info
|
114
|
+
if @table.respond_to? :num_total
|
115
|
+
@info_txt.text = "#{@table.num_visible}/#{@table.num_total}"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def clearEvents(event)
|
120
|
+
@event_dispatcher_listener[event].clear
|
121
|
+
end
|
122
|
+
|
123
|
+
def notify(event, *args)
|
124
|
+
if @event_dispatcher_listeners[event]
|
125
|
+
@event_dispatcher_listeners[event].each do |m|
|
126
|
+
m.call(*args) if m.respond_to? :call
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def clear_text_filter
|
132
|
+
@text_filter.text = ''
|
133
|
+
apply_filter
|
134
|
+
end
|
135
|
+
|
136
|
+
def apply_filter
|
137
|
+
unless @table.nil?
|
138
|
+
@table.apply_filter(filter_settings)
|
139
|
+
update_info
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def update_text_filter
|
144
|
+
if @foption_url.checked? or @foption_req.checked? or @foption_res.checked?
|
145
|
+
@text_filter.enable
|
146
|
+
else
|
147
|
+
@text_filter.disable
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def filter_settings
|
152
|
+
doctype_filter = []
|
153
|
+
doctype_filter.concat(Watobo::Conf::Gui.fext_img) if @foption_nopix.checked?
|
154
|
+
doctype_filter.concat(Watobo::Conf::Gui.fext_docs) if @foption_nodocs.checked?
|
155
|
+
doctype_filter.concat(Watobo::Conf::Gui.fext_javascript) if @foption_nojs.checked?
|
156
|
+
doctype_filter.concat(Watobo::Conf::Gui.fext_style) if @foption_nocss.checked?
|
157
|
+
|
158
|
+
text = @text_filter.enabled? ? @text_filter.text : ""
|
159
|
+
|
160
|
+
fs = {
|
161
|
+
:show_scope_only => @table_option_scope.checked?,
|
162
|
+
:text => text,
|
163
|
+
:url => @foption_url.checked?,
|
164
|
+
:request => @foption_req.checked?,
|
165
|
+
:response => @foption_res.checked?,
|
166
|
+
:hide_tested => @table_option_hidetested_cb.checked?,
|
167
|
+
:doc_filter => doctype_filter,
|
168
|
+
:unique => @table_option_unique.checked?
|
169
|
+
}
|
170
|
+
fs
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|