watobo 0.9.21 → 0.9.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (283) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +46 -1
  3. data/bin/nfq_server.rb +0 -9
  4. data/bin/watobo_gui.rb +3 -13
  5. data/custom-views/prettify-json.rb +9 -18
  6. data/icons/watobo.ico +0 -0
  7. data/icons/watobo.ico.old +0 -0
  8. data/lib/watobo.rb +10 -19
  9. data/lib/watobo/adapters.rb +5 -14
  10. data/lib/watobo/adapters/data_store.rb +50 -59
  11. data/lib/watobo/adapters/file/file_store.rb +287 -296
  12. data/lib/watobo/adapters/file/marshal_store.rb +293 -296
  13. data/lib/watobo/adapters/session_store.rb +5 -14
  14. data/lib/watobo/ca.rb +1 -10
  15. data/lib/watobo/config.rb +197 -206
  16. data/lib/watobo/constants.rb +0 -9
  17. data/lib/watobo/core.rb +3 -12
  18. data/lib/watobo/core/active_check.rb +72 -135
  19. data/lib/watobo/core/active_checks.rb +49 -58
  20. data/lib/watobo/core/ca.rb +369 -389
  21. data/lib/watobo/core/cert_store.rb +34 -43
  22. data/lib/watobo/core/chat.rb +92 -101
  23. data/lib/watobo/core/chats.rb +271 -280
  24. data/lib/watobo/core/client_cert_store.rb +106 -35
  25. data/lib/watobo/core/conversation.rb +48 -57
  26. data/lib/watobo/core/cookie.rb +23 -32
  27. data/lib/watobo/core/egress_handlers.rb +98 -0
  28. data/lib/watobo/core/finding.rb +66 -75
  29. data/lib/watobo/core/findings.rb +107 -114
  30. data/lib/watobo/core/forwarding_proxy.rb +13 -22
  31. data/lib/watobo/core/fuzz_gen.rb +0 -9
  32. data/lib/watobo/core/intercept_carver.rb +166 -177
  33. data/lib/watobo/core/intercept_filter.rb +235 -244
  34. data/lib/watobo/core/interceptor.rb +98 -107
  35. data/lib/watobo/core/min_class.rb +4 -13
  36. data/lib/watobo/core/netfilter_queue.rb +170 -179
  37. data/lib/watobo/core/ott_cache.rb +132 -141
  38. data/lib/watobo/core/parameter.rb +43 -52
  39. data/lib/watobo/core/passive_check.rb +103 -102
  40. data/lib/watobo/core/passive_checks.rb +48 -57
  41. data/lib/watobo/core/passive_scanner.rb +54 -55
  42. data/lib/watobo/core/plugin.rb +11 -20
  43. data/lib/watobo/core/project.rb +3 -9
  44. data/lib/watobo/core/proxy.rb +43 -52
  45. data/lib/watobo/core/request.rb +125 -123
  46. data/lib/watobo/core/response.rb +44 -53
  47. data/lib/watobo/core/scanner.rb +0 -9
  48. data/lib/watobo/core/scanner3.rb +405 -414
  49. data/lib/watobo/core/scope.rb +83 -92
  50. data/lib/watobo/core/session.rb +1043 -1026
  51. data/lib/watobo/core/sid_cache.rb +98 -107
  52. data/lib/watobo/core/subscriber.rb +25 -34
  53. data/lib/watobo/defaults.rb +21 -30
  54. data/lib/watobo/external/diff/lcs.rb +0 -9
  55. data/lib/watobo/external/diff/lcs/array.rb +0 -9
  56. data/lib/watobo/external/diff/lcs/block.rb +0 -9
  57. data/lib/watobo/external/diff/lcs/callbacks.rb +0 -9
  58. data/lib/watobo/external/diff/lcs/change.rb +0 -9
  59. data/lib/watobo/external/diff/lcs/hunk.rb +0 -9
  60. data/lib/watobo/external/diff/lcs/ldiff.rb +0 -9
  61. data/lib/watobo/external/diff/lcs/string.rb +0 -9
  62. data/lib/watobo/externals.rb +6 -15
  63. data/lib/watobo/framework.rb +4 -13
  64. data/lib/watobo/framework/create_project.rb +60 -69
  65. data/lib/watobo/framework/init.rb +0 -9
  66. data/lib/watobo/framework/init_modules.rb +0 -9
  67. data/lib/watobo/framework/license_text.rb +28 -37
  68. data/lib/watobo/framework/load_chat.rb +13 -22
  69. data/lib/watobo/gui.rb +132 -123
  70. data/lib/watobo/gui/about_watobo.rb +0 -9
  71. data/lib/watobo/gui/browser_preview.rb +0 -9
  72. data/lib/watobo/gui/certificate_dialog.rb +0 -9
  73. data/lib/watobo/gui/chat_diff.rb +0 -9
  74. data/lib/watobo/gui/chatviewer_frame.rb +73 -72
  75. data/lib/watobo/gui/checkboxtree.rb +0 -9
  76. data/lib/watobo/gui/checks_policy_frame.rb +0 -9
  77. data/lib/watobo/gui/client_cert_dialog.rb +96 -87
  78. data/lib/watobo/gui/confirm_scan_dialog.rb +0 -9
  79. data/lib/watobo/gui/conversation_table.rb +158 -164
  80. data/lib/watobo/gui/conversation_table_ctrl.rb +207 -216
  81. data/lib/watobo/gui/conversation_table_ctrl2.rb +373 -382
  82. data/lib/watobo/gui/csrf_token_dialog.rb +0 -9
  83. data/lib/watobo/gui/custom_viewer.rb +374 -383
  84. data/lib/watobo/gui/dashboard.rb +296 -303
  85. data/lib/watobo/gui/define_scope_frame.rb +0 -9
  86. data/lib/watobo/gui/differ_frame.rb +215 -224
  87. data/lib/watobo/gui/edit_comment.rb +0 -9
  88. data/lib/watobo/gui/edit_scope_dialog.rb +0 -9
  89. data/lib/watobo/gui/export_dialog.rb +104 -113
  90. data/lib/watobo/gui/finding_info.rb +0 -9
  91. data/lib/watobo/gui/findings_tree.rb +210 -217
  92. data/lib/watobo/gui/full_scan_dialog.rb +0 -9
  93. data/lib/watobo/gui/fuzzer_gui.rb +1295 -1313
  94. data/lib/watobo/gui/fxsave_thread.rb +14 -0
  95. data/lib/watobo/gui/goto_url_dialog.rb +70 -79
  96. data/lib/watobo/gui/hex_viewer.rb +0 -9
  97. data/lib/watobo/gui/html_viewer.rb +287 -296
  98. data/lib/watobo/gui/intercept_filter_dialog.rb +188 -197
  99. data/lib/watobo/gui/interceptor_gui.rb +1041 -1051
  100. data/lib/watobo/gui/interceptor_settings_dialog.rb +0 -9
  101. data/lib/watobo/gui/json_viewer.rb +287 -0
  102. data/lib/watobo/gui/list_box.rb +101 -110
  103. data/lib/watobo/gui/log_file_viewer.rb +32 -41
  104. data/lib/watobo/gui/log_viewer.rb +83 -88
  105. data/lib/watobo/gui/login_wizzard.rb +0 -9
  106. data/lib/watobo/gui/main_window.rb +587 -618
  107. data/lib/watobo/gui/manual_request_editor.rb +620 -565
  108. data/lib/watobo/gui/master_pw_dialog.rb +0 -9
  109. data/lib/watobo/gui/mixins/gui_settings.rb +29 -38
  110. data/lib/watobo/gui/page_tree.rb +217 -226
  111. data/lib/watobo/gui/password_policy_dialog.rb +0 -9
  112. data/lib/watobo/gui/plugin_board.rb +0 -9
  113. data/lib/watobo/gui/preferences_dialog.rb +0 -9
  114. data/lib/watobo/gui/progress_window.rb +17 -27
  115. data/lib/watobo/gui/project_wizzard.rb +0 -9
  116. data/lib/watobo/gui/proxy_dialog.rb +1 -10
  117. data/lib/watobo/gui/quick_scan_dialog.rb +0 -9
  118. data/lib/watobo/gui/request_builder_frame.rb +102 -111
  119. data/lib/watobo/gui/request_editor.rb +181 -137
  120. data/lib/watobo/gui/rewrite_filters_dialog.rb +394 -403
  121. data/lib/watobo/gui/rewrite_rules_dialog.rb +372 -381
  122. data/lib/watobo/gui/save_chat_dialog.rb +140 -149
  123. data/lib/watobo/gui/scanner_settings_dialog.rb +0 -9
  124. data/lib/watobo/gui/select_chat_dialog.rb +0 -9
  125. data/lib/watobo/gui/session_management_dialog.rb +0 -9
  126. data/lib/watobo/gui/sites_tree.rb +0 -9
  127. data/lib/watobo/gui/status_bar.rb +0 -9
  128. data/lib/watobo/gui/table_editor.rb +0 -9
  129. data/lib/watobo/gui/tagless_viewer.rb +0 -9
  130. data/lib/watobo/gui/templates/plugin.rb +0 -9
  131. data/lib/watobo/gui/templates/plugin2.rb +92 -100
  132. data/lib/watobo/gui/templates/plugin_base.rb +144 -153
  133. data/lib/watobo/gui/text_viewer.rb +0 -9
  134. data/lib/watobo/gui/transcoder_window.rb +0 -9
  135. data/lib/watobo/gui/utils/gui_utils.rb +0 -9
  136. data/lib/watobo/gui/utils/init_icons.rb +86 -95
  137. data/lib/watobo/gui/utils/load_icons.rb +33 -42
  138. data/lib/watobo/gui/utils/load_plugins.rb +116 -119
  139. data/lib/watobo/gui/utils/master_password.rb +68 -77
  140. data/lib/watobo/gui/utils/save_default_settings.rb +113 -122
  141. data/lib/watobo/gui/utils/save_project_settings.rb +0 -9
  142. data/lib/watobo/gui/utils/save_proxy_settings.rb +41 -50
  143. data/lib/watobo/gui/utils/save_scanner_settings.rb +18 -27
  144. data/lib/watobo/gui/utils/session_history.rb +112 -121
  145. data/lib/watobo/gui/workspace_dialog.rb +0 -9
  146. data/lib/watobo/gui/www_auth_dialog.rb +0 -9
  147. data/lib/watobo/gui/xml_viewer_frame.rb +0 -9
  148. data/lib/watobo/http.rb +4 -13
  149. data/lib/watobo/http/cookies/cookies.rb +26 -35
  150. data/lib/watobo/http/data/data.rb +45 -54
  151. data/lib/watobo/http/data/json.rb +47 -55
  152. data/lib/watobo/http/url/url.rb +38 -47
  153. data/lib/watobo/http/xml/xml.rb +124 -130
  154. data/lib/watobo/interceptor.rb +3 -12
  155. data/lib/watobo/interceptor/proxy.rb +742 -739
  156. data/lib/watobo/interceptor/transparent.rb +22 -24
  157. data/lib/watobo/mixins.rb +10 -19
  158. data/lib/watobo/mixins/check_info.rb +27 -36
  159. data/lib/watobo/mixins/httpparser.rb +613 -637
  160. data/lib/watobo/mixins/request_parser.rb +88 -97
  161. data/lib/watobo/mixins/shapers.rb +515 -529
  162. data/lib/watobo/mixins/transcoders.rb +3 -11
  163. data/lib/watobo/parser.rb +1 -10
  164. data/lib/watobo/parser/html.rb +83 -92
  165. data/lib/watobo/patch_fxruby_setfocus.rb +26 -0
  166. data/lib/watobo/sockets.rb +3 -12
  167. data/lib/watobo/sockets/agent.rb +828 -837
  168. data/lib/watobo/sockets/client_socket.rb +308 -312
  169. data/lib/watobo/sockets/connection.rb +401 -410
  170. data/lib/watobo/sockets/http_socket.rb +11 -13
  171. data/lib/watobo/sockets/ntlm_auth.rb +129 -138
  172. data/lib/watobo/utils.rb +10 -19
  173. data/lib/watobo/utils/check_regex.rb +0 -9
  174. data/lib/watobo/utils/copy_object.rb +0 -9
  175. data/lib/watobo/utils/crypto.rb +0 -9
  176. data/lib/watobo/utils/expand_range.rb +23 -32
  177. data/lib/watobo/utils/export_xml.rb +97 -106
  178. data/lib/watobo/utils/file_management.rb +9 -11
  179. data/lib/watobo/utils/hexprint.rb +9 -18
  180. data/lib/watobo/utils/load_chat.rb +0 -9
  181. data/lib/watobo/utils/load_icon.rb +0 -9
  182. data/lib/watobo/utils/ntlm.rb +866 -875
  183. data/lib/watobo/utils/print_debug.rb +12 -21
  184. data/lib/watobo/utils/response_builder.rb +90 -99
  185. data/lib/watobo/utils/response_hash.rb +0 -9
  186. data/lib/watobo/utils/secure_eval.rb +0 -9
  187. data/lib/watobo/utils/strings.rb +10 -19
  188. data/lib/watobo/utils/text2request.rb +0 -9
  189. data/lib/watobo/utils/url.rb +23 -32
  190. data/lib/watobo/utils/utf16.rb +11 -20
  191. data/modules/active/Apache/mod_status.rb +0 -9
  192. data/modules/active/Apache/multiview.rb +151 -160
  193. data/modules/active/Flash/crossdomain.rb +0 -9
  194. data/modules/active/JWT/jwt_oauth2_none.rb +111 -0
  195. data/modules/active/cq5/cq5_default_selectors.rb +106 -115
  196. data/modules/active/cq5/cqp_user_enumeration.rb +125 -134
  197. data/modules/active/directories/dirwalker.rb +0 -9
  198. data/modules/active/discovery/fileextensions.rb +0 -9
  199. data/modules/active/discovery/http_methods.rb +0 -9
  200. data/modules/active/discovery/jsmapfiles.rb +79 -0
  201. data/modules/active/domino/domino_db.rb +68 -76
  202. data/modules/active/dotNET/custom_errors.rb +102 -111
  203. data/modules/active/dotNET/dotnet_files.rb +90 -99
  204. data/modules/active/fileinclusion/lfi_simple.rb +0 -9
  205. data/modules/active/jboss/jboss_basic.rb +0 -9
  206. data/modules/active/sap/business_objects.rb +51 -60
  207. data/modules/active/sap/its_commands.rb +0 -9
  208. data/modules/active/sap/its_service_parameter.rb +0 -9
  209. data/modules/active/sap/its_services.rb +0 -9
  210. data/modules/active/sap/its_xss.rb +0 -9
  211. data/modules/active/shell_shock/shell_shock.rb +139 -148
  212. data/modules/active/siebel/siebel_apps.rb +160 -169
  213. data/modules/active/sqlinjection/sql_boolean.rb +0 -9
  214. data/modules/active/sqlinjection/sql_numerical.rb +198 -0
  215. data/modules/active/sqlinjection/sqli_error.rb +0 -9
  216. data/modules/active/sqlinjection/sqli_timing.rb +220 -229
  217. data/modules/active/struts2/default_handler_ognl.rb +106 -115
  218. data/modules/active/struts2/include_params_ognl.rb +105 -114
  219. data/modules/active/xml/xml_xxe.rb +112 -123
  220. data/modules/active/xss/xss_ng.rb +214 -223
  221. data/modules/active/xss/xss_simple.rb +0 -9
  222. data/modules/passive/ajax.rb +68 -77
  223. data/modules/passive/autocomplete.rb +56 -65
  224. data/modules/passive/cookie_options.rb +0 -9
  225. data/modules/passive/cookie_xss.rb +0 -9
  226. data/modules/passive/detect_code.rb +0 -9
  227. data/modules/passive/detect_fileupload.rb +0 -9
  228. data/modules/passive/detect_infrastructure.rb +0 -9
  229. data/modules/passive/detect_one_time_tokens.rb +0 -9
  230. data/modules/passive/dirindexing.rb +0 -9
  231. data/modules/passive/disclosure_domino.rb +55 -64
  232. data/modules/passive/disclosure_emails.rb +0 -9
  233. data/modules/passive/disclosure_ipaddr.rb +55 -53
  234. data/modules/passive/filename_as_parameter.rb +0 -9
  235. data/modules/passive/form_spotter.rb +0 -9
  236. data/modules/passive/hidden_fields.rb +50 -59
  237. data/modules/passive/hotspots.rb +0 -9
  238. data/modules/passive/in_script_parameter.rb +0 -9
  239. data/modules/passive/json_web_token.rb +93 -0
  240. data/modules/passive/multiple_server_headers.rb +0 -9
  241. data/modules/passive/possible_login.rb +0 -9
  242. data/modules/passive/redirect_url.rb +0 -9
  243. data/modules/passive/redirectionz.rb +0 -9
  244. data/modules/passive/sap-headers.rb +56 -65
  245. data/modules/passive/xss_dom.rb +0 -9
  246. data/plugins/aem/aem.rb +11 -20
  247. data/plugins/aem/gui/main.rb +118 -127
  248. data/plugins/aem/gui/tree_view.rb +171 -180
  249. data/plugins/aem/lib/agent.rb +130 -138
  250. data/plugins/aem/lib/dispatcher.rb +45 -51
  251. data/plugins/aem/lib/engine.rb +177 -186
  252. data/plugins/catalog/catalog.rb +345 -355
  253. data/plugins/crawler/crawler.rb +4 -13
  254. data/plugins/crawler/gui.rb +5 -14
  255. data/plugins/crawler/gui/auth_frame.rb +270 -279
  256. data/plugins/crawler/gui/crawler_gui.rb +271 -276
  257. data/plugins/crawler/gui/general_settings_frame.rb +96 -105
  258. data/plugins/crawler/gui/hooks_frame.rb +80 -89
  259. data/plugins/crawler/gui/scope_frame.rb +50 -59
  260. data/plugins/crawler/gui/settings_tabbook.rb +38 -47
  261. data/plugins/crawler/gui/status_frame.rb +59 -68
  262. data/plugins/crawler/lib/bags.rb +18 -27
  263. data/plugins/crawler/lib/constants.rb +11 -20
  264. data/plugins/crawler/lib/engine.rb +488 -497
  265. data/plugins/crawler/lib/grabber.rb +68 -77
  266. data/plugins/crawler/lib/status.rb +71 -80
  267. data/plugins/crawler/lib/uri_mp.rb +12 -21
  268. data/plugins/filefinder/filefinder.rb +326 -333
  269. data/plugins/sqlmap/bin/test.rb +78 -87
  270. data/plugins/sqlmap/gui.rb +4 -13
  271. data/plugins/sqlmap/gui/main.rb +218 -227
  272. data/plugins/sqlmap/gui/options_frame.rb +97 -106
  273. data/plugins/sqlmap/lib/sqlmap_ctrl.rb +90 -100
  274. data/plugins/sqlmap/sqlmap.rb +2 -11
  275. data/plugins/sslchecker/cli/sslchecker_cli.rb +0 -9
  276. data/plugins/sslchecker/gui/cipher_table.rb +246 -254
  277. data/plugins/sslchecker/gui/gui.rb +258 -264
  278. data/plugins/sslchecker/gui/sslchecker.rb +4 -13
  279. data/plugins/sslchecker/lib/check.rb +127 -133
  280. data/plugins/wshell/gui/main.rb +119 -117
  281. data/plugins/wshell/lib/core.rb +38 -88
  282. data/plugins/wshell/wshell.rb +11 -20
  283. 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( owner, 'Progress Bar', nil, nil, DECOR_BORDER, 0, 0, 300, 100, 0, 0, 0, 0, 0, 0)
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
- add_update_timer(50)
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
- @acceptBtn.disable
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 highlight(pattern)
50
- # @text_edit.highlight(pattern)
51
- end
48
+ def parseRequest
52
49
 
53
- def rawRequest
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) # FXColor::White
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) # FXColor::White
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, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
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 = [ hs_green, hs_red]
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 = ( @textbox.textStyle & TEXT_WORDWRAP > 0 ) ? true : false
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 = ( @textbox.font == @small_font ) ? false : true
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
- @textbox.font = @big_font
136
+ @textbox.font = @big_font
146
137
  else
147
- @textbox.font = @small_font
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
- filtered.push line
178
+ filtered.push line
189
179
  end
190
180
  rescue => bang
191
- puts
192
- puts bang
193
- pattern = Regexp.quote(pattern)
194
- retry
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
- puts "outch"
216
- puts bang
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 > ( @pattern_matches.length - 1 )
215
+ return false if match_index > (@pattern_matches.length - 1)
226
216
  if @pattern_matches[match_index] then
227
- pos = @pattern_matches[match_index][0]
228
- len =@pattern_matches[match_index][1]
217
+ pos = @pattern_matches[match_index][0]
218
+ len =@pattern_matches[match_index][1]
229
219
 
230
- @textbox.setCenterLine(pos)
220
+ @textbox.setCenterLine(pos)
231
221
 
232
- # @textbox.makePositionVisible(pos + len)
233
- @textbox.makePositionVisible(@textbox.lineEnd(pos))
234
- @textbox.makePositionVisible(pos)
222
+ # @textbox.makePositionVisible(pos + len)
223
+ @textbox.makePositionVisible(@textbox.lineEnd(pos))
224
+ @textbox.makePositionVisible(pos)
235
225
 
236
- @textbox.setCursorPos(pos)
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 [ start, len] if start >= 0
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
- # if @max_len > 0 and @max_len < text.length
277
- # text = text[0..@max_len] + "\n---8<--- WATOBO ---8<---\n* PRESS RESET TO SEE FULL RESPONSE *"
278
- # end
279
- # text.encode('iso_8859_1')
280
- # UTF-8 CleanUp
281
- text = text.unpack("C*").pack("C*")
282
- text.gsub!(/\x0d/u, '')
283
- r = Regexp.new '[\x00-\x09\x0b-\x1f\x7f-\xff]+', nil, 'n'
284
- text.gsub!(r,'.')
285
- @textbox.setText(text)
286
- return true
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
- t = text
306
- return "" if text.nil?
307
- t = text.join if text.is_a? Array
308
- t = t.unpack("C*").pack("C*")
309
- t.gsub!(/\x0d/, '')
310
-
311
- r = Regexp.new '[\x00-\x09\x0b-\x1f\x7f-\xff]+', nil, 'n'
312
- t.gsub!( r ,'.')
313
- return t
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
- puts e
330
- puts e.backtrace
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
- FXMenuCaption.new(menu_pane,"- Insert -")
358
- FXMenuSeparator.new(menu_pane)
359
- eh = FXMenuCommand.new(menu_pane,"File")
360
- eh.connect(SEL_COMMAND) {
361
- insf = FXFileDialog.getOpenFilename(self, "Select file to insert", nil)
362
- if insf != "" then
363
- if File.exists?(insf) then
364
- # puts "Inserting #{insf}"
365
- sender.insertText(cpos, "%%File.read('#{insf}')%%")
366
- end
367
- end
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
- @ctrl_pressed = true if event.code == KEY_Control_L or event.code == KEY_Control_R
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
- if event.code == KEY_F1
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
- [ "<ctrl-enter> - Send Request",
399
- "<ctrl-b> - Encode Base64",
400
- "<ctrl-shift-b> - Decode Base64",
401
- "<ctrl-u> - Encode URL",
402
- "<ctrl-shift-u> - Decode URL"
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
- end
415
- if @ctrl_pressed
440
+ elsif @ctrl_pressed
416
441
  if event.code == KEY_Return
417
- notify(:hotkey_ctrl_enter)
418
- true # special handling of KEY_Return, because we don't want a linebreak in textbox.
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
- when KEY_u
428
- CGI::escape(text)
429
- when KEY_h
430
- CGI::escapeHTML(text)
431
- when KEY_H
432
- CGI::unescapeHTML(text)
433
- when KEY_b
434
- Base64.strict_encode64(text)
435
- when KEY_U
436
- CGI::unescape(text)
437
- when KEY_B
438
- Base64.decode64(text)
439
- else
440
- text
441
- end
442
- text = normalizeText(rptxt)
443
- @textbox.replaceText(pos,len, text)
444
- @textbox.setSelection(pos, text.length)
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
- false
488
+ @keystate = false
447
489
  end
448
490
  else
449
- #puts "%04x" % event.code
450
- false
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
- false
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
- # puts bang.backtrace if $DEBUG
511
+ # puts bang.backtrace if $DEBUG
468
512
  notify(:error, "#{$!}")
469
513
  rescue => bang
470
- puts bang
471
- notify(:error, "Could not parse request: #{$!}")
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
- # else
493
- # @markers.each do |start, len|
494
- # if pos >= start and pos <= start + len then
495
- # @markers = highlight(pattern)
496
- # @textbox.setCursorPos(pos)
497
- # break
498
- # end
499
- # end
500
- # end
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
- puts "!!!ERROR: onTextChanged"
504
- puts bang
547
+ puts "!!!ERROR: onTextChanged"
548
+ puts bang
505
549
  end
506
550
  end
507
551
  end
508
552
 
509
- # -> # module Watobo::Gui
553
+ # -> # module Watobo::Gui
510
554
  end
511
555
  end