watobo 0.9.21 → 0.9.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +46 -1
- data/bin/nfq_server.rb +0 -9
- data/bin/watobo_gui.rb +3 -13
- data/custom-views/prettify-json.rb +9 -18
- data/icons/watobo.ico +0 -0
- data/icons/watobo.ico.old +0 -0
- data/lib/watobo.rb +10 -19
- data/lib/watobo/adapters.rb +5 -14
- data/lib/watobo/adapters/data_store.rb +50 -59
- data/lib/watobo/adapters/file/file_store.rb +287 -296
- data/lib/watobo/adapters/file/marshal_store.rb +293 -296
- data/lib/watobo/adapters/session_store.rb +5 -14
- data/lib/watobo/ca.rb +1 -10
- data/lib/watobo/config.rb +197 -206
- data/lib/watobo/constants.rb +0 -9
- data/lib/watobo/core.rb +3 -12
- data/lib/watobo/core/active_check.rb +72 -135
- data/lib/watobo/core/active_checks.rb +49 -58
- data/lib/watobo/core/ca.rb +369 -389
- data/lib/watobo/core/cert_store.rb +34 -43
- data/lib/watobo/core/chat.rb +92 -101
- data/lib/watobo/core/chats.rb +271 -280
- data/lib/watobo/core/client_cert_store.rb +106 -35
- data/lib/watobo/core/conversation.rb +48 -57
- data/lib/watobo/core/cookie.rb +23 -32
- data/lib/watobo/core/egress_handlers.rb +98 -0
- data/lib/watobo/core/finding.rb +66 -75
- data/lib/watobo/core/findings.rb +107 -114
- data/lib/watobo/core/forwarding_proxy.rb +13 -22
- data/lib/watobo/core/fuzz_gen.rb +0 -9
- data/lib/watobo/core/intercept_carver.rb +166 -177
- data/lib/watobo/core/intercept_filter.rb +235 -244
- data/lib/watobo/core/interceptor.rb +98 -107
- data/lib/watobo/core/min_class.rb +4 -13
- data/lib/watobo/core/netfilter_queue.rb +170 -179
- data/lib/watobo/core/ott_cache.rb +132 -141
- data/lib/watobo/core/parameter.rb +43 -52
- data/lib/watobo/core/passive_check.rb +103 -102
- data/lib/watobo/core/passive_checks.rb +48 -57
- data/lib/watobo/core/passive_scanner.rb +54 -55
- data/lib/watobo/core/plugin.rb +11 -20
- data/lib/watobo/core/project.rb +3 -9
- data/lib/watobo/core/proxy.rb +43 -52
- data/lib/watobo/core/request.rb +125 -123
- data/lib/watobo/core/response.rb +44 -53
- data/lib/watobo/core/scanner.rb +0 -9
- data/lib/watobo/core/scanner3.rb +405 -414
- data/lib/watobo/core/scope.rb +83 -92
- data/lib/watobo/core/session.rb +1043 -1026
- data/lib/watobo/core/sid_cache.rb +98 -107
- data/lib/watobo/core/subscriber.rb +25 -34
- data/lib/watobo/defaults.rb +21 -30
- data/lib/watobo/external/diff/lcs.rb +0 -9
- data/lib/watobo/external/diff/lcs/array.rb +0 -9
- data/lib/watobo/external/diff/lcs/block.rb +0 -9
- data/lib/watobo/external/diff/lcs/callbacks.rb +0 -9
- data/lib/watobo/external/diff/lcs/change.rb +0 -9
- data/lib/watobo/external/diff/lcs/hunk.rb +0 -9
- data/lib/watobo/external/diff/lcs/ldiff.rb +0 -9
- data/lib/watobo/external/diff/lcs/string.rb +0 -9
- data/lib/watobo/externals.rb +6 -15
- data/lib/watobo/framework.rb +4 -13
- data/lib/watobo/framework/create_project.rb +60 -69
- data/lib/watobo/framework/init.rb +0 -9
- data/lib/watobo/framework/init_modules.rb +0 -9
- data/lib/watobo/framework/license_text.rb +28 -37
- data/lib/watobo/framework/load_chat.rb +13 -22
- data/lib/watobo/gui.rb +132 -123
- data/lib/watobo/gui/about_watobo.rb +0 -9
- data/lib/watobo/gui/browser_preview.rb +0 -9
- data/lib/watobo/gui/certificate_dialog.rb +0 -9
- data/lib/watobo/gui/chat_diff.rb +0 -9
- data/lib/watobo/gui/chatviewer_frame.rb +73 -72
- data/lib/watobo/gui/checkboxtree.rb +0 -9
- data/lib/watobo/gui/checks_policy_frame.rb +0 -9
- data/lib/watobo/gui/client_cert_dialog.rb +96 -87
- data/lib/watobo/gui/confirm_scan_dialog.rb +0 -9
- data/lib/watobo/gui/conversation_table.rb +158 -164
- data/lib/watobo/gui/conversation_table_ctrl.rb +207 -216
- data/lib/watobo/gui/conversation_table_ctrl2.rb +373 -382
- data/lib/watobo/gui/csrf_token_dialog.rb +0 -9
- data/lib/watobo/gui/custom_viewer.rb +374 -383
- data/lib/watobo/gui/dashboard.rb +296 -303
- data/lib/watobo/gui/define_scope_frame.rb +0 -9
- data/lib/watobo/gui/differ_frame.rb +215 -224
- data/lib/watobo/gui/edit_comment.rb +0 -9
- data/lib/watobo/gui/edit_scope_dialog.rb +0 -9
- data/lib/watobo/gui/export_dialog.rb +104 -113
- data/lib/watobo/gui/finding_info.rb +0 -9
- data/lib/watobo/gui/findings_tree.rb +210 -217
- data/lib/watobo/gui/full_scan_dialog.rb +0 -9
- data/lib/watobo/gui/fuzzer_gui.rb +1295 -1313
- data/lib/watobo/gui/fxsave_thread.rb +14 -0
- data/lib/watobo/gui/goto_url_dialog.rb +70 -79
- data/lib/watobo/gui/hex_viewer.rb +0 -9
- data/lib/watobo/gui/html_viewer.rb +287 -296
- data/lib/watobo/gui/intercept_filter_dialog.rb +188 -197
- data/lib/watobo/gui/interceptor_gui.rb +1041 -1051
- data/lib/watobo/gui/interceptor_settings_dialog.rb +0 -9
- data/lib/watobo/gui/json_viewer.rb +287 -0
- data/lib/watobo/gui/list_box.rb +101 -110
- data/lib/watobo/gui/log_file_viewer.rb +32 -41
- data/lib/watobo/gui/log_viewer.rb +83 -88
- data/lib/watobo/gui/login_wizzard.rb +0 -9
- data/lib/watobo/gui/main_window.rb +587 -618
- data/lib/watobo/gui/manual_request_editor.rb +620 -565
- data/lib/watobo/gui/master_pw_dialog.rb +0 -9
- data/lib/watobo/gui/mixins/gui_settings.rb +29 -38
- data/lib/watobo/gui/page_tree.rb +217 -226
- data/lib/watobo/gui/password_policy_dialog.rb +0 -9
- data/lib/watobo/gui/plugin_board.rb +0 -9
- data/lib/watobo/gui/preferences_dialog.rb +0 -9
- data/lib/watobo/gui/progress_window.rb +17 -27
- data/lib/watobo/gui/project_wizzard.rb +0 -9
- data/lib/watobo/gui/proxy_dialog.rb +1 -10
- data/lib/watobo/gui/quick_scan_dialog.rb +0 -9
- data/lib/watobo/gui/request_builder_frame.rb +102 -111
- data/lib/watobo/gui/request_editor.rb +181 -137
- data/lib/watobo/gui/rewrite_filters_dialog.rb +394 -403
- data/lib/watobo/gui/rewrite_rules_dialog.rb +372 -381
- data/lib/watobo/gui/save_chat_dialog.rb +140 -149
- data/lib/watobo/gui/scanner_settings_dialog.rb +0 -9
- data/lib/watobo/gui/select_chat_dialog.rb +0 -9
- data/lib/watobo/gui/session_management_dialog.rb +0 -9
- data/lib/watobo/gui/sites_tree.rb +0 -9
- data/lib/watobo/gui/status_bar.rb +0 -9
- data/lib/watobo/gui/table_editor.rb +0 -9
- data/lib/watobo/gui/tagless_viewer.rb +0 -9
- data/lib/watobo/gui/templates/plugin.rb +0 -9
- data/lib/watobo/gui/templates/plugin2.rb +92 -100
- data/lib/watobo/gui/templates/plugin_base.rb +144 -153
- data/lib/watobo/gui/text_viewer.rb +0 -9
- data/lib/watobo/gui/transcoder_window.rb +0 -9
- data/lib/watobo/gui/utils/gui_utils.rb +0 -9
- data/lib/watobo/gui/utils/init_icons.rb +86 -95
- data/lib/watobo/gui/utils/load_icons.rb +33 -42
- data/lib/watobo/gui/utils/load_plugins.rb +116 -119
- data/lib/watobo/gui/utils/master_password.rb +68 -77
- data/lib/watobo/gui/utils/save_default_settings.rb +113 -122
- data/lib/watobo/gui/utils/save_project_settings.rb +0 -9
- data/lib/watobo/gui/utils/save_proxy_settings.rb +41 -50
- data/lib/watobo/gui/utils/save_scanner_settings.rb +18 -27
- data/lib/watobo/gui/utils/session_history.rb +112 -121
- data/lib/watobo/gui/workspace_dialog.rb +0 -9
- data/lib/watobo/gui/www_auth_dialog.rb +0 -9
- data/lib/watobo/gui/xml_viewer_frame.rb +0 -9
- data/lib/watobo/http.rb +4 -13
- data/lib/watobo/http/cookies/cookies.rb +26 -35
- data/lib/watobo/http/data/data.rb +45 -54
- data/lib/watobo/http/data/json.rb +47 -55
- data/lib/watobo/http/url/url.rb +38 -47
- data/lib/watobo/http/xml/xml.rb +124 -130
- data/lib/watobo/interceptor.rb +3 -12
- data/lib/watobo/interceptor/proxy.rb +742 -739
- data/lib/watobo/interceptor/transparent.rb +22 -24
- data/lib/watobo/mixins.rb +10 -19
- data/lib/watobo/mixins/check_info.rb +27 -36
- data/lib/watobo/mixins/httpparser.rb +613 -637
- data/lib/watobo/mixins/request_parser.rb +88 -97
- data/lib/watobo/mixins/shapers.rb +515 -529
- data/lib/watobo/mixins/transcoders.rb +3 -11
- data/lib/watobo/parser.rb +1 -10
- data/lib/watobo/parser/html.rb +83 -92
- data/lib/watobo/patch_fxruby_setfocus.rb +26 -0
- data/lib/watobo/sockets.rb +3 -12
- data/lib/watobo/sockets/agent.rb +828 -837
- data/lib/watobo/sockets/client_socket.rb +308 -312
- data/lib/watobo/sockets/connection.rb +401 -410
- data/lib/watobo/sockets/http_socket.rb +11 -13
- data/lib/watobo/sockets/ntlm_auth.rb +129 -138
- data/lib/watobo/utils.rb +10 -19
- data/lib/watobo/utils/check_regex.rb +0 -9
- data/lib/watobo/utils/copy_object.rb +0 -9
- data/lib/watobo/utils/crypto.rb +0 -9
- data/lib/watobo/utils/expand_range.rb +23 -32
- data/lib/watobo/utils/export_xml.rb +97 -106
- data/lib/watobo/utils/file_management.rb +9 -11
- data/lib/watobo/utils/hexprint.rb +9 -18
- data/lib/watobo/utils/load_chat.rb +0 -9
- data/lib/watobo/utils/load_icon.rb +0 -9
- data/lib/watobo/utils/ntlm.rb +866 -875
- data/lib/watobo/utils/print_debug.rb +12 -21
- data/lib/watobo/utils/response_builder.rb +90 -99
- data/lib/watobo/utils/response_hash.rb +0 -9
- data/lib/watobo/utils/secure_eval.rb +0 -9
- data/lib/watobo/utils/strings.rb +10 -19
- data/lib/watobo/utils/text2request.rb +0 -9
- data/lib/watobo/utils/url.rb +23 -32
- data/lib/watobo/utils/utf16.rb +11 -20
- data/modules/active/Apache/mod_status.rb +0 -9
- data/modules/active/Apache/multiview.rb +151 -160
- data/modules/active/Flash/crossdomain.rb +0 -9
- data/modules/active/JWT/jwt_oauth2_none.rb +111 -0
- data/modules/active/cq5/cq5_default_selectors.rb +106 -115
- data/modules/active/cq5/cqp_user_enumeration.rb +125 -134
- data/modules/active/directories/dirwalker.rb +0 -9
- data/modules/active/discovery/fileextensions.rb +0 -9
- data/modules/active/discovery/http_methods.rb +0 -9
- data/modules/active/discovery/jsmapfiles.rb +79 -0
- data/modules/active/domino/domino_db.rb +68 -76
- data/modules/active/dotNET/custom_errors.rb +102 -111
- data/modules/active/dotNET/dotnet_files.rb +90 -99
- data/modules/active/fileinclusion/lfi_simple.rb +0 -9
- data/modules/active/jboss/jboss_basic.rb +0 -9
- data/modules/active/sap/business_objects.rb +51 -60
- data/modules/active/sap/its_commands.rb +0 -9
- data/modules/active/sap/its_service_parameter.rb +0 -9
- data/modules/active/sap/its_services.rb +0 -9
- data/modules/active/sap/its_xss.rb +0 -9
- data/modules/active/shell_shock/shell_shock.rb +139 -148
- data/modules/active/siebel/siebel_apps.rb +160 -169
- data/modules/active/sqlinjection/sql_boolean.rb +0 -9
- data/modules/active/sqlinjection/sql_numerical.rb +198 -0
- data/modules/active/sqlinjection/sqli_error.rb +0 -9
- data/modules/active/sqlinjection/sqli_timing.rb +220 -229
- data/modules/active/struts2/default_handler_ognl.rb +106 -115
- data/modules/active/struts2/include_params_ognl.rb +105 -114
- data/modules/active/xml/xml_xxe.rb +112 -123
- data/modules/active/xss/xss_ng.rb +214 -223
- data/modules/active/xss/xss_simple.rb +0 -9
- data/modules/passive/ajax.rb +68 -77
- data/modules/passive/autocomplete.rb +56 -65
- data/modules/passive/cookie_options.rb +0 -9
- data/modules/passive/cookie_xss.rb +0 -9
- data/modules/passive/detect_code.rb +0 -9
- data/modules/passive/detect_fileupload.rb +0 -9
- data/modules/passive/detect_infrastructure.rb +0 -9
- data/modules/passive/detect_one_time_tokens.rb +0 -9
- data/modules/passive/dirindexing.rb +0 -9
- data/modules/passive/disclosure_domino.rb +55 -64
- data/modules/passive/disclosure_emails.rb +0 -9
- data/modules/passive/disclosure_ipaddr.rb +55 -53
- data/modules/passive/filename_as_parameter.rb +0 -9
- data/modules/passive/form_spotter.rb +0 -9
- data/modules/passive/hidden_fields.rb +50 -59
- data/modules/passive/hotspots.rb +0 -9
- data/modules/passive/in_script_parameter.rb +0 -9
- data/modules/passive/json_web_token.rb +93 -0
- data/modules/passive/multiple_server_headers.rb +0 -9
- data/modules/passive/possible_login.rb +0 -9
- data/modules/passive/redirect_url.rb +0 -9
- data/modules/passive/redirectionz.rb +0 -9
- data/modules/passive/sap-headers.rb +56 -65
- data/modules/passive/xss_dom.rb +0 -9
- data/plugins/aem/aem.rb +11 -20
- data/plugins/aem/gui/main.rb +118 -127
- data/plugins/aem/gui/tree_view.rb +171 -180
- data/plugins/aem/lib/agent.rb +130 -138
- data/plugins/aem/lib/dispatcher.rb +45 -51
- data/plugins/aem/lib/engine.rb +177 -186
- data/plugins/catalog/catalog.rb +345 -355
- data/plugins/crawler/crawler.rb +4 -13
- data/plugins/crawler/gui.rb +5 -14
- data/plugins/crawler/gui/auth_frame.rb +270 -279
- data/plugins/crawler/gui/crawler_gui.rb +271 -276
- data/plugins/crawler/gui/general_settings_frame.rb +96 -105
- data/plugins/crawler/gui/hooks_frame.rb +80 -89
- data/plugins/crawler/gui/scope_frame.rb +50 -59
- data/plugins/crawler/gui/settings_tabbook.rb +38 -47
- data/plugins/crawler/gui/status_frame.rb +59 -68
- data/plugins/crawler/lib/bags.rb +18 -27
- data/plugins/crawler/lib/constants.rb +11 -20
- data/plugins/crawler/lib/engine.rb +488 -497
- data/plugins/crawler/lib/grabber.rb +68 -77
- data/plugins/crawler/lib/status.rb +71 -80
- data/plugins/crawler/lib/uri_mp.rb +12 -21
- data/plugins/filefinder/filefinder.rb +326 -333
- data/plugins/sqlmap/bin/test.rb +78 -87
- data/plugins/sqlmap/gui.rb +4 -13
- data/plugins/sqlmap/gui/main.rb +218 -227
- data/plugins/sqlmap/gui/options_frame.rb +97 -106
- data/plugins/sqlmap/lib/sqlmap_ctrl.rb +90 -100
- data/plugins/sqlmap/sqlmap.rb +2 -11
- data/plugins/sslchecker/cli/sslchecker_cli.rb +0 -9
- data/plugins/sslchecker/gui/cipher_table.rb +246 -254
- data/plugins/sslchecker/gui/gui.rb +258 -264
- data/plugins/sslchecker/gui/sslchecker.rb +4 -13
- data/plugins/sslchecker/lib/check.rb +127 -133
- data/plugins/wshell/gui/main.rb +119 -117
- data/plugins/wshell/lib/core.rb +38 -88
- data/plugins/wshell/wshell.rb +11 -20
- metadata +170 -164
@@ -1,12 +1,3 @@
|
|
1
|
-
#.
|
2
|
-
# password_policy_dialog.rb
|
3
|
-
#.
|
4
|
-
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
-
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
-
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
-
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
-
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
9
|
-
|
10
1
|
# @private
|
11
2
|
module Watobo#:nodoc: all
|
12
3
|
module Gui
|
@@ -1,12 +1,3 @@
|
|
1
|
-
#.
|
2
|
-
# plugin_board.rb
|
3
|
-
#.
|
4
|
-
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
-
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
-
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
-
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
-
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
9
|
-
|
10
1
|
# @private
|
11
2
|
module Watobo#:nodoc: all
|
12
3
|
module Gui
|
@@ -1,12 +1,3 @@
|
|
1
|
-
#.
|
2
|
-
# preferences_dialog.rb
|
3
|
-
#.
|
4
|
-
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
-
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
-
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
-
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
-
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
9
|
-
|
10
1
|
# @private
|
11
2
|
module Watobo#:nodoc: all
|
12
3
|
module Gui
|
@@ -1,14 +1,5 @@
|
|
1
|
-
#.
|
2
|
-
# progress_window.rb
|
3
|
-
#.
|
4
|
-
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
-
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
-
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
-
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
-
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
9
|
-
|
10
1
|
# @private
|
11
|
-
module Watobo#:nodoc: all
|
2
|
+
module Watobo #:nodoc: all
|
12
3
|
module Gui
|
13
4
|
class ProgressWindow < FXTopWindow
|
14
5
|
def increment(x)
|
@@ -55,8 +46,22 @@ module Watobo#:nodoc: all
|
|
55
46
|
end
|
56
47
|
end
|
57
48
|
|
49
|
+
def start_update_timer
|
50
|
+
Watobo.save_thread {
|
51
|
+
@update_lock.synchronize do
|
52
|
+
@title_lbl.text = @title
|
53
|
+
@task_lbl.text = @task
|
54
|
+
@job_lbl.text = @job
|
55
|
+
|
56
|
+
@pbar.increment(@increment)
|
57
|
+
@increment = 0
|
58
|
+
@pbar.total = @total
|
59
|
+
end
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
58
63
|
def initialize(owner, opts={})
|
59
|
-
super(
|
64
|
+
super(owner, 'Progress Bar', nil, nil, DECOR_BORDER, 0, 0, 300, 100, 0, 0, 0, 0, 0, 0)
|
60
65
|
frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
|
61
66
|
@update_lock = Mutex.new
|
62
67
|
|
@@ -77,22 +82,7 @@ module Watobo#:nodoc: all
|
|
77
82
|
@job = "-"
|
78
83
|
@task = "-"
|
79
84
|
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
def add_update_timer(ms)
|
84
|
-
@update_timer = FXApp.instance.addTimeout( ms, :repeat => true) {
|
85
|
-
@update_lock.synchronize do
|
86
|
-
@title_lbl.text = @title
|
87
|
-
@task_lbl.text = @task
|
88
|
-
@job_lbl.text = @job
|
89
|
-
|
90
|
-
@pbar.increment(@increment)
|
91
|
-
@increment = 0
|
92
|
-
@pbar.total = @total
|
93
|
-
# @pbar.progress = settings[:progress] unless settings[:progress].nil?
|
94
|
-
end
|
95
|
-
}
|
85
|
+
start_update_timer
|
96
86
|
end
|
97
87
|
|
98
88
|
end
|
@@ -1,12 +1,3 @@
|
|
1
|
-
#.
|
2
|
-
# project_wizzard.rb
|
3
|
-
#.
|
4
|
-
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
-
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
-
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
-
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
-
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
9
|
-
|
10
1
|
# @private
|
11
2
|
module Watobo#:nodoc: all
|
12
3
|
module Gui
|
@@ -1,12 +1,3 @@
|
|
1
|
-
#.
|
2
|
-
# proxy_dialog.rb
|
3
|
-
#.
|
4
|
-
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
-
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
-
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
-
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
-
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
9
|
-
|
10
1
|
# @private
|
11
2
|
module Watobo#:nodoc: all
|
12
3
|
module Gui
|
@@ -366,7 +357,7 @@ module Watobo#:nodoc: all
|
|
366
357
|
@proxyTable.removeRows(row,1)
|
367
358
|
@proxyTable.killSelection(true)
|
368
359
|
@delProxyButton.disable
|
369
|
-
|
360
|
+
#@acceptBtn.disable
|
370
361
|
# @proxy_label.text = ''
|
371
362
|
end
|
372
363
|
end
|
@@ -1,12 +1,3 @@
|
|
1
|
-
#.
|
2
|
-
# quick_scan_dialog.rb
|
3
|
-
#.
|
4
|
-
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
-
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
-
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
-
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
-
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
9
|
-
|
10
1
|
# @private
|
11
2
|
module Watobo#:nodoc: all
|
12
3
|
module Gui
|
@@ -1,63 +1,54 @@
|
|
1
|
-
#.
|
2
|
-
# request_builder_frame.rb
|
3
|
-
#.
|
4
|
-
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
-
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
-
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
-
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
-
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
9
|
-
|
10
1
|
# @private
|
11
|
-
module Watobo#:nodoc: all
|
12
|
-
module Gui
|
13
|
-
class RequestBuilder < FXVerticalFrame
|
14
|
-
def subscribe(event, &callback)
|
15
|
-
(@event_dispatcher_listeners[event] ||= []) << callback
|
16
|
-
end
|
17
|
-
|
18
|
-
def clearEvents(event)
|
19
|
-
@event_dispatcher_listener[event].clear
|
20
|
-
end
|
21
|
-
|
22
|
-
def setRequest(raw_request)
|
23
|
-
begin
|
24
|
-
# request
|
25
|
-
if raw_request.is_a? String
|
26
|
-
request = Watobo::Utils.text2request(raw_request)
|
27
|
-
else
|
28
|
-
request = Watobo::Request.new raw_request
|
29
|
-
end
|
30
|
-
|
31
|
-
@editors.each do |name, item|
|
2
|
+
module Watobo#:nodoc: all
|
3
|
+
module Gui
|
4
|
+
class RequestBuilder < FXVerticalFrame
|
5
|
+
def subscribe(event, &callback)
|
6
|
+
(@event_dispatcher_listeners[event] ||= []) << callback
|
7
|
+
end
|
8
|
+
|
9
|
+
def clearEvents(event)
|
10
|
+
@event_dispatcher_listener[event].clear
|
11
|
+
end
|
12
|
+
|
13
|
+
def setRequest(raw_request)
|
14
|
+
begin
|
15
|
+
# request
|
16
|
+
if raw_request.is_a? String
|
17
|
+
request = Watobo::Utils.text2request(raw_request)
|
18
|
+
else
|
19
|
+
request = Watobo::Request.new raw_request
|
20
|
+
end
|
21
|
+
|
22
|
+
@editors.each do |name, item|
|
32
23
|
e = item[:editor]
|
33
|
-
r = e.setRequest(request)
|
24
|
+
r = e.setRequest(request)
|
34
25
|
if r
|
35
|
-
item[:tab_item].enable
|
36
|
-
else
|
37
|
-
item[:tab_item].disable
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
rescue => bang
|
43
|
-
puts bang
|
44
|
-
puts bang.backtrace
|
45
|
-
|
46
|
-
end
|
26
|
+
item[:tab_item].enable
|
27
|
+
else
|
28
|
+
item[:tab_item].disable
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
rescue => bang
|
34
|
+
puts bang
|
35
|
+
puts bang.backtrace
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def highlight(pattern)
|
41
|
+
# @text_edit.highlight(pattern)
|
42
|
+
end
|
43
|
+
|
44
|
+
def rawRequest
|
45
|
+
@current.rawRequest
|
47
46
|
end
|
48
47
|
|
49
|
-
def
|
50
|
-
# @text_edit.highlight(pattern)
|
51
|
-
end
|
48
|
+
def parseRequest
|
52
49
|
|
53
|
-
|
54
|
-
@current.rawRequest
|
55
|
-
end
|
50
|
+
@current.parseRequest
|
56
51
|
|
57
|
-
def parseRequest
|
58
|
-
|
59
|
-
@current.parseRequest
|
60
|
-
|
61
52
|
end
|
62
53
|
|
63
54
|
def clear
|
@@ -76,62 +67,62 @@ module Watobo#:nodoc: all
|
|
76
67
|
# puts s.class
|
77
68
|
# puts s.empty?
|
78
69
|
s
|
79
|
-
end
|
80
|
-
|
81
|
-
def initialize(owner, opts)
|
82
|
-
super(owner,opts)
|
83
|
-
|
84
|
-
@event_dispatcher_listeners = Hash.new
|
85
|
-
@last_editor = nil
|
86
|
-
|
87
|
-
@tab = FXTabBook.new(self, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT)
|
88
|
-
@tab.connect(SEL_COMMAND){
|
89
|
-
@current = @editors.to_a[@tab.current][1][:editor]
|
90
|
-
unless @last_editor.nil?
|
91
|
-
last_request = @last_editor.rawRequest
|
92
|
-
@current.setRequest(last_request)
|
93
|
-
end
|
94
|
-
@last_editor = @editors.to_a[@tab.current][1][:editor]
|
95
|
-
#puts @current.class
|
96
|
-
}
|
97
|
-
@editors = {}
|
98
|
-
@current = nil
|
99
|
-
|
100
|
-
add_editor("Text") do |frame|
|
101
|
-
Watobo::Gui::RequestEditor.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
|
102
|
-
end
|
103
|
-
|
104
|
-
add_editor("Table") do |frame|
|
105
|
-
Watobo::Gui::TableEditorFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
|
106
|
-
end
|
107
|
-
|
108
|
-
@current = @editors.first[1][:editor]
|
109
|
-
|
110
|
-
end
|
111
|
-
|
112
|
-
private
|
113
|
-
|
114
|
-
def add_editor(tab_name, &b)
|
115
|
-
tab_item = FXTabItem.new(@tab, tab_name, nil)
|
116
|
-
frame = FXVerticalFrame.new(@tab, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
|
117
|
-
editor = yield(frame) if block_given?
|
118
|
-
|
119
|
-
@editors[tab_name.to_sym] = {
|
120
|
-
:editor => editor,
|
121
|
-
:tab_item => tab_item
|
122
|
-
}
|
123
|
-
editor.subscribe(:hotkey_ctrl_enter){ notify(:hotkey_ctrl_enter) }
|
124
|
-
editor.subscribe(:error) { |msg| notify(:error, msg) }
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
def notify(event, *args)
|
129
|
-
if @event_dispatcher_listeners[event]
|
130
|
-
@event_dispatcher_listeners[event].each do |m|
|
131
|
-
m.call(*args) if m.respond_to? :call
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def initialize(owner, opts)
|
73
|
+
super(owner,opts)
|
74
|
+
|
75
|
+
@event_dispatcher_listeners = Hash.new
|
76
|
+
@last_editor = nil
|
77
|
+
|
78
|
+
@tab = FXTabBook.new(self, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT)
|
79
|
+
@tab.connect(SEL_COMMAND){
|
80
|
+
@current = @editors.to_a[@tab.current][1][:editor]
|
81
|
+
unless @last_editor.nil?
|
82
|
+
last_request = @last_editor.rawRequest
|
83
|
+
@current.setRequest(last_request)
|
84
|
+
end
|
85
|
+
@last_editor = @editors.to_a[@tab.current][1][:editor]
|
86
|
+
#puts @current.class
|
87
|
+
}
|
88
|
+
@editors = {}
|
89
|
+
@current = nil
|
90
|
+
|
91
|
+
add_editor("Text") do |frame|
|
92
|
+
Watobo::Gui::RequestEditor.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
|
93
|
+
end
|
94
|
+
|
95
|
+
add_editor("Table") do |frame|
|
96
|
+
Watobo::Gui::TableEditorFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
|
97
|
+
end
|
98
|
+
|
99
|
+
@current = @editors.first[1][:editor]
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
private
|
104
|
+
|
105
|
+
def add_editor(tab_name, &b)
|
106
|
+
tab_item = FXTabItem.new(@tab, tab_name, nil)
|
107
|
+
frame = FXVerticalFrame.new(@tab, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
|
108
|
+
editor = yield(frame) if block_given?
|
109
|
+
|
110
|
+
@editors[tab_name.to_sym] = {
|
111
|
+
:editor => editor,
|
112
|
+
:tab_item => tab_item
|
113
|
+
}
|
114
|
+
editor.subscribe(:hotkey_ctrl_enter){ notify(:hotkey_ctrl_enter) }
|
115
|
+
editor.subscribe(:error) { |msg| notify(:error, msg) }
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
def notify(event, *args)
|
120
|
+
if @event_dispatcher_listeners[event]
|
121
|
+
@event_dispatcher_listeners[event].each do |m|
|
122
|
+
m.call(*args) if m.respond_to? :call
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
137
128
|
end
|
@@ -1,14 +1,5 @@
|
|
1
|
-
#.
|
2
|
-
# request_editor.rb
|
3
|
-
#.
|
4
|
-
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
-
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
-
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
-
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
-
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
9
|
-
|
10
1
|
# @private
|
11
|
-
module Watobo#:nodoc: all
|
2
|
+
module Watobo #:nodoc: all
|
12
3
|
module Gui
|
13
4
|
class SimpleTextView < FXVerticalFrame
|
14
5
|
|
@@ -47,7 +38,7 @@ module Watobo#:nodoc: all
|
|
47
38
|
def textStyle()
|
48
39
|
@textbox.textStyle
|
49
40
|
end
|
50
|
-
|
41
|
+
|
51
42
|
def clear
|
52
43
|
@textbox.setText('')
|
53
44
|
end
|
@@ -83,24 +74,24 @@ module Watobo#:nodoc: all
|
|
83
74
|
|
84
75
|
# Construct some hilite styles
|
85
76
|
hs_green = FXHiliteStyle.new
|
86
|
-
hs_green.normalForeColor = FXRGBA(255,255,255,255) #FXColor::Red
|
87
|
-
hs_green.normalBackColor = FXRGBA(0,255,0,1)
|
77
|
+
hs_green.normalForeColor = FXRGBA(255, 255, 255, 255) #FXColor::Red
|
78
|
+
hs_green.normalBackColor = FXRGBA(0, 255, 0, 1) # FXColor::White
|
88
79
|
hs_green.style = FXText::STYLE_BOLD
|
89
80
|
|
90
81
|
hs_red = FXHiliteStyle.new
|
91
|
-
hs_red.normalForeColor = FXRGBA(255,255,255,255) #FXColor::Red
|
92
|
-
hs_red.normalBackColor = FXRGBA(255,0,0,1)
|
82
|
+
hs_red.normalForeColor = FXRGBA(255, 255, 255, 255) #FXColor::Red
|
83
|
+
hs_red.normalBackColor = FXRGBA(255, 0, 0, 1) # FXColor::White
|
93
84
|
hs_red.style = FXText::STYLE_BOLD
|
94
85
|
|
95
86
|
# @req_builder = FXText.new(req_editor, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
96
|
-
|
97
|
-
@textbox = FXText.new(self,
|
87
|
+
|
88
|
+
@textbox = FXText.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
98
89
|
@textbox.extend Watobo::Mixins::RequestParser
|
99
|
-
|
90
|
+
|
100
91
|
# Enable the style buffer for this text widget
|
101
92
|
@textbox.styled = true
|
102
93
|
# Set the styles
|
103
|
-
@textbox.hiliteStyles = [
|
94
|
+
@textbox.hiliteStyles = [hs_green, hs_red]
|
104
95
|
|
105
96
|
@textbox.editable = false
|
106
97
|
|
@@ -120,31 +111,31 @@ module Watobo#:nodoc: all
|
|
120
111
|
addEncoder(menu_pane, sender) if @textbox.editable?
|
121
112
|
|
122
113
|
FXMenuSeparator.new(menu_pane)
|
123
|
-
FXMenuCaption.new(menu_pane,"- Copy -")
|
114
|
+
FXMenuCaption.new(menu_pane, "- Copy -")
|
124
115
|
FXMenuSeparator.new(menu_pane)
|
125
|
-
copyText = FXMenuCommand.new(menu_pane,"copy text: #{selection}", nil, @textbox, FXText::ID_COPY_SEL)
|
116
|
+
copyText = FXMenuCommand.new(menu_pane, "copy text: #{selection}", nil, @textbox, FXText::ID_COPY_SEL)
|
126
117
|
|
127
118
|
FXMenuSeparator.new(menu_pane)
|
128
|
-
FXMenuCaption.new(menu_pane,"- Transcoder -")
|
119
|
+
FXMenuCaption.new(menu_pane, "- Transcoder -")
|
129
120
|
FXMenuSeparator.new(menu_pane)
|
130
|
-
send2transcoder = FXMenuCommand.new(menu_pane,"send to transcoder")
|
121
|
+
send2transcoder = FXMenuCommand.new(menu_pane, "send to transcoder")
|
131
122
|
send2transcoder.connect(SEL_COMMAND) {
|
132
123
|
t = TranscoderWindow.new(FXApp.instance, selection)
|
133
124
|
t.create
|
134
125
|
t.show(Fox::PLACEMENT_SCREEN)
|
135
126
|
}
|
136
127
|
FXMenuSeparator.new(menu_pane)
|
137
|
-
target = FXMenuCheck.new(menu_pane, "word wrap"
|
138
|
-
target.check = (
|
128
|
+
target = FXMenuCheck.new(menu_pane, "word wrap")
|
129
|
+
target.check = (@textbox.textStyle & TEXT_WORDWRAP > 0) ? true : false
|
139
130
|
target.connect(SEL_COMMAND) { @textbox.textStyle ^= TEXT_WORDWRAP }
|
140
131
|
|
141
|
-
target = FXMenuCheck.new(menu_pane, "big font"
|
142
|
-
target.check = (
|
132
|
+
target = FXMenuCheck.new(menu_pane, "big font")
|
133
|
+
target.check = (@textbox.font == @small_font) ? false : true
|
143
134
|
target.connect(SEL_COMMAND) { |ts, tsel, titem|
|
144
135
|
if ts.checked?
|
145
|
-
|
136
|
+
@textbox.font = @big_font
|
146
137
|
else
|
147
|
-
|
138
|
+
@textbox.font = @small_font
|
148
139
|
end
|
149
140
|
|
150
141
|
}
|
@@ -165,16 +156,15 @@ module Watobo#:nodoc: all
|
|
165
156
|
def editable?()
|
166
157
|
@textbox.editable?
|
167
158
|
end
|
168
|
-
|
169
|
-
|
159
|
+
|
170
160
|
|
171
161
|
def setText(text, prefs={})
|
172
162
|
@text = normalizeText(text)
|
173
|
-
|
163
|
+
|
174
164
|
showText(@text)
|
175
165
|
true
|
176
166
|
end
|
177
|
-
|
167
|
+
|
178
168
|
alias_method :setRequest, :setText
|
179
169
|
|
180
170
|
def filter(pattern)
|
@@ -185,13 +175,13 @@ module Watobo#:nodoc: all
|
|
185
175
|
dummy.each do |line|
|
186
176
|
begin
|
187
177
|
if line =~ /#{pattern}/i then
|
188
|
-
|
178
|
+
filtered.push line
|
189
179
|
end
|
190
180
|
rescue => bang
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
181
|
+
puts
|
182
|
+
puts bang
|
183
|
+
pattern = Regexp.quote(pattern)
|
184
|
+
retry
|
195
185
|
end
|
196
186
|
end
|
197
187
|
showText(filtered.join("\n"))
|
@@ -212,8 +202,8 @@ module Watobo#:nodoc: all
|
|
212
202
|
begin
|
213
203
|
@textbox.changeStyle(start, len, @style)
|
214
204
|
rescue => bang
|
215
|
-
|
216
|
-
|
205
|
+
puts "outch"
|
206
|
+
puts bang
|
217
207
|
end
|
218
208
|
end
|
219
209
|
|
@@ -222,18 +212,18 @@ module Watobo#:nodoc: all
|
|
222
212
|
|
223
213
|
def makeMatchVisible(match_index=0)
|
224
214
|
return true if @pattern_matches.empty?
|
225
|
-
return false if match_index > (
|
215
|
+
return false if match_index > (@pattern_matches.length - 1)
|
226
216
|
if @pattern_matches[match_index] then
|
227
|
-
|
228
|
-
|
217
|
+
pos = @pattern_matches[match_index][0]
|
218
|
+
len =@pattern_matches[match_index][1]
|
229
219
|
|
230
|
-
|
220
|
+
@textbox.setCenterLine(pos)
|
231
221
|
|
232
|
-
|
233
|
-
|
234
|
-
|
222
|
+
# @textbox.makePositionVisible(pos + len)
|
223
|
+
@textbox.makePositionVisible(@textbox.lineEnd(pos))
|
224
|
+
@textbox.makePositionVisible(pos)
|
235
225
|
|
236
|
-
|
226
|
+
@textbox.setCursorPos(pos)
|
237
227
|
end
|
238
228
|
return true
|
239
229
|
end
|
@@ -253,7 +243,7 @@ module Watobo#:nodoc: all
|
|
253
243
|
|
254
244
|
sindex, eindex = @textbox.findText(pattern, pos, :flags => SEARCH_REGEX|SEARCH_IGNORECASE|SEARCH_FORWARD) if not sindex
|
255
245
|
|
256
|
-
sindex, eindex = @textbox.findText(Regexp.quote(pattern),pos, :flags => SEARCH_REGEX|SEARCH_IGNORECASE|SEARCH_FORWARD) if not sindex
|
246
|
+
sindex, eindex = @textbox.findText(Regexp.quote(pattern), pos, :flags => SEARCH_REGEX|SEARCH_IGNORECASE|SEARCH_FORWARD) if not sindex
|
257
247
|
|
258
248
|
break if not sindex or sindex.length == 0
|
259
249
|
|
@@ -261,7 +251,7 @@ module Watobo#:nodoc: all
|
|
261
251
|
sindex.length.times do |i|
|
262
252
|
start = sindex[i]
|
263
253
|
len = eindex[i] - sindex[i]
|
264
|
-
@pattern_matches.push [
|
254
|
+
@pattern_matches.push [start, len] if start >= 0
|
265
255
|
end
|
266
256
|
|
267
257
|
break if sindex.last < 0
|
@@ -273,17 +263,17 @@ module Watobo#:nodoc: all
|
|
273
263
|
|
274
264
|
def showText(text)
|
275
265
|
begin
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
266
|
+
# if @max_len > 0 and @max_len < text.length
|
267
|
+
# text = text[0..@max_len] + "\n---8<--- WATOBO ---8<---\n* PRESS RESET TO SEE FULL RESPONSE *"
|
268
|
+
# end
|
269
|
+
# text.encode('iso_8859_1')
|
270
|
+
# UTF-8 CleanUp
|
271
|
+
text = text.unpack("C*").pack("C*")
|
272
|
+
text.gsub!(/\x0d/u, '')
|
273
|
+
r = Regexp.new '[\x00-\x09\x0b-\x1f\x7f-\xff]+', nil, 'n'
|
274
|
+
text.gsub!(r, '.')
|
275
|
+
@textbox.setText(text)
|
276
|
+
return true
|
287
277
|
rescue => bang
|
288
278
|
puts bang
|
289
279
|
puts bang.backtrace if $DEBUG
|
@@ -302,15 +292,15 @@ module Watobo#:nodoc: all
|
|
302
292
|
|
303
293
|
def normalizeText(text)
|
304
294
|
begin
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
295
|
+
t = text
|
296
|
+
return "" if text.nil?
|
297
|
+
t = text.join if text.is_a? Array
|
298
|
+
t = t.unpack("C*").pack("C*")
|
299
|
+
t.gsub!(/\x0d/, '')
|
300
|
+
|
301
|
+
r = Regexp.new '[\x00-\x09\x0b-\x1f\x7f-\xff]+', nil, 'n'
|
302
|
+
t.gsub!(r, '.')
|
303
|
+
return t
|
314
304
|
rescue => bang
|
315
305
|
puts bang
|
316
306
|
puts bang.backtrace if $DEBUG
|
@@ -318,7 +308,7 @@ module Watobo#:nodoc: all
|
|
318
308
|
text.join
|
319
309
|
end
|
320
310
|
|
321
|
-
def log(text,e=nil)
|
311
|
+
def log(text, e=nil)
|
322
312
|
# @logger.addError "Not a valid expression! \n#{e}"
|
323
313
|
t = Time.now
|
324
314
|
now = t.strftime("%m/%d/%Y @ %H:%M:%S")
|
@@ -326,8 +316,8 @@ module Watobo#:nodoc: all
|
|
326
316
|
notify(:error, msg)
|
327
317
|
puts msg
|
328
318
|
if e then
|
329
|
-
|
330
|
-
|
319
|
+
puts e
|
320
|
+
puts e.backtrace
|
331
321
|
end
|
332
322
|
end
|
333
323
|
|
@@ -336,6 +326,7 @@ module Watobo#:nodoc: all
|
|
336
326
|
class RequestEditor < SimpleTextView
|
337
327
|
def initialize(owner, opts)
|
338
328
|
super(owner, opts)
|
329
|
+
@keystate = true
|
339
330
|
|
340
331
|
@textbox.textStyle -= TEXT_WORDWRAP
|
341
332
|
|
@@ -346,27 +337,55 @@ module Watobo#:nodoc: all
|
|
346
337
|
unless event.moved?
|
347
338
|
FXMenuPane.new(self) do |menu_pane|
|
348
339
|
cpos = sender.cursorPos
|
349
|
-
|
350
340
|
pos = sender.selStartPos
|
351
341
|
#puts "*selStartPos: #{pos}"
|
352
342
|
#puts "*selEndPos: #{sender.selEndPos}"
|
353
343
|
len = sender.selEndPos - pos
|
354
344
|
string2decode = sender.extractText(pos, len)
|
355
345
|
string2decode.extend Watobo::Mixin::Transcoders
|
346
|
+
|
347
|
+
fp_submenu = FXMenuPane.new(self) do |sub|
|
348
|
+
eh = FXMenuCommand.new(sub, "File")
|
349
|
+
eh.connect(SEL_COMMAND) {
|
350
|
+
insf = FXFileDialog.getOpenFilename(self, "Select file to insert", nil)
|
351
|
+
if insf != "" then
|
352
|
+
if File.exists?(insf) then
|
353
|
+
# puts "Inserting #{insf}"
|
354
|
+
sender.insertText(cpos, "%%File.read('#{insf}')%%")
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
}
|
359
|
+
end
|
360
|
+
FXMenuCascade.new(menu_pane, "Insert", nil, fp_submenu)
|
361
|
+
|
356
362
|
FXMenuSeparator.new(menu_pane)
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
363
|
+
fp_submenu = FXMenuPane.new(self) do |sub|
|
364
|
+
target = FXMenuCommand.new(sub, "JSON")
|
365
|
+
target.connect(SEL_COMMAND) {
|
366
|
+
begin
|
367
|
+
jb = JSON.parse(string2decode)
|
368
|
+
out = JSON.pretty_generate jb
|
369
|
+
replace_text(sender, out)
|
370
|
+
rescue => bang
|
371
|
+
out = "Could prettify response :(\n\n"
|
372
|
+
out << bang.to_s
|
373
|
+
end
|
374
|
+
}
|
375
|
+
target = FXMenuCommand.new(sub, "XML")
|
376
|
+
target.connect(SEL_COMMAND) {
|
377
|
+
begin
|
378
|
+
doc = Nokogiri.XML(string2decode)
|
379
|
+
replace_text(sender, doc.to_xml)
|
380
|
+
rescue => bang
|
381
|
+
puts bang
|
382
|
+
end
|
383
|
+
|
384
|
+
}
|
385
|
+
|
386
|
+
end
|
387
|
+
FXMenuCascade.new(menu_pane, "Prettify", nil, fp_submenu)
|
388
|
+
|
370
389
|
addStringInfo(menu_pane, sender)
|
371
390
|
addDecoder(menu_pane, sender)
|
372
391
|
addEncoder(menu_pane, sender)
|
@@ -388,18 +407,25 @@ module Watobo#:nodoc: all
|
|
388
407
|
@ctrl_pressed = false
|
389
408
|
|
390
409
|
@textbox.connect(SEL_KEYPRESS) do |sender, sel, event|
|
391
|
-
@
|
410
|
+
@keystate = false
|
411
|
+
if event.code == KEY_Control_L or event.code == KEY_Control_R
|
412
|
+
@ctrl_pressed = true
|
413
|
+
@keystate = true
|
414
|
+
elsif event.code == KEY_Alt_R
|
415
|
+
@ctrl_pressed = false
|
416
|
+
@keystate = true
|
392
417
|
# @shift_pressed = true if @ctrl_pressed and ( event.code == KEY_Shift_L or event.code == KEY_Shift_R )
|
393
|
-
|
418
|
+
elsif event.code == KEY_F1
|
394
419
|
unless event.moved?
|
395
420
|
FXMenuPane.new(self) do |menu_pane|
|
396
421
|
FXMenuCaption.new(menu_pane, "Hotkeys:")
|
397
422
|
FXMenuSeparator.new(menu_pane)
|
398
|
-
[
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
423
|
+
["<ctrl-enter> - Send Request",
|
424
|
+
"<ctrl-b> - Encode Base64",
|
425
|
+
"<ctrl-shift-b> - Decode Base64",
|
426
|
+
"<ctrl-u> - Encode URL",
|
427
|
+
"<ctrl-shift-u> - Decode URL",
|
428
|
+
"<ctrl-j> - Prettify JSON"
|
403
429
|
].each do |hk|
|
404
430
|
FXMenuCaption.new(menu_pane, hk)
|
405
431
|
end
|
@@ -411,51 +437,69 @@ module Watobo#:nodoc: all
|
|
411
437
|
end
|
412
438
|
|
413
439
|
end
|
414
|
-
|
415
|
-
if @ctrl_pressed
|
440
|
+
elsif @ctrl_pressed
|
416
441
|
if event.code == KEY_Return
|
417
|
-
|
418
|
-
|
442
|
+
notify(:hotkey_ctrl_enter)
|
443
|
+
@keystate = true # special handling of KEY_Return, because we don't want a linebreak in textbox.
|
419
444
|
else
|
420
445
|
notify(:hotkey_ctrl_f) if event.code == KEY_f
|
421
446
|
notify(:hotkey_ctrl_s) if event.code == KEY_s
|
422
447
|
pos = @textbox.selStartPos
|
423
448
|
len = @textbox.selEndPos - pos
|
449
|
+
|
450
|
+
# if nothing is selected we asssume that conversion/beautifying should be
|
451
|
+
# performed on full body
|
452
|
+
if len==0
|
453
|
+
i = @textbox.text.index("\n\n")
|
454
|
+
unless i.nil?
|
455
|
+
pos = i + 2
|
456
|
+
len = @textbox.text.length - pos
|
457
|
+
end
|
458
|
+
end
|
459
|
+
|
424
460
|
unless len==0
|
425
|
-
text = @textbox.extractText(pos,len)
|
461
|
+
text = @textbox.extractText(pos, len)
|
426
462
|
rptxt = case event.code
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
463
|
+
when KEY_u
|
464
|
+
CGI::escape(text)
|
465
|
+
when KEY_h
|
466
|
+
CGI::escapeHTML(text)
|
467
|
+
when KEY_H
|
468
|
+
CGI::unescapeHTML(text)
|
469
|
+
when KEY_b
|
470
|
+
Base64.strict_encode64(text)
|
471
|
+
when KEY_U
|
472
|
+
CGI::unescape(text)
|
473
|
+
when KEY_B
|
474
|
+
Base64.decode64(text)
|
475
|
+
when KEY_j
|
476
|
+
begin
|
477
|
+
jb = JSON.parse(text)
|
478
|
+
out = JSON.pretty_generate jb
|
479
|
+
end
|
480
|
+
out
|
481
|
+
else
|
482
|
+
text
|
483
|
+
end
|
484
|
+
text = normalizeText(rptxt)
|
485
|
+
@textbox.replaceText(pos, len, text)
|
486
|
+
@textbox.setSelection(pos, text.length)
|
445
487
|
end
|
446
|
-
|
488
|
+
@keystate = false
|
447
489
|
end
|
448
490
|
else
|
449
|
-
|
450
|
-
|
491
|
+
#puts "%04x" % event.code
|
492
|
+
@keystate = false
|
451
493
|
end
|
494
|
+
@keystate
|
452
495
|
end
|
453
496
|
|
454
497
|
@textbox.connect(SEL_KEYRELEASE) do |sender, sel, event|
|
455
498
|
@ctrl_pressed = false if event.code == KEY_Control_L or event.code == KEY_Control_R
|
456
|
-
|
499
|
+
|
457
500
|
end
|
458
501
|
|
502
|
+
|
459
503
|
end
|
460
504
|
|
461
505
|
def parseRequest
|
@@ -464,16 +508,16 @@ module Watobo#:nodoc: all
|
|
464
508
|
rescue SyntaxError, LocalJumpError, NameError => bang
|
465
509
|
puts bang
|
466
510
|
puts bang.backtrace
|
467
|
-
|
511
|
+
# puts bang.backtrace if $DEBUG
|
468
512
|
notify(:error, "#{$!}")
|
469
513
|
rescue => bang
|
470
|
-
|
471
|
-
|
514
|
+
puts bang
|
515
|
+
notify(:error, "Could not parse request: #{$!}")
|
472
516
|
end
|
473
517
|
|
474
518
|
return nil
|
475
519
|
end
|
476
|
-
|
520
|
+
|
477
521
|
|
478
522
|
private
|
479
523
|
|
@@ -489,23 +533,23 @@ module Watobo#:nodoc: all
|
|
489
533
|
|
490
534
|
@markers = highlight(pattern)
|
491
535
|
@textbox.setCursorPos(pos)
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
536
|
+
# else
|
537
|
+
# @markers.each do |start, len|
|
538
|
+
# if pos >= start and pos <= start + len then
|
539
|
+
# @markers = highlight(pattern)
|
540
|
+
# @textbox.setCursorPos(pos)
|
541
|
+
# break
|
542
|
+
# end
|
543
|
+
# end
|
544
|
+
# end
|
501
545
|
|
502
546
|
rescue => bang
|
503
|
-
|
504
|
-
|
547
|
+
puts "!!!ERROR: onTextChanged"
|
548
|
+
puts bang
|
505
549
|
end
|
506
550
|
end
|
507
551
|
end
|
508
552
|
|
509
|
-
|
553
|
+
# -> # module Watobo::Gui
|
510
554
|
end
|
511
555
|
end
|