watobo 0.9.8.677

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. data/bin/watobo_gui.rb +39 -0
  2. data/certificates/cert.pem +19 -0
  3. data/certificates/privkey.pem +15 -0
  4. data/certificates/watobo_dh.key +5 -0
  5. data/config/datastore.yml +5 -0
  6. data/config/forwarding_proxy.yml +12 -0
  7. data/config/general.yml +4 -0
  8. data/config/gui.yml +23 -0
  9. data/config/interceptor.yml +16 -0
  10. data/config/scan_policy.yml +13 -0
  11. data/config/scanner.yml +34 -0
  12. data/icons/Add.ico +0 -0
  13. data/icons/Add_24x24.ico +0 -0
  14. data/icons/Bandwidth.ico +0 -0
  15. data/icons/Bandwidth_24x24.ico +0 -0
  16. data/icons/Mr. Bomb.ico +0 -0
  17. data/icons/Mr. Bomb_16x16.ico +0 -0
  18. data/icons/Mr. Bomb_24x24.ico +0 -0
  19. data/icons/Orange Ball.ico +0 -0
  20. data/icons/Orange Ball_16x16.ico +0 -0
  21. data/icons/Orange Ball_24x24.ico +0 -0
  22. data/icons/Pause.ico +0 -0
  23. data/icons/Play.ico +0 -0
  24. data/icons/Play_24x24.ico +0 -0
  25. data/icons/Red Ball.ico +0 -0
  26. data/icons/Red Ball_16x16.ico +0 -0
  27. data/icons/Red Ball_24x24.ico +0 -0
  28. data/icons/Run.ico +0 -0
  29. data/icons/Stop.ico +0 -0
  30. data/icons/Stop_24x24.ico +0 -0
  31. data/icons/Terminal.ico +0 -0
  32. data/icons/Transfer.ico +0 -0
  33. data/icons/Transfer_16x16.ico +0 -0
  34. data/icons/User.ico +0 -0
  35. data/icons/User_16x16.ico +0 -0
  36. data/icons/User_24x24.ico +0 -0
  37. data/icons/Web Browser.ico +0 -0
  38. data/icons/Web Browser_16x16.ico +0 -0
  39. data/icons/Write Document.ico +0 -0
  40. data/icons/Yellow Ball.ico +0 -0
  41. data/icons/Yellow Ball_16x16.ico +0 -0
  42. data/icons/Yellow Ball_24x24.ico +0 -0
  43. data/icons/advanced.ico +0 -0
  44. data/icons/advanced_16x16.ico +0 -0
  45. data/icons/advanced_24x24.ico +0 -0
  46. data/icons/applications.ico +0 -0
  47. data/icons/applications_16x16.ico +0 -0
  48. data/icons/applications_24x24.ico +0 -0
  49. data/icons/browser_16x16.ico +0 -0
  50. data/icons/browser_24x24.ico +0 -0
  51. data/icons/burn.ico +0 -0
  52. data/icons/burn_16x16.ico +0 -0
  53. data/icons/burn_24x24.ico +0 -0
  54. data/icons/calculator.ico +0 -0
  55. data/icons/calculator_24x24.ico +0 -0
  56. data/icons/cb_checked.ico +0 -0
  57. data/icons/cb_checked_orange.ico +0 -0
  58. data/icons/cb_unchecked.ico +0 -0
  59. data/icons/coin_24x24.ico +0 -0
  60. data/icons/conversation.ico +0 -0
  61. data/icons/conversation_24x24.ico +0 -0
  62. data/icons/engine.ico +0 -0
  63. data/icons/filter.ico +0 -0
  64. data/icons/folder.ico +0 -0
  65. data/icons/folder_16x16.ico +0 -0
  66. data/icons/fuzzer_16x16.ico +0 -0
  67. data/icons/fuzzer_24x24.ico +0 -0
  68. data/icons/go-down_16x16.png +0 -0
  69. data/icons/go-up_16x16.png +0 -0
  70. data/icons/help.ico +0 -0
  71. data/icons/help_16x16.ico +0 -0
  72. data/icons/help_24x24.ico +0 -0
  73. data/icons/iChat.ico +0 -0
  74. data/icons/iChat_16x16.ico +0 -0
  75. data/icons/iChat_24x24.ico +0 -0
  76. data/icons/icons.txt +3 -0
  77. data/icons/info.ico +0 -0
  78. data/icons/info_16x16.ico +0 -0
  79. data/icons/info_24x24.ico +0 -0
  80. data/icons/interceptor_24x24.ico +0 -0
  81. data/icons/lock.ico +0 -0
  82. data/icons/lock_12x12.ico +0 -0
  83. data/icons/lock_16x16.ico +0 -0
  84. data/icons/monitor.ico +0 -0
  85. data/icons/plugin.ico +0 -0
  86. data/icons/plugin_24x24.ico +0 -0
  87. data/icons/scan_16x16.png +0 -0
  88. data/icons/send.ico +0 -0
  89. data/icons/server.ico +0 -0
  90. data/icons/server_16x16.ico +0 -0
  91. data/icons/siberas_logo_x24.gif +0 -0
  92. data/icons/tag_blue_32x32.ico +0 -0
  93. data/icons/watobo-48x48.png +0 -0
  94. data/icons/watobo-logo.png +0 -0
  95. data/icons/watobo.ico +0 -0
  96. data/lib/watobo/adapters/data_store.rb +38 -0
  97. data/lib/watobo/adapters/file/file_store.rb +211 -0
  98. data/lib/watobo/adapters/session_store.rb +27 -0
  99. data/lib/watobo/adapters.rb +26 -0
  100. data/lib/watobo/config.rb +143 -0
  101. data/lib/watobo/constants.rb +92 -0
  102. data/lib/watobo/core/active_check.rb +404 -0
  103. data/lib/watobo/core/cookie.rb +69 -0
  104. data/lib/watobo/core/fuzz_gen.rb +160 -0
  105. data/lib/watobo/core/http_socket.rb +142 -0
  106. data/lib/watobo/core/interceptor.rb +729 -0
  107. data/lib/watobo/core/passive_check.rb +141 -0
  108. data/lib/watobo/core/project.rb +1058 -0
  109. data/lib/watobo/core/scanner.rb +396 -0
  110. data/lib/watobo/core/session.rb +1320 -0
  111. data/lib/watobo/core/simple_ca.rb +393 -0
  112. data/lib/watobo/core.rb +34 -0
  113. data/lib/watobo/defaults.rb +40 -0
  114. data/lib/watobo/external/diff/lcs/array.rb +42 -0
  115. data/lib/watobo/external/diff/lcs/block.rb +72 -0
  116. data/lib/watobo/external/diff/lcs/callbacks.rb +343 -0
  117. data/lib/watobo/external/diff/lcs/change.rb +190 -0
  118. data/lib/watobo/external/diff/lcs/hunk.rb +279 -0
  119. data/lib/watobo/external/diff/lcs/ldiff.rb +247 -0
  120. data/lib/watobo/external/diff/lcs/string.rb +40 -0
  121. data/lib/watobo/external/diff/lcs.rb +1124 -0
  122. data/lib/watobo/external/ntlm/ntlm.rb +797 -0
  123. data/lib/watobo/externals.rb +28 -0
  124. data/lib/watobo/framework/create_project.rb +55 -0
  125. data/lib/watobo/framework/init.rb +149 -0
  126. data/lib/watobo/framework/init_modules.rb +116 -0
  127. data/lib/watobo/framework/license_text.rb +50 -0
  128. data/lib/watobo/framework.rb +26 -0
  129. data/lib/watobo/gui/about_watobo.rb +68 -0
  130. data/lib/watobo/gui/browser_preview.rb +460 -0
  131. data/lib/watobo/gui/certificate_dialog.rb +132 -0
  132. data/lib/watobo/gui/chat_diff.rb +415 -0
  133. data/lib/watobo/gui/chatviewer_frame.rb +427 -0
  134. data/lib/watobo/gui/checkboxtree.rb +221 -0
  135. data/lib/watobo/gui/checks_policy_frame.rb +123 -0
  136. data/lib/watobo/gui/client_cert_dialog.rb +227 -0
  137. data/lib/watobo/gui/confirm_scan_dialog.rb +67 -0
  138. data/lib/watobo/gui/conversation_table.rb +386 -0
  139. data/lib/watobo/gui/conversation_table_ctrl.rb +175 -0
  140. data/lib/watobo/gui/csrf_token_dialog.rb +446 -0
  141. data/lib/watobo/gui/dashboard.rb +341 -0
  142. data/lib/watobo/gui/define_scope_frame.rb +380 -0
  143. data/lib/watobo/gui/edit_comment.rb +70 -0
  144. data/lib/watobo/gui/edit_scope_dialog.rb +69 -0
  145. data/lib/watobo/gui/finding_info.rb +212 -0
  146. data/lib/watobo/gui/findings_tree.rb +459 -0
  147. data/lib/watobo/gui/full_scan_dialog.rb +269 -0
  148. data/lib/watobo/gui/fuzzer_gui.rb +1522 -0
  149. data/lib/watobo/gui/hex_viewer.rb +106 -0
  150. data/lib/watobo/gui/interceptor_gui.rb +994 -0
  151. data/lib/watobo/gui/interceptor_settings_dialog.rb +201 -0
  152. data/lib/watobo/gui/log_viewer.rb +97 -0
  153. data/lib/watobo/gui/login_wizzard.rb +301 -0
  154. data/lib/watobo/gui/main_window.rb +1815 -0
  155. data/lib/watobo/gui/manual_request_editor.rb +1105 -0
  156. data/lib/watobo/gui/master_pw_dialog.rb +142 -0
  157. data/lib/watobo/gui/password_policy_dialog.rb +98 -0
  158. data/lib/watobo/gui/plugin/base.rb +82 -0
  159. data/lib/watobo/gui/plugin_board.rb +95 -0
  160. data/lib/watobo/gui/preferences_dialog.rb +116 -0
  161. data/lib/watobo/gui/progress_window.rb +102 -0
  162. data/lib/watobo/gui/project_wizzard.rb +369 -0
  163. data/lib/watobo/gui/proxy_dialog.rb +550 -0
  164. data/lib/watobo/gui/quick_scan_dialog.rb +242 -0
  165. data/lib/watobo/gui/request_editor.rb +480 -0
  166. data/lib/watobo/gui/save_chat_dialog.rb +158 -0
  167. data/lib/watobo/gui/scanner_settings_dialog.rb +360 -0
  168. data/lib/watobo/gui/select_chat_dialog.rb +169 -0
  169. data/lib/watobo/gui/session_management_dialog.rb +688 -0
  170. data/lib/watobo/gui/sites_tree.rb +347 -0
  171. data/lib/watobo/gui/status_bar.rb +88 -0
  172. data/lib/watobo/gui/table_editor.rb +445 -0
  173. data/lib/watobo/gui/tagless_viewer.rb +62 -0
  174. data/lib/watobo/gui/templates/plugin.rb +80 -0
  175. data/lib/watobo/gui/templates/plugin2.rb +103 -0
  176. data/lib/watobo/gui/text_viewer.rb +247 -0
  177. data/lib/watobo/gui/transcoder_window.rb +215 -0
  178. data/lib/watobo/gui/utils/gui_utils.rb +129 -0
  179. data/lib/watobo/gui/utils/init_icons.rb +106 -0
  180. data/lib/watobo/gui/utils/load_icons.rb +54 -0
  181. data/lib/watobo/gui/utils/load_plugins.rb +94 -0
  182. data/lib/watobo/gui/utils/master_password.rb +90 -0
  183. data/lib/watobo/gui/utils/save_default_settings.rb +99 -0
  184. data/lib/watobo/gui/utils/save_project_settings.rb +21 -0
  185. data/lib/watobo/gui/utils/save_proxy_settings.rb +45 -0
  186. data/lib/watobo/gui/utils/save_session_settings.rb +21 -0
  187. data/lib/watobo/gui/utils/session_history.rb +134 -0
  188. data/lib/watobo/gui/workspace_dialog.rb +89 -0
  189. data/lib/watobo/gui/www_auth_dialog.rb +348 -0
  190. data/lib/watobo/gui/xml_viewer_frame.rb +114 -0
  191. data/lib/watobo/gui.rb +139 -0
  192. data/lib/watobo/mixins/httpparser.rb +664 -0
  193. data/lib/watobo/mixins/request_parser.rb +210 -0
  194. data/lib/watobo/mixins/shapers.rb +345 -0
  195. data/lib/watobo/mixins/transcoders.rb +88 -0
  196. data/lib/watobo/mixins.rb +32 -0
  197. data/lib/watobo/utils/check_regex.rb +36 -0
  198. data/lib/watobo/utils/copy_object.rb +29 -0
  199. data/lib/watobo/utils/crypto.rb +74 -0
  200. data/lib/watobo/utils/expand_range.rb +45 -0
  201. data/lib/watobo/utils/file_management.rb +73 -0
  202. data/lib/watobo/utils/load_chat.rb +219 -0
  203. data/lib/watobo/utils/load_icon.rb +47 -0
  204. data/lib/watobo/utils/print_debug.rb +34 -0
  205. data/lib/watobo/utils/response_hash.rb +143 -0
  206. data/lib/watobo/utils/secure_eval.rb +57 -0
  207. data/lib/watobo/utils/text2request.rb +96 -0
  208. data/lib/watobo/utils.rb +32 -0
  209. data/lib/watobo.rb +76 -0
  210. data/modules/active/Apache/mod_status.rb +123 -0
  211. data/modules/active/Flash/crossdomain.rb +102 -0
  212. data/modules/active/directories/dirwalker.rb +89 -0
  213. data/modules/active/discovery/fileextensions.rb +151 -0
  214. data/modules/active/discovery/http_methods.rb +135 -0
  215. data/modules/active/domino/domino_db.lst +164 -0
  216. data/modules/active/domino/domino_db.rb +128 -0
  217. data/modules/active/fileinclusion/lfi_simple.rb +134 -0
  218. data/modules/active/jboss/jboss_basic.rb +119 -0
  219. data/modules/active/sap/business_objects.rb +73 -0
  220. data/modules/active/sap/its_commands.rb +101 -0
  221. data/modules/active/sap/its_service_parameter.rb +105 -0
  222. data/modules/active/sap/its_services.rb +103 -0
  223. data/modules/active/sap/its_xss.rb +98 -0
  224. data/modules/active/sqlinjection/sql_boolean.rb +262 -0
  225. data/modules/active/sqlinjection/sqli_simple.rb +205 -0
  226. data/modules/active/xss/xss_simple.rb +179 -0
  227. data/modules/passive/cookie_options.rb +97 -0
  228. data/modules/passive/cookie_xss.rb +85 -0
  229. data/modules/passive/detect_code.rb +89 -0
  230. data/modules/passive/detect_fileupload.rb +80 -0
  231. data/modules/passive/detect_infrastructure.rb +98 -0
  232. data/modules/passive/detect_one_time_tokens.rb +86 -0
  233. data/modules/passive/dirindexing.rb +81 -0
  234. data/modules/passive/disclosure_emails.rb +82 -0
  235. data/modules/passive/disclosure_ipaddr.rb +87 -0
  236. data/modules/passive/filename_as_parameter.rb +85 -0
  237. data/modules/passive/form_spotter.rb +75 -0
  238. data/modules/passive/hotspots.rb +86 -0
  239. data/modules/passive/in_script_parameter.rb +92 -0
  240. data/modules/passive/multiple_server_headers.rb +98 -0
  241. data/modules/passive/possible_login.rb +134 -0
  242. data/modules/passive/redirect_url.rb +88 -0
  243. data/modules/passive/redirectionz.rb +96 -0
  244. data/modules/passive/xss_dom.rb +91 -0
  245. data/plugins/catalog/catalog.ico +0 -0
  246. data/plugins/catalog/catalog.rb +726 -0
  247. data/plugins/catalog/db_tests +6483 -0
  248. data/plugins/catalog/db_variables +29 -0
  249. data/plugins/filefinder/dbs/hbci.db +12 -0
  250. data/plugins/filefinder/filefinder.rb +602 -0
  251. data/plugins/sslchecker/cli/sslchecker_cli.rb +21 -0
  252. data/plugins/sslchecker/gui/cipher_table.rb +260 -0
  253. data/plugins/sslchecker/gui/gui.rb +245 -0
  254. data/plugins/sslchecker/gui/sslchecker.rb +26 -0
  255. data/plugins/sslchecker/icons/green_16x16.ico +0 -0
  256. data/plugins/sslchecker/icons/grey_16x16.ico +0 -0
  257. data/plugins/sslchecker/icons/red_16x16.ico +0 -0
  258. data/plugins/sslchecker/icons/sslchecker.ico +0 -0
  259. data/plugins/sslchecker/lib/check.rb +117 -0
  260. metadata +317 -0
@@ -0,0 +1,445 @@
1
+ # .
2
+ # table_editor.rb
3
+ #
4
+ # Copyright 2012 by siberas, http://www.siberas.de
5
+ #
6
+ # This file is part of WATOBO (Web Application Tool Box)
7
+ # http://watobo.sourceforge.com
8
+ #
9
+ # WATOBO is free software; you can redistribute it and/or modify
10
+ # it under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation version 2 of the License.
12
+ #
13
+ # WATOBO is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with WATOBO; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ # .
22
+ module Watobo
23
+ module Gui
24
+ class AddTableParmDialog < FXDialogBox
25
+ def location()
26
+ @location_combo.getItemData(@location_combo.currentItem)
27
+ end
28
+
29
+ def parmName()
30
+ @parm_name_dt.value
31
+ end
32
+
33
+ def parmValue()
34
+ @parm_value_dt.value
35
+ end
36
+
37
+ def initialize(owner)
38
+ #super(owner, "Edit Target Scope", DECOR_TITLE|DECOR_BORDER, :width => 300, :height => 425)
39
+ super(owner, "Add Parameter", DECOR_ALL)
40
+
41
+ @location = nil
42
+ @pname = nil
43
+ @pval = nil
44
+
45
+ base_frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
46
+ frame = FXHorizontalFrame.new(base_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
47
+
48
+ # puts "create scopeframe with scope:"
49
+ # @project.scope
50
+ FXLabel.new(frame, "Method:")
51
+ @location_combo = FXComboBox.new(frame, 5, nil, 0,
52
+ COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
53
+ %w( Post Url Cookie ).each do |loc|
54
+ item = @location_combo.appendItem(loc)
55
+ @location_combo.setItemData(item, loc)
56
+ end
57
+
58
+ @location_combo.numVisible = 3
59
+ @location_combo.numColumns = 8
60
+ @location_combo.currentItem = 0
61
+ @location_combo.editable = false
62
+ # @location_combo.connect(SEL_COMMAND, method(:onLocationChanged))
63
+
64
+ FXLabel.new(frame, "Parameter:")
65
+ @parm_name_dt = FXDataTarget.new('')
66
+ FXTextField.new(frame, 15,
67
+ :target => @parm_name_dt, :selector => FXDataTarget::ID_VALUE,
68
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)
69
+
70
+ FXLabel.new(frame, "Value:")
71
+ @parm_value_dt = FXDataTarget.new('')
72
+ FXTextField.new(frame, 15,
73
+ :target => @parm_value_dt, :selector => FXDataTarget::ID_VALUE,
74
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)
75
+
76
+ buttons_frame = FXHorizontalFrame.new(base_frame,
77
+ :opts => LAYOUT_FILL_X|LAYOUT_SIDE_TOP)
78
+
79
+ @finishButton = FXButton.new(buttons_frame, "Accept" , nil, nil, :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
80
+ @finishButton.enable
81
+ @finishButton.connect(SEL_COMMAND) do |sender, sel, item|
82
+ #self.handle(self, FXSEL(SEL_COMMAND, ID_CANCEL), nil)
83
+ self.handle(self, FXSEL(SEL_COMMAND, ID_ACCEPT), nil)
84
+ end
85
+
86
+ @cancelButton = FXButton.new(buttons_frame, "Cancel" ,
87
+ :target => self, :selector => FXDialogBox::ID_CANCEL,
88
+ :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
89
+
90
+ end
91
+
92
+ end
93
+
94
+ class TableEditor < FXTable
95
+ def subscribe(event, &callback)
96
+ (@event_dispatcher_listeners[event] ||= []) << callback
97
+ end
98
+
99
+ def clearEvents(event)
100
+ @event_dispatcher_listener[event].clear
101
+ end
102
+
103
+ def notify(event, *args)
104
+ if @event_dispatcher_listeners[event]
105
+ @event_dispatcher_listeners[event].each do |m|
106
+ m.call(*args) if m.respond_to? :call
107
+ end
108
+ end
109
+ end
110
+
111
+ def rawRequest
112
+ parseRequest
113
+ end
114
+
115
+ def parseRequest
116
+ cookies = []
117
+ post_parms = []
118
+ url_parms = []
119
+ url = ""
120
+
121
+ self.numRows.times do |i|
122
+ case self.getItemText(i, 0)
123
+ when /req/i
124
+ url = self.getItemText(i, 2)
125
+ when /post/i
126
+ val = self.getItemText(i, 1)
127
+ val += "="
128
+ val += self.getItemText(i, 2).strip
129
+ post_parms.push(val)
130
+ when /url/i
131
+ val = self.getItemText(i, 1)
132
+ val += "="
133
+ val += self.getItemText(i, 2).strip
134
+ url_parms.push(val)
135
+ when /cookie2?/i
136
+ val = self.getItemText(i, 1)
137
+ val += "="
138
+ val += self.getItemText(i, 2).strip
139
+ cookies.push(val)
140
+ end
141
+ end
142
+
143
+ @request.setRawQueryParms(url_parms.join("&")) unless url_parms.empty?
144
+
145
+ @request.setData(post_parms.join("&")) unless post_parms.empty?
146
+
147
+ unless cookies.empty?
148
+ # puts cookies
149
+ @request.removeHeader("Cookie")
150
+ @request.addHeader("Cookie", cookies.join("; "))
151
+ end
152
+ # puts @request
153
+ @request
154
+ end
155
+
156
+ def setRequest(request)
157
+ @request = Watobo::Utils.copyObject(request)
158
+ # now extend the new request with the Watobo mixins
159
+ @request.extend Watobo::Mixin::Parser::Url
160
+ @request.extend Watobo::Mixin::Parser::Web10
161
+ @request.extend Watobo::Mixin::Shaper::Web10
162
+
163
+ initTable()
164
+ @request = Watobo::Utils.text2request(request) if request.is_a? String
165
+ # addParmList("REQ", ["URL=#{request.url}"])
166
+
167
+ if @request.get_parms.length > 0
168
+ addParmList("URL", @request.get_parms)
169
+ end
170
+
171
+ if @request.post_parms.length > 0
172
+ addParmList("Post", @request.post_parms)
173
+ end
174
+
175
+ if @request.cookies.length > 0
176
+ addParmList("Cookie", @request.cookies)
177
+ end
178
+
179
+ end
180
+
181
+ def initialize(owner, opts)
182
+ super(owner, opts)
183
+ @request = nil
184
+ @event_dispatcher_listeners = Hash.new
185
+ initTable()
186
+
187
+ self.connect(SEL_COMMAND, method(:onTableClick))
188
+
189
+ # KEY_Return
190
+ # KEY_Control_L
191
+ # KEY_Control_R
192
+ # KEY_s
193
+ @ctrl_pressed = false
194
+
195
+ addKeyHandler(self)
196
+
197
+ self.connect(SEL_DOUBLECLICKED) do |sender, sel, data|
198
+ row = sender.getCurrentRow
199
+ if row >= 0 then
200
+ self.selectRow(row, false)
201
+ # open simple editor
202
+ end
203
+ end
204
+
205
+ self.connect(SEL_DOUBLECLICKED) do |sender, sel, data|
206
+ row = sender.getCurrentRow
207
+ return nil unless row >= 0 and row < self.numRows
208
+ transcoder = FXTranscoder.new(FXApp.instance, self.getItemText(row, 2))
209
+ transcoder.create
210
+ transcoder.show(Fox::PLACEMENT_SCREEN)
211
+ end
212
+
213
+ self.connect(SEL_RIGHTBUTTONRELEASE) do |sender, sel, event|
214
+ unless event.moved?
215
+ self.cancelInput()
216
+ ypos = event.click_y
217
+ row = self.rowAtY(ypos)
218
+
219
+ next unless row >= 0 and row <= self.numRows
220
+
221
+ self.selectRow(row, false) if row < self.numRows
222
+ FXMenuPane.new(self) do |menu_pane|
223
+ if row < self.numRows
224
+ cell_value = self.getItemText(row, 2)
225
+ cell_value.extend Watobo::Mixin::Transcoders
226
+
227
+ parm_name = self.getItemText(row, 1)
228
+
229
+ FXMenuCaption.new(menu_pane,"- Decoder -")
230
+ FXMenuSeparator.new(menu_pane)
231
+ decodeB64 = FXMenuCommand.new(menu_pane,"Base64: #{cell_value.b64decode}")
232
+ decodeB64.connect(SEL_COMMAND) {
233
+ self.setItemText(row, 2, cell_value.b64decode)
234
+ }
235
+ decodeHex = FXMenuCommand.new(menu_pane,"Hex(A): #{cell_value.hexdecode}")
236
+ decodeHex.connect(SEL_COMMAND) {
237
+ self.setItemText(row, 2, cell_value.hexdecode)
238
+ }
239
+ hex2int = FXMenuCommand.new(menu_pane,"Hex(Int): #{cell_value.hex2int}")
240
+ hex2int.connect(SEL_COMMAND) {
241
+ self.setItemText(row, 2, cell_value.hex2int)
242
+ }
243
+ decodeURL = FXMenuCommand.new(menu_pane,"URL: #{cell_value.url_decode}")
244
+ decodeURL.connect(SEL_COMMAND) {
245
+ self.setItemText(row, 2, cell_value.url_decode)
246
+ }
247
+
248
+ FXMenuSeparator.new(menu_pane)
249
+ FXMenuCaption.new(menu_pane,"- Encoder -")
250
+ FXMenuSeparator.new(menu_pane)
251
+ encodeB64 = FXMenuCommand.new(menu_pane,"Base64: #{cell_value.b64encode}")
252
+ encodeB64.connect(SEL_COMMAND) {
253
+ self.setItemText(row, 2, cell_value.b64encode)
254
+ }
255
+ encodeHex = FXMenuCommand.new(menu_pane,"Hex: #{cell_value.hexencode}")
256
+ encodeHex.connect(SEL_COMMAND) {
257
+ self.setItemText(row, 2, cell_value.hexencode)
258
+ }
259
+ encodeURL = FXMenuCommand.new(menu_pane,"URL: #{cell_value.url_encode}")
260
+ encodeURL.connect(SEL_COMMAND) {
261
+ self.setItemText(row, 2, cell_value.url_encode)
262
+ }
263
+
264
+ FXMenuSeparator.new(menu_pane)
265
+ remRow = FXMenuCommand.new(menu_pane,"Remove: #{parm_name}")
266
+ remRow.connect(SEL_COMMAND) {
267
+ self.removeRows(row,1, true)
268
+ }
269
+ remRow = FXMenuCommand.new(menu_pane,"Add Parameter..")
270
+ remRow.connect(SEL_COMMAND) { addNewParm() }
271
+
272
+ elsif row >= 0
273
+ remRow = FXMenuCommand.new(menu_pane,"Add Parameter..")
274
+ remRow.connect(SEL_COMMAND) { addNewParm() }
275
+ end
276
+ menu_pane.create
277
+ menu_pane.popup(nil, event.root_x, event.root_y)
278
+ app.runModalWhileShown(menu_pane)
279
+ end
280
+
281
+ end
282
+
283
+ end
284
+
285
+ self.columnHeader.connect(SEL_COMMAND) do |sender, sel, index|
286
+ self.fitColumnsToContents(index)
287
+ end
288
+ end
289
+
290
+ private
291
+
292
+ def addNewParm()
293
+
294
+ dlg = AddTableParmDialog.new(self)
295
+ if dlg.execute != 0 then
296
+ loc = dlg.location
297
+ pname = dlg.parmName
298
+ pval = dlg.parmValue
299
+ addParmList(loc, ["#{pname}=#{pval}"])
300
+ end
301
+ end
302
+
303
+ def onTableClick(sender, sel, item)
304
+ begin
305
+ row = item.row
306
+ self.selectRow(row, false)
307
+ self.startInput(row,2)
308
+ rescue => bang
309
+ puts bang
310
+ end
311
+ end
312
+
313
+ def addKeyHandler(item)
314
+ item.connect(SEL_KEYPRESS) do |sender, sel, event|
315
+ cr = self.currentRow
316
+ @ctrl_pressed = true if event.code == KEY_Control_L or event.code == KEY_Control_R
317
+ # @shift_pressed = true if @ctrl_pressed and ( event.code == KEY_Shift_L or event.code == KEY_Shift_R )
318
+ if event.code == KEY_F1
319
+ unless event.moved?
320
+ FXMenuPane.new(self) do |menu_pane|
321
+ FXMenuCaption.new(menu_pane, "Hotkeys:")
322
+ FXMenuSeparator.new(menu_pane)
323
+ [ "<ctrl-enter> - Send Request",
324
+ "<ctrl-b> - Encode Base64",
325
+ "<ctrl-shift-b> - Decode Base64",
326
+ "<ctrl-u> - Encode URL",
327
+ "<ctrl-shift-u> - Decode URL"
328
+ ].each do |hk|
329
+ FXMenuCaption.new(menu_pane, hk)
330
+ end
331
+
332
+ menu_pane.create
333
+
334
+ menu_pane.popup(nil, event.root_x, event.root_y)
335
+ app.runModalWhileShown(menu_pane)
336
+ end
337
+
338
+ end
339
+ end
340
+ if @ctrl_pressed
341
+ # special handling of KEY_Return, because we don't want a linebreak in textbox.
342
+ if event.code == KEY_Return
343
+ self.acceptInput(true)
344
+ notify(:hotkey_ctrl_enter)
345
+ true
346
+ else
347
+ notify(:hotkey_ctrl_f) if event.code == KEY_f
348
+ notify(:hotkey_ctrl_s) if event.code == KEY_s
349
+
350
+ if event.code == KEY_u
351
+ text = self.getItemText(cr, 2)
352
+ #puts "* Encode URL: #{text}"
353
+ cgi = CGI::escape(text)
354
+ self.acceptInput(true)
355
+ self.setItemText(cr, 2, cgi.strip, true)
356
+ end
357
+
358
+ if event.code == KEY_b
359
+ text = self.getItemText(cr, 2)
360
+ puts "* Encode B64: #{text}"
361
+ b64 = Base64.encode64(text)
362
+ self.acceptInput(true)
363
+ self.setItemText(cr, 2, b64.strip, true)
364
+ puts b64.class
365
+ end
366
+
367
+ puts "CTRL-SHIFT-U" if event.code == KEY_U
368
+ if event.code == KEY_U
369
+
370
+ text = self.getItemText(cr, 2)
371
+ puts "* Encode URL: #{text}"
372
+ uncgi = CGI::unescape(text)
373
+ self.acceptInput(true)
374
+ self.setItemText(cr, 2, uncgi.strip, true)
375
+ end
376
+ if event.code == KEY_B
377
+ text = self.getItemText(cr, 2)
378
+ puts "* Encode B64: #{text}"
379
+ b64 = Base64.decode64(text)
380
+ self.acceptInput(true)
381
+ self.setItemText(cr, 2, b64.strip, true)
382
+ puts b64.class
383
+ end
384
+
385
+ false
386
+ end
387
+ elsif event.code == KEY_Return
388
+ self.selectRow(cr)
389
+ startInput(cr,2)
390
+ true
391
+ else
392
+ #puts "%04x" % event.code
393
+ false
394
+ end
395
+ end
396
+
397
+ item.connect(SEL_KEYRELEASE) do |sender, sel, event|
398
+ @ctrl_pressed = false if event.code == KEY_Control_L or event.code == KEY_Control_R
399
+ false
400
+ end
401
+ end
402
+
403
+ def addParmList(parm_origin, parm_list)
404
+ parm_list.each do |parm|
405
+ p,v = parm.split("=")
406
+ lastRowIndex = self.getNumRows
407
+ self.appendRows(1)
408
+ self.setItemText(lastRowIndex, 0, parm_origin)
409
+ self.setItemText(lastRowIndex, 1, p)
410
+ self.setItemText(lastRowIndex, 2, v)
411
+ # self.fitColumnsToContents(2)
412
+ # item = getItem(lastRowIndex, 2)
413
+
414
+ 3.times do |i|
415
+ self.getItem(lastRowIndex, i).justify = FXTableItem::LEFT
416
+ end
417
+ end
418
+
419
+ end
420
+
421
+ def initTable
422
+ self.clearItems()
423
+ self.setTableSize(0, 3)
424
+
425
+ self.setColumnText( 0, "Location" )
426
+ self.setColumnText( 1, "Parm" )
427
+ self.setColumnText( 2, "Value" )
428
+ #self.setColumnText( 3, "Pinned" )
429
+ #self.setColumnText( 4, "Ignore" )
430
+
431
+ self.rowHeader.width = 0
432
+ self.setColumnWidth(0, 60)
433
+
434
+ self.setColumnWidth(1, 80)
435
+ self.setColumnWidth(2, 120)
436
+ #self.setColumnWidth(3, 60)
437
+ #self.setColumnWidth(4, 60)
438
+ end
439
+ end
440
+ end
441
+ end
442
+
443
+ if __FILE__ == $0
444
+ # TODO Generated stub
445
+ end
@@ -0,0 +1,62 @@
1
+ # .
2
+ # tagless_viewer.rb
3
+ #
4
+ # Copyright 2012 by siberas, http://www.siberas.de
5
+ #
6
+ # This file is part of WATOBO (Web Application Tool Box)
7
+ # http://watobo.sourceforge.com
8
+ #
9
+ # WATOBO is free software; you can redistribute it and/or modify
10
+ # it under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation version 2 of the License.
12
+ #
13
+ # WATOBO is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with WATOBO; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ # .
22
+ require 'watobo/gui/request_editor'
23
+ module Watobo
24
+ module Gui
25
+ class TaglessViewer < SimpleTextView
26
+ def normalizeText(text)
27
+ return '' if text.nil?
28
+
29
+ raw_text = text
30
+
31
+ if text.is_a? Array then
32
+ raw_text = text.join
33
+ end
34
+
35
+ #remove headers
36
+ body_start = raw_text.index("\r\n\r\n")
37
+ body_start = body_start.nil? ? 0 : body_start
38
+ #puts "* start normalizing at pos #{body_start}"
39
+ normalized = raw_text[body_start..-1]
40
+ # UTF-8 Clean-Up
41
+ normalized = normalized.unpack("C*").pack("C*")
42
+ # remove all inbetween tags
43
+ normalized.gsub!(/<.*?>/m, '')
44
+ # remove non printable characters, except LF (\x0a)
45
+ normalized.gsub!(/[\x00-\x09\x0b-\x1f\x7f-\xff]+/m,'')
46
+ # remove empty lines
47
+ normalized.gsub!(/((\x20+)?\x0a(\x20+)?)+/,"\n")
48
+ # decode html entities for better readability
49
+ normalized = CGI.unescapeHTML(normalized)
50
+ # additionally unescape &nbsp; which is not handled by CGI :(
51
+ normalized.gsub!(/(#{Regexp.quote('&nbsp;')})+/," ")
52
+ # finally strip it
53
+ normalized.strip
54
+ end
55
+
56
+ def initialize(owner, opts)
57
+ super(owner, opts)
58
+ end
59
+ end
60
+
61
+ end
62
+ end
@@ -0,0 +1,80 @@
1
+ # .
2
+ # plugin.rb
3
+ #
4
+ # Copyright 2012 by siberas, http://www.siberas.de
5
+ #
6
+ # This file is part of WATOBO (Web Application Tool Box)
7
+ # http://watobo.sourceforge.com
8
+ #
9
+ # WATOBO is free software; you can redistribute it and/or modify
10
+ # it under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation version 2 of the License.
12
+ #
13
+ # WATOBO is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with WATOBO; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ # .
22
+ module Watobo
23
+ module Template
24
+ class Plugin < FXDialogBox
25
+ attr :plugin_name
26
+ attr :icon
27
+
28
+ include Watobo::Gui
29
+ include Watobo::Gui::Icons
30
+ def subscribe(event, &callback)
31
+ (@event_dispatcher_listeners[event] ||= []) << callback
32
+ end
33
+
34
+ def clearEvents(event)
35
+ @event_dispatcher_listener[event].clear
36
+ end
37
+
38
+ def notify(event, *args)
39
+ if @event_dispatcher_listeners[event]
40
+ @event_dispatcher_listeners[event].each do |m|
41
+ m.call(*args) if m.respond_to? :call
42
+ end
43
+ end
44
+ end
45
+
46
+ def updateView()
47
+ raise "!!! updateView not defined"
48
+ end
49
+
50
+ def load_icon(file=__FILE__)
51
+ begin
52
+ @icon = ICON_PLUGIN
53
+ path = File.dirname(file)
54
+ # puts "... searching for icons in #{path}"
55
+ file = Dir.glob("#{path}/*.ico").first
56
+
57
+ # puts "* load icon: #{file}"
58
+ @icon = Watobo::Gui.load_icon(file) unless file.nil?
59
+
60
+ self.icon = @icon
61
+ rescue => bang
62
+ puts "!!!Error: could not init icon"
63
+ puts bang
64
+ puts bang.backtrace if $DEBUG
65
+ end
66
+ end
67
+
68
+ def initialize(owner, title, project, opts)
69
+ super(owner, title, :opts => DECOR_ALL,:width=>800, :height=>600)
70
+ # Implement Sender
71
+ # Implement Scanner
72
+ @icon = nil
73
+ # load_icon()
74
+ @plugin_name = "undefined"
75
+ @event_dispatcher_listeners = Hash.new
76
+
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,103 @@
1
+ # .
2
+ # plugin2.rb
3
+ #
4
+ # Copyright 2012 by siberas, http://www.siberas.de
5
+ #
6
+ # This file is part of WATOBO (Web Application Tool Box)
7
+ # http://watobo.sourceforge.com
8
+ #
9
+ # WATOBO is free software; you can redistribute it and/or modify
10
+ # it under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation version 2 of the License.
12
+ #
13
+ # WATOBO is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with WATOBO; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ # .
22
+ module Watobo
23
+ class Plugin2 < FXDialogBox
24
+ attr :plugin_name
25
+ attr :icon
26
+
27
+ include Watobo::Gui
28
+ include Watobo::Gui::Icons
29
+ def subscribe(event, &callback)
30
+ (@event_dispatcher_listeners[event] ||= []) << callback
31
+ end
32
+
33
+ def clearEvents(event)
34
+ @event_dispatcher_listener[event].clear
35
+ end
36
+
37
+ def notify(event, *args)
38
+ if @event_dispatcher_listeners[event]
39
+ @event_dispatcher_listeners[event].each do |m|
40
+ m.call(*args) if m.respond_to? :call
41
+ end
42
+ end
43
+ end
44
+
45
+ def updateView()
46
+ raise "!!! updateView not defined"
47
+ end
48
+
49
+ def logger(msg)
50
+ t = Time.now
51
+ now = t.strftime("%m/%d/%Y @ %H:%M:%S")
52
+
53
+ @log_lock.synchronize do
54
+ text = "\n#{now}: msg"
55
+ @log_messages << text
56
+ end
57
+ end
58
+
59
+ def load_icon(file=__FILE__)
60
+ begin
61
+ @icon = ICON_PLUGIN
62
+ path = File.dirname(file)
63
+ # puts "... searching for icons in #{path}/icons"
64
+ file = Dir.glob("#{path}/icons/*.ico").first
65
+
66
+ # puts "* load icon: #{file}"
67
+ @icon = Watobo::Gui.load_icon(file) unless file.nil?
68
+
69
+ self.icon = @icon
70
+ rescue => bang
71
+ puts "!!!Error: could not init icon"
72
+ puts bang
73
+ puts bang.backtrace if $DEBUG
74
+ end
75
+ end
76
+
77
+ def initialize(owner, title, project, opts)
78
+ super(owner, title, :opts => DECOR_ALL,:width=>800, :height=>600)
79
+ # Implement Sender
80
+ # Implement Scanner
81
+ @icon = nil
82
+ # load_icon()
83
+ @plugin_name = "undefined"
84
+ @event_dispatcher_listeners = Hash.new
85
+ @log_lock = Mutex.new
86
+
87
+ @log_messages = []
88
+
89
+ end
90
+
91
+ private
92
+
93
+ def add_update_timer(ms)
94
+ @update_timer = FXApp.instance.addTimeout( ms, :repeat => true) {
95
+ @update_lock.synchronize do
96
+
97
+
98
+ end
99
+
100
+ }
101
+ end
102
+ end
103
+ end