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
- # about_watobo.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
 
@@ -1,12 +1,3 @@
1
- #.
2
- # browser_preview.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
- # certificate_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
- # chat_diff.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
- # chatviewer_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
2
+ module Watobo #:nodoc: all
12
3
  module Gui
13
4
 
14
5
  SEL_TYPE_GREP = 0
@@ -16,6 +7,7 @@ module Watobo#:nodoc: all
16
7
  class TextViewer < FXVerticalFrame
17
8
 
18
9
  attr_accessor :max_len
10
+
19
11
  def style=(new_style)
20
12
  @simple_text_view.style = new_style
21
13
  end
@@ -25,24 +17,24 @@ module Watobo#:nodoc: all
25
17
  end
26
18
 
27
19
  def setText(text, prefs={})
28
-
20
+
29
21
  normalized_text = text
30
22
  if text.is_a? String
31
- normalized_text = text.gsub(/[^[:print:]]/,".")
23
+ normalized_text = text.gsub(/[^[:print:]]/, ".")
32
24
  elsif text.respond_to? :has_body?
33
25
  if text.content_type =~ /(xml)/
34
26
  doc = Nokogiri::XML(text.body, &:noblanks)
35
- fbody = doc.to_xhtml( indent:3, indent_text:" ")
36
- normalized_text = text.headers.map{|h| h.strip }.join("\n")
27
+ fbody = doc.to_xhtml(indent: 3, indent_text: " ")
28
+ normalized_text = text.headers.map { |h| h.strip }.join("\n")
37
29
  normalized_text << "\n\n"
38
30
  unless fbody.to_s.empty?
39
- normalized_text << fbody.to_s
31
+ normalized_text << fbody.to_s
40
32
  else
41
33
  normalized_text = text
42
34
  end
43
35
  end
44
36
  end
45
-
37
+
46
38
  @text = normalized_text
47
39
  #@text = text
48
40
  @simple_text_view.max_len = @max_len
@@ -78,7 +70,7 @@ module Watobo#:nodoc: all
78
70
  @text_dt = FXDataTarget.new('')
79
71
  @filter_dt = FXDataTarget.new('')
80
72
 
81
- text_view_header = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM|LAYOUT_FIX_HEIGHT,:height => 24, :padding => 0)
73
+ text_view_header = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM|LAYOUT_FIX_HEIGHT, :height => 24, :padding => 0)
82
74
 
83
75
  #@auto_apply_cbtn.connect(SEL_COMMAND, method(:onInterceptChanged))
84
76
 
@@ -94,7 +86,7 @@ module Watobo#:nodoc: all
94
86
  # :opts => FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y)
95
87
 
96
88
  @filter_text = FXComboBox.new(text_view_header, 20, @filter_dt, 0, FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
97
- @filter_text.connect(SEL_COMMAND){
89
+ @filter_text.connect(SEL_COMMAND) {
98
90
  applyFilter()
99
91
  addFilterHistory()
100
92
  }
@@ -104,27 +96,27 @@ module Watobo#:nodoc: all
104
96
  }
105
97
 
106
98
  menu = FXMenuPane.new(self)
107
- FXMenuCommand.new(menu, "&Highlight").connect(SEL_COMMAND){
99
+ FXMenuCommand.new(menu, "&Highlight").connect(SEL_COMMAND) {
108
100
  @filter_mode = SEL_TYPE_HIGHLIGHT
109
101
  applyFilter()
110
102
  @mode_btn.text = "Highlight"
111
- }#, method(:switchMethod))
112
- FXMenuCommand.new(menu, "&Grep").connect(SEL_COMMAND){
103
+ } #, method(:switchMethod))
104
+ FXMenuCommand.new(menu, "&Grep").connect(SEL_COMMAND) {
113
105
  @filter_mode = SEL_TYPE_GREP
114
106
  applyFilter()
115
107
  @mode_btn.text = "Grep"
116
- }#, method(:switchMethod))
108
+ } #, method(:switchMethod))
117
109
 
118
110
  @auto_apply_cbtn = FXCheckButton.new(text_view_header, "auto-apply", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|LAYOUT_RIGHT|LAYOUT_FILL_Y)
119
111
  @mode_btn = FXMenuButton.new(text_view_header, "Highlight", nil, menu,
120
- :opts=> MENUBUTTON_DOWN|FRAME_RAISED|FRAME_THICK|ICON_AFTER_TEXT|LAYOUT_RIGHT|LAYOUT_FILL_Y)
112
+ :opts => MENUBUTTON_DOWN|FRAME_RAISED|FRAME_THICK|ICON_AFTER_TEXT|LAYOUT_RIGHT|LAYOUT_FILL_Y)
121
113
 
122
114
  reset_button = FXButton.new(text_view_header, "&Reset", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_Y)
123
- reset_button.connect(SEL_COMMAND){ resetFilter() }
115
+ reset_button.connect(SEL_COMMAND) { resetFilter() }
124
116
 
125
117
  text_box_frame = FXVerticalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
126
118
 
127
- @simple_text_view = SimpleTextView.new(text_box_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y,:padding => 0)
119
+ @simple_text_view = SimpleTextView.new(text_box_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
128
120
  @simple_text_view.style = 1
129
121
  @simple_text_view.editable = false
130
122
  @simple_text_view.textStyle -= TEXT_WORDWRAP
@@ -144,10 +136,10 @@ module Watobo#:nodoc: all
144
136
  @match_pos_label.textColor = 'grey'
145
137
  return true if pattern == ''
146
138
  case @filter_mode
147
- when SEL_TYPE_GREP
148
- grepPattern(pattern)
149
- when SEL_TYPE_HIGHLIGHT
150
- highlightPattern(pattern)
139
+ when SEL_TYPE_GREP
140
+ grepPattern(pattern)
141
+ when SEL_TYPE_HIGHLIGHT
142
+ highlightPattern(pattern)
151
143
  end
152
144
  end
153
145
 
@@ -197,7 +189,6 @@ module Watobo#:nodoc: all
197
189
  @simple_text_view.makeMatchVisible(0)
198
190
 
199
191
  @match_pos_label.text = "1/#{@simple_text_view.numMatches()}" if @simple_text_view.numMatches() > 0
200
-
201
192
  end
202
193
 
203
194
  def grepPattern(pattern)
@@ -223,12 +214,12 @@ module Watobo#:nodoc: all
223
214
  @ctrl_pressed = false
224
215
 
225
216
  widget.connect(SEL_KEYPRESS) { |sender, sel, event|
226
- # puts event.code
217
+ # puts event.code
227
218
  @ctrl_pressed = true if event.code == KEY_Control_L or event.code == KEY_Control_R
228
219
  # @shift_pressed = true if @ctrl_pressed and ( event.code == KEY_Shift_L or event.code == KEY_Shift_R )
229
220
  if event.code == KEY_Return
230
221
  highlight(@filter_text.text)
231
- true # special handling of KEY_Return, because we don't want a linebreak in textbox.
222
+ true # special handling of KEY_Return, because we don't want a linebreak in textbox.
232
223
  end
233
224
 
234
225
  if event.code == KEY_F1
@@ -237,12 +228,12 @@ module Watobo#:nodoc: all
237
228
  FXMenuPane.new(self) do |menu_pane|
238
229
  FXMenuCaption.new(menu_pane, "Hotkeys:")
239
230
  FXMenuSeparator.new(menu_pane)
240
- [ "<ctrl-r> - Reset Filter",
241
- "<ctrl-g> - Grep",
242
- "<ctrl-h> - Highlight",
243
- "<ctrl-n> - Goto Next",
244
- "<ctrl-shift-n> - Goto Prev",
245
- "<ctrl-w> - Switch Wordwrap"
231
+ ["<ctrl-r> - Reset Filter",
232
+ "<ctrl-g> - Grep",
233
+ "<ctrl-h> - Highlight",
234
+ "<ctrl-n> - Goto Next",
235
+ "<ctrl-shift-n> - Goto Prev",
236
+ "<ctrl-w> - Switch Wordwrap"
246
237
  ].each do |hk|
247
238
  FXMenuCaption.new(menu_pane, hk).backColor = 'yellow'
248
239
  end
@@ -257,26 +248,26 @@ module Watobo#:nodoc: all
257
248
 
258
249
  if @ctrl_pressed
259
250
  case event.code
260
- when KEY_n
261
- gotoNextMatch()
262
- addFilterHistory()
263
- when KEY_N
264
- gotoPrevMatch()
265
- addFilterHistory()
266
- when KEY_w
267
- @simple_text_view.textbox.textStyle ^= TEXT_WORDWRAP
268
- when KEY_h
269
- @mode_btn.text = "Highlight"
270
- @filter_mode = SEL_TYPE_HIGHLIGHT
271
- addFilterHistory()
272
- applyFilter()
273
- when KEY_g
274
- @mode_btn.text = "Grep"
275
- @filter_mode = SEL_TYPE_GREP
276
- addFilterHistory()
277
- applyFilter()
278
- when KEY_r
279
- resetFilter()
251
+ when KEY_n
252
+ gotoNextMatch()
253
+ addFilterHistory()
254
+ when KEY_N
255
+ gotoPrevMatch()
256
+ addFilterHistory()
257
+ when KEY_w
258
+ @simple_text_view.textbox.textStyle ^= TEXT_WORDWRAP
259
+ when KEY_h
260
+ @mode_btn.text = "Highlight"
261
+ @filter_mode = SEL_TYPE_HIGHLIGHT
262
+ addFilterHistory()
263
+ applyFilter()
264
+ when KEY_g
265
+ @mode_btn.text = "Grep"
266
+ @filter_mode = SEL_TYPE_GREP
267
+ addFilterHistory()
268
+ applyFilter()
269
+ when KEY_r
270
+ resetFilter()
280
271
 
281
272
  end
282
273
  end
@@ -294,6 +285,7 @@ module Watobo#:nodoc: all
294
285
  class RequestViewer < FXVerticalFrame
295
286
 
296
287
  attr_accessor :max_len
288
+
297
289
  def setText(text)
298
290
  @text = text
299
291
  @textviewer.max_len = @max_len
@@ -336,7 +328,7 @@ module Watobo#:nodoc: all
336
328
  }
337
329
  textviewer_tab = FXTabItem.new(@tabBook, "Text", nil)
338
330
  tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
339
- @textviewer = TextViewer.new(tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y,:padding => 0)
331
+ @textviewer = TextViewer.new(tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
340
332
  @textviewer.style = 1
341
333
  @textviewer.editable = false
342
334
 
@@ -346,10 +338,15 @@ module Watobo#:nodoc: all
346
338
  tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
347
339
  @hexViewer = HexViewer.new(tab_frame)
348
340
  @viewers.push @hexViewer
349
-
341
+
350
342
  FXTabItem.new(@tabBook, "Table", nil)
351
343
  tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
352
344
  @viewers << Watobo::Gui::TableEditorFrame.new(tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
345
+
346
+ FXTabItem.new(@tabBook, "JSON", nil)
347
+ # tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
348
+ # @viewers << Watobo::Gui::TableEditorFrame.new(tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
349
+ @viewers << JsonViewer.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
353
350
  end
354
351
 
355
352
  end
@@ -359,15 +356,16 @@ module Watobo#:nodoc: all
359
356
  include Watobo::Gui::Utils
360
357
 
361
358
  attr_accessor :max_len, :auto_filter
359
+
362
360
  def setText(text, prefs={})
363
-
361
+
364
362
  @text = text
365
363
  @textviewer.max_len = @max_len
366
364
  index = @tabBook.current
367
365
 
368
366
  @viewers[index].setText(text)
369
- # @viewers.map{|v| v.setText(text)}
370
- # @textviewer.applyFilter if cp[:filter] == true
367
+ # @viewers.map{|v| v.setText(text)}
368
+ # @textviewer.applyFilter if cp[:filter] == true
371
369
 
372
370
  end
373
371
 
@@ -412,8 +410,8 @@ module Watobo#:nodoc: all
412
410
 
413
411
  textviewer_tab = FXTabItem.new(@tabBook, "Text", nil)
414
412
  tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
415
- @textviewer = TextViewer.new( tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
416
- # @textviewer = TextView2.new( tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
413
+ @textviewer = TextViewer.new(tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
414
+ # @textviewer = TextView2.new( tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
417
415
 
418
416
  @textviewer.style = 2
419
417
  @textviewer.editable = false
@@ -424,7 +422,7 @@ module Watobo#:nodoc: all
424
422
 
425
423
  taglessviewer_tab = FXTabItem.new(@tabBook, "Tagless", nil)
426
424
  tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
427
- tagless_frame = FXVerticalFrame.new(tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding=>0)
425
+ tagless_frame = FXVerticalFrame.new(tab_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
428
426
  #text_view_header = FXHorizontalFrame.new(tagless_frame, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM)
429
427
  @taglessviewer = TaglessViewer.new(tagless_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
430
428
  @viewers << @taglessviewer
@@ -433,17 +431,20 @@ module Watobo#:nodoc: all
433
431
  tab_frame = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
434
432
  @hexViewer = HexViewer.new(tab_frame)
435
433
  @viewers << @hexViewer
436
-
437
- FXTabItem.new(@tabBook, "HTML", nil)
434
+
435
+ FXTabItem.new(@tabBook, "HTML", nil)
438
436
  @html_viewer = HTMLViewerFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
439
437
  @viewers << @html_viewer
440
-
441
- FXTabItem.new(@tabBook, "Custom", nil)
438
+
439
+ FXTabItem.new(@tabBook, "Custom", nil)
442
440
  @viewers << CustomViewer.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
443
-
441
+
442
+ FXTabItem.new(@tabBook, "JSON", nil)
443
+ @viewers << JsonViewer.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
444
+
444
445
  end
445
446
 
446
447
  end
447
- ###################### end of namespace ############################
448
+ ###################### end of namespace ############################
448
449
  end
449
450
  end
@@ -1,12 +1,3 @@
1
- #.
2
- # checkboxtree.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
  if $0 == __FILE__
11
2
  inc_path = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
12
3
  $: << inc_path
@@ -1,12 +1,3 @@
1
- #.
2
- # checks_policy_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
2
  module Watobo#:nodoc: all
12
3
  module Gui
@@ -1,14 +1,5 @@
1
- #.
2
- # client_cert_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
- module Watobo#:nodoc: all
2
+ module Watobo #:nodoc: all
12
3
  module Gui
13
4
  class ClientCertDialog < FXDialogBox
14
5
  class PEMFrame < FXVerticalFrame
@@ -24,6 +15,12 @@ module Watobo#:nodoc: all
24
15
  client_cert[:ssl_client_key] = OpenSSL::PKey::RSA.new(File.read(@client_key_dt.value), @password_dt.value)
25
16
  end
26
17
 
18
+ client_cert[:password] = @password_dt.value
19
+
20
+ client_cert[:certificate_file] = @client_cert_dt.value
21
+ client_cert[:key_file] = @client_key_dt.value
22
+ client_cert[:type] = :pem
23
+
27
24
  return client_cert
28
25
  rescue => bang
29
26
  puts bang
@@ -34,30 +31,45 @@ module Watobo#:nodoc: all
34
31
 
35
32
  def settings
36
33
  s = {
37
- :certificate_file => @client_cert_dt.value,
38
- :password => @password_dt.value,
39
- :key_file => @client_key_dt.value
34
+ :certificate_file => @client_cert_dt.value,
35
+ :password => @password_dt.value,
36
+ :key_file => @client_key_dt.value
40
37
  }
41
38
  end
42
39
 
40
+ def update_fields(c)
41
+ unless c.nil?
42
+ @client_cert_dt.value = c[:certificate_file]
43
+ @cert_path = File.dirname(c[:certificate_file]) + '/'
44
+ @client_key_dt.value = c[:key_file]
45
+ @password_dt.value = c[:password].nil? ? '' : c[:password]
46
+ @retype_dt.value = c[:password].nil? ? '' : c[:password]
47
+ @client_cert_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
48
+ @client_key_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
49
+ @password_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
50
+ @retype_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
51
+ end
52
+ end
53
+
54
+
43
55
  def settings_valid?
44
56
  unless @password_dt.value.empty?
45
57
  puts "* password is set"
46
58
  if @password_dt.value != @retype_dt.value
47
59
  FXMessageBox.information(self, MBOX_OK, "Passwords", "Passwords don't match!")
48
- return false
60
+ return false
49
61
  end
50
- password = @password_dt.value
62
+ password = @password_dt.value
51
63
  end
52
64
 
53
65
  unless File.exist?(@client_cert_dt.value)
54
66
  FXMessageBox.information(self, MBOX_OK, "File not found", "#{@client_cert_dt.value} does not exist!")
55
- return false
67
+ return false
56
68
  end
57
69
 
58
70
  unless File.exist?(@client_key_dt.value)
59
71
  FXMessageBox.information(self, MBOX_OK, "File not found", "#{@client_key_dt.value} does not exist!")
60
- return false
72
+ return false
61
73
 
62
74
  end
63
75
  # last but not least check if private key can be accessed
@@ -65,7 +77,7 @@ module Watobo#:nodoc: all
65
77
  key = OpenSSL::PKey::RSA.new(File.open(@client_key_dt.value), password)
66
78
  rescue => bang
67
79
  FXMessageBox.information(self, MBOX_OK, "Wrong Password", "Could not open private key file. Wrong password?")
68
- return false
80
+ return false
69
81
  end
70
82
  true
71
83
  end
@@ -80,44 +92,44 @@ module Watobo#:nodoc: all
80
92
  matrix = FXMatrix.new(self, 3, :opts => MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y)
81
93
 
82
94
  FXLabel.new(matrix, "Certificate File:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
83
- @client_cert_txt = FXTextField.new(matrix, 25,
84
- :target => @client_cert_dt, :selector => FXDataTarget::ID_VALUE,
85
- :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)
95
+ @client_cert_txt = FXTextField.new(matrix, 25,
96
+ :target => @client_cert_dt, :selector => FXDataTarget::ID_VALUE,
97
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)
86
98
 
87
- FXButton.new(matrix, "Select").connect(SEL_COMMAND){ select_cert_file }
99
+ FXButton.new(matrix, "Select").connect(SEL_COMMAND) { select_cert_file }
88
100
 
89
101
  FXLabel.new(matrix, "Key File:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
90
102
  @client_key_txt = FXTextField.new(matrix, 25,
91
- :target => @client_key_dt, :selector => FXDataTarget::ID_VALUE,
92
- :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)
93
- FXButton.new(matrix, "Select").connect(SEL_COMMAND){ select_key_file }
103
+ :target => @client_key_dt, :selector => FXDataTarget::ID_VALUE,
104
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)
105
+ FXButton.new(matrix, "Select").connect(SEL_COMMAND) { select_key_file }
94
106
 
95
107
  # matrix = FXMatrix.new(main_frame, 2, :opts => MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y)
96
108
  FXLabel.new(matrix, "Password:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
97
109
  @password_txt = FXTextField.new(matrix, 25,
98
- :target => @password_dt, :selector => FXDataTarget::ID_VALUE,
99
- :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT|TEXTFIELD_PASSWD)
110
+ :target => @password_dt, :selector => FXDataTarget::ID_VALUE,
111
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT|TEXTFIELD_PASSWD)
100
112
 
101
- FXButton.new(matrix, "", :opts=>FRAME_NONE).disable
113
+ FXButton.new(matrix, "", :opts => FRAME_NONE).disable
102
114
 
103
115
  FXLabel.new(matrix, "Retype:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
104
116
  @retype_txt = FXTextField.new(matrix, 25,
105
- :target => @retype_dt, :selector => FXDataTarget::ID_VALUE,
106
- :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT|TEXTFIELD_PASSWD)
117
+ :target => @retype_dt, :selector => FXDataTarget::ID_VALUE,
118
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT|TEXTFIELD_PASSWD)
107
119
 
108
- FXButton.new(matrix, "", :opts=>FRAME_NONE).disable
120
+ FXButton.new(matrix, "", :opts => FRAME_NONE).disable
109
121
 
110
122
  end
111
123
 
112
124
  private
113
125
 
114
126
  def select_cert_file()
115
- cert_filename = FXFileDialog.getOpenFilename(self, "Select Certificate File", @cert_path, "*.pem\n*")
127
+ cert_filename = FXFileDialog.getOpenFilename(self, "Select Certificate File", @cert_path, "*.pem,*.cer\n*")
116
128
  if cert_filename != "" then
117
129
  if File.exists?(cert_filename) then
118
130
  @client_cert_dt.value = cert_filename
119
131
  @client_cert_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
120
- @cert_path = File.dirname(cert_filename)
132
+ @cert_path = File.dirname(cert_filename) + '/'
121
133
  end
122
134
  end
123
135
  end
@@ -129,7 +141,7 @@ module Watobo#:nodoc: all
129
141
  if File.exists?(key_filename) then
130
142
  @client_key_dt.value = key_filename
131
143
  @client_key_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
132
- @cert_path = File.dirname(key_filename)
144
+ @cert_path = File.dirname(key_filename) + '/'
133
145
  end
134
146
  end
135
147
  end
@@ -142,17 +154,18 @@ module Watobo#:nodoc: all
142
154
  password = @password_dt.value
143
155
 
144
156
  begin
145
- puts "* open certfile: #{@client_cert_dt.value}"
146
157
  if File.exist?(@client_cert_dt.value)
147
158
  p12_data = nil
148
- File.open(@client_cert_dt.value, "rb"){|fh|
159
+ File.open(@client_cert_dt.value, "rb") { |fh|
149
160
  p12_data = fh.read
150
161
  }
151
- p12 = OpenSSL::PKCS12.new( p12_data, password)
152
- puts p12.certificate
162
+ p12 = OpenSSL::PKCS12.new(p12_data, password)
153
163
  client_cert[:ssl_client_cert] = p12.certificate
154
164
  client_cert[:ssl_client_key] = p12.key
155
- client_cert[:extra_chain_certs] = p12.ca_certs
165
+ client_cert[:extra_chain_certs] = p12.ca_certs
166
+ client_cert[:certificate_file] = @client_cert_dt.value
167
+ client_cert[:password] = password
168
+ client_cert[:type] = :pkcs12
156
169
 
157
170
  end
158
171
 
@@ -164,19 +177,31 @@ puts "* open certfile: #{@client_cert_dt.value}"
164
177
  return nil
165
178
  end
166
179
 
180
+ def update_fields(c)
181
+ unless c.nil?
182
+ @client_cert_dt.value = c[:certificate_file]
183
+ @cert_path = File.dirname(c[:certificate_file]) + '/'
184
+ @password_dt.value = c[:password].nil? ? '' : c[:password]
185
+ @retype_dt.value = c[:password].nil? ? '' : c[:password]
186
+ @client_cert_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
187
+ @password_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
188
+ @retype_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
189
+ end
190
+ end
191
+
167
192
  def settings_valid?
168
193
  unless @password_dt.value.empty?
169
194
  puts "* password is set"
170
195
  if @password_dt.value != @retype_dt.value
171
196
  FXMessageBox.information(self, MBOX_OK, "Passwords", "Passwords don't match!")
172
- return false
197
+ return false
173
198
  end
174
- password = @password_dt.value
199
+ password = @password_dt.value
175
200
  end
176
201
 
177
202
  unless File.exist?(@client_cert_dt.value)
178
203
  FXMessageBox.information(self, MBOX_OK, "File not found", "#{@client_cert_dt.value} does not exist!")
179
- return false
204
+ return false
180
205
  end
181
206
 
182
207
  true
@@ -184,8 +209,8 @@ puts "* open certfile: #{@client_cert_dt.value}"
184
209
 
185
210
  def settings
186
211
  s = {
187
- :certificate_file => @client_cert_dt.value,
188
- :password => @password_dt.value
212
+ :certificate_file => @client_cert_dt.value,
213
+ :password => @password_dt.value
189
214
  }
190
215
  end
191
216
 
@@ -199,25 +224,25 @@ puts "* open certfile: #{@client_cert_dt.value}"
199
224
  matrix = FXMatrix.new(self, 3, :opts => MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y)
200
225
 
201
226
  FXLabel.new(matrix, "PKCS12 File:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
202
- @client_cert_txt = FXTextField.new(matrix, 25,
203
- :target => @client_cert_dt, :selector => FXDataTarget::ID_VALUE,
204
- :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)
227
+ @client_cert_txt = FXTextField.new(matrix, 25,
228
+ :target => @client_cert_dt, :selector => FXDataTarget::ID_VALUE,
229
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)
205
230
 
206
- FXButton.new(matrix, "Select").connect(SEL_COMMAND){ select_cert_file }
231
+ FXButton.new(matrix, "Select").connect(SEL_COMMAND) { select_cert_file }
207
232
 
208
233
  FXLabel.new(matrix, "Password:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
209
234
  @password_txt = FXTextField.new(matrix, 25,
210
- :target => @password_dt, :selector => FXDataTarget::ID_VALUE,
211
- :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT|TEXTFIELD_PASSWD)
235
+ :target => @password_dt, :selector => FXDataTarget::ID_VALUE,
236
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT|TEXTFIELD_PASSWD)
212
237
 
213
- FXButton.new(matrix, "", :opts=>FRAME_NONE).disable
238
+ FXButton.new(matrix, "", :opts => FRAME_NONE).disable
214
239
 
215
240
  FXLabel.new(matrix, "Retype:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
216
241
  @retype_txt = FXTextField.new(matrix, 25,
217
- :target => @retype_dt, :selector => FXDataTarget::ID_VALUE,
218
- :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT|TEXTFIELD_PASSWD)
242
+ :target => @retype_dt, :selector => FXDataTarget::ID_VALUE,
243
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT|TEXTFIELD_PASSWD)
219
244
 
220
- FXButton.new(matrix, "", :opts=>FRAME_NONE).disable
245
+ FXButton.new(matrix, "", :opts => FRAME_NONE).disable
221
246
 
222
247
  end
223
248
 
@@ -246,7 +271,7 @@ puts "* open certfile: #{@client_cert_dt.value}"
246
271
 
247
272
  def savePasswords?()
248
273
  return false
249
- #@save_pws_cbt.checked?
274
+ #@save_pws_cbt.checked?
250
275
  end
251
276
 
252
277
  include Responder
@@ -257,15 +282,12 @@ puts "* open certfile: #{@client_cert_dt.value}"
257
282
  FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)
258
283
 
259
284
  @password_policy = {
260
- :save_passwords => false
285
+ :save_passwords => false
261
286
  }
262
287
 
263
288
  @cert_path = nil
264
289
  @client_certificates = {}
265
290
 
266
- current_certs = Watobo.project.getClientCertificates
267
- @client_certificates = current_certs unless current_certs.nil?
268
-
269
291
  @password_policy.update prefs[:password_policy] if prefs.has_key? :password_policy
270
292
 
271
293
  @site_dt = FXDataTarget.new('')
@@ -279,8 +301,8 @@ puts "* open certfile: #{@client_cert_dt.value}"
279
301
 
280
302
  @scope_only_cb.connect(SEL_COMMAND) { updateSitesCombo() }
281
303
 
282
- @sites_combo = FXComboBox.new(frame, 5, @site_dt, FXDataTarget::ID_VALUE,
283
- COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
304
+ @sites_combo = FXComboBox.new(frame, 5, @site_dt, FXDataTarget::ID_VALUE,
305
+ COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
284
306
 
285
307
  @sites_combo.numVisible = @sites_combo.numItems >= 20 ? 20 : @sites_combo.numItems
286
308
  @sites_combo.numColumns = 25
@@ -302,14 +324,14 @@ puts "* open certfile: #{@client_cert_dt.value}"
302
324
  @cert_settings << PKCS12Frame.new(@tabBook)
303
325
 
304
326
  buttons = FXHorizontalFrame.new(main_frame, :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,
305
- :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)
327
+ :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)
306
328
 
307
329
  accept = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT,
308
- FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
330
+ FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
309
331
  accept.enable
310
332
  # Cancel
311
333
  FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL,
312
- FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
334
+ FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
313
335
  end
314
336
 
315
337
  private
@@ -318,8 +340,8 @@ puts "* open certfile: #{@client_cert_dt.value}"
318
340
  @sites_combo.clearItems
319
341
  @sites_combo.appendItem(NO_SELECTION, nil)
320
342
  @site_dt.value = NO_SELECTION
321
- Watobo::Chats.sites(:in_scope => @scope_only_cb.checked? ){ |site|
322
- #puts "Site: #{site}"
343
+ Watobo::Chats.sites(:in_scope => @scope_only_cb.checked?) { |site|
344
+ #puts "Site: #{site}"
323
345
  @sites_combo.appendItem(site, site)
324
346
  }
325
347
  @sites_combo.numVisible = @sites_combo.numItems >= 20 ? 20 : @sites_combo.numItems
@@ -339,40 +361,27 @@ puts "* open certfile: #{@client_cert_dt.value}"
339
361
  end
340
362
  end
341
363
 
342
- def updateFields()
343
- # @sites_combo.handle(self, FXSEL(SEL_UPDATE, 1), nil)
344
- @client_cert_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
345
- @client_key_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
346
- end
347
-
348
364
  def update_fields(sender, sel, item)
349
365
  @site_dt.value = item
350
- if @client_certificates.has_key? item
351
- #puts "* certs found"
352
- #c = @client_certificates[item]
353
- # @client_cert_dt.value = c[:certificate_file]
354
- # @client_key_dt.value = c[:key_file]
355
- # @password_dt.value = c[:password]
356
- # @retype_dt.value = c[:password]
357
- # @client_cert_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
358
- # @client_key_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
359
- # @password_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
360
- # @retype_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
361
- end
366
+ c = Watobo::ClientCertStore.get(item)
367
+ return false if c.nil?
368
+ i = c[:type] == :pem ? 0 : 1
369
+ @tabBook.current = i
370
+ @cert_settings[i].update_fields c
371
+
362
372
  end
363
373
 
364
374
  def onAccept(sender, sel, event)
365
-
366
375
  password = nil
367
376
  if @site_dt.value.empty? or @site_dt.value == NO_SELECTION
368
377
  FXMessageBox.information(self, MBOX_OK, "No Site Selected", "You must select a site from the drop down list.")
369
- return 0
378
+ return 0
370
379
  end
371
380
 
372
381
  index = @tabBook.current
373
382
  unless @cert_settings[index].settings_valid?
374
383
  puts "Wrong settings"
375
- return 0
384
+ return 0
376
385
  end
377
386
 
378
387
  Watobo::ClientCertStore.set(@site_dt.value, @cert_settings[index].cert)