watobo 0.9.8.677

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,348 @@
1
+ # .
2
+ # www_auth_dialog.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 AuthTable < FXTable
25
+ include Watobo::Constants
26
+ def subscribe(event, &callback)
27
+ (@event_dispatcher_listeners[event] ||= []) << callback
28
+ end
29
+
30
+ def settings
31
+ www_auth = {}
32
+ self.numRows.times do |i|
33
+ www_auth_scope = Hash.new
34
+ site = self.getItemText(i, 0)
35
+ www_auth[site] = www_auth_scope
36
+ www_auth_scope[:username] = self.getItemText(i, 2)
37
+ www_auth_scope[:password] = self.getItemData(i, 3)
38
+ www_auth_scope[:type] = self.getItemData(i, 1)
39
+ www_auth_scope[:domain] = self.getItemText(i, 4)
40
+ www_auth_scope[:workstation] = self.getItemText(i, 5)
41
+ end
42
+ www_auth
43
+ end
44
+
45
+ def delCurrentRow()
46
+ cr = self.currentRow
47
+ self.removeRows(cr, 1, true) if cr >= 0
48
+ self.killSelection()
49
+ notify(:item_selected, nil)
50
+ end
51
+
52
+ def addAuthScope(www_auth = {})
53
+ return nil if www_auth[:username].nil? or www_auth[:password].nil?
54
+ siteIndex = -1
55
+ lastRowIndex = self.getNumRows
56
+ lastRowIndex.times do |i|
57
+ if self.getItemText(i, 0) == www_auth[:site] then
58
+ siteIndex = i
59
+ lastRowIndex = i
60
+ break
61
+ end
62
+ end
63
+ self.appendRows(1) if siteIndex < 0
64
+
65
+ table_items = [ :site, :type, :username, :password, :domain, :workstation ]
66
+
67
+ # puts table_items[i]
68
+ self.setItemText(lastRowIndex, 0, www_auth[:site] )
69
+ self.getItem(lastRowIndex, 0).justify = FXTableItem::LEFT
70
+
71
+ text = case www_auth[:type]
72
+ when AUTH_TYPE_NTLM
73
+ "NTLM"
74
+ end
75
+
76
+ self.setItemText(lastRowIndex, 1, text)
77
+ self.setItemData(lastRowIndex, 1, www_auth[:type])
78
+ self.getItem(lastRowIndex, 1).justify = FXTableItem::LEFT
79
+
80
+ self.setItemText(lastRowIndex, 2, www_auth[:username] )
81
+ self.getItem(lastRowIndex, 2).justify = FXTableItem::LEFT
82
+
83
+ pw_text = www_auth[:password] == "" ? "- not set -" : "********"
84
+ self.setItemText(lastRowIndex, 3, pw_text )
85
+ self.setItemData(lastRowIndex, 3, www_auth[:password] )
86
+ self.getItem(lastRowIndex, 3).justify = FXTableItem::LEFT
87
+
88
+ self.setItemText(lastRowIndex, 4, www_auth[:domain] )
89
+ self.getItem(lastRowIndex, 4).justify = FXTableItem::LEFT
90
+
91
+ self.setItemText(lastRowIndex, 5, www_auth[:workstation] )
92
+ self.getItem(lastRowIndex, 5).justify = FXTableItem::LEFT
93
+
94
+ end
95
+
96
+ def initialize(owner, opts)
97
+ super(owner, opts)
98
+ @event_dispatcher_listeners = Hash.new
99
+ initTable()
100
+
101
+ self.connect(SEL_COMMAND) { |sender, sel, item|
102
+ cr = self.currentRow
103
+ if cr >= 0 then
104
+ www_auth = Hash.new
105
+ www_auth_scope = Hash.new
106
+ site = self.getItemText(cr, 0)
107
+ www_auth[site] = www_auth_scope
108
+ www_auth_scope[:username] = self.getItemText(cr, 2)
109
+ www_auth_scope[:password] = self.getItemData(cr, 3)
110
+ www_auth_scope[:type] = self.getItemData(cr, 1)
111
+ www_auth_scope[:domain] = self.getItemText(cr, 4)
112
+ www_auth_scope[:workstation] = self.getItemText(cr, 5)
113
+ notify(:item_selected, www_auth)
114
+ else
115
+ notify(:item_selected, nil)
116
+ end
117
+ }
118
+
119
+ end
120
+
121
+ private
122
+
123
+ def notify(event, *args)
124
+ if @event_dispatcher_listeners[event]
125
+ @event_dispatcher_listeners[event].each do |m|
126
+ m.call(*args) if m.respond_to? :call
127
+ end
128
+ end
129
+ end
130
+
131
+ def initTable()
132
+ self.clearItems()
133
+ self.setTableSize(0, 6)
134
+
135
+ self.setColumnText( 0, "Site" )
136
+ self.setColumnText( 1, "Type" )
137
+ self.setColumnText( 2, "User" )
138
+ self.setColumnText( 3, "Password" )
139
+ self.setColumnText( 4, "Domain" )
140
+ self.setColumnText( 5, "Workstation" )
141
+
142
+ self.rowHeader.width = 0
143
+
144
+ col_width = [ 80, 80, 80, 80, 80, 80 ]
145
+ col_width.length.times do |i|
146
+ self.setColumnWidth(i, col_width[i])
147
+ end
148
+
149
+ notify(:item_selected, false)
150
+ end
151
+ end
152
+
153
+ class WwwAuthDialog < FXDialogBox
154
+
155
+ include Watobo::Gui::Icons
156
+ include Watobo::Constants
157
+
158
+ NO_SELECTION = "no site selected"
159
+ def savePasswords?()
160
+ @save_pws_cbt.checked?
161
+ end
162
+
163
+ include Responder
164
+
165
+ def initialize(owner, project, prefs={})
166
+
167
+ super(owner, "NTLM Authentication", :opts => DECOR_ALL)
168
+ @project = project
169
+ FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)
170
+
171
+ @password_policy = {
172
+ :save_passwords => false
173
+ }
174
+
175
+ @password_policy.update prefs[:password_policy] if prefs.has_key? :password_policy
176
+
177
+ @site_dt = FXDataTarget.new('')
178
+ @username_dt = FXDataTarget.new('')
179
+ @domain_dt = FXDataTarget.new('')
180
+ @password_dt = FXDataTarget.new('')
181
+ @workstation_dt = FXDataTarget.new('')
182
+ @auth_type_dt = FXDataTarget.new(AUTH_TYPE_NTLM)
183
+
184
+ main_frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)
185
+
186
+ top_frame = FXHorizontalFrame.new(main_frame, :opts => LAYOUT_FILL_X)
187
+
188
+ @scope_only_cb = FXCheckButton.new(top_frame, "scope only", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
189
+ @scope_only_cb.setCheck(false)
190
+
191
+ if project.has_scope?
192
+ puts "project has scope defined"
193
+ end
194
+ @scope_only_cb.connect(SEL_COMMAND) { updateSitesCombo() }
195
+
196
+ @sites_combo = FXComboBox.new(top_frame, 5, @site_dt, FXDataTarget::ID_VALUE,
197
+ COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
198
+
199
+ @sites_combo.numVisible = @sites_combo.numItems >= 20 ? 20 : @sites_combo.numItems
200
+ @sites_combo.numColumns = 25
201
+ @sites_combo.editable = true
202
+ updateSitesCombo()
203
+
204
+ FXLabel.new(top_frame, "User:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
205
+ @username_txt = FXTextField.new(top_frame, 10,
206
+ :target => @username_dt, :selector => FXDataTarget::ID_VALUE,
207
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)
208
+
209
+ FXLabel.new(top_frame, "Password:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
210
+ @password_txt = FXTextField.new(top_frame, 10,
211
+ :target => @password_dt, :selector => FXDataTarget::ID_VALUE,
212
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT|TEXTFIELD_PASSWD)
213
+
214
+ FXLabel.new(top_frame, "Domain:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
215
+ @domain_txt = FXTextField.new(top_frame, 10,
216
+ :target => @domain_dt, :selector => FXDataTarget::ID_VALUE,
217
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)
218
+
219
+ FXLabel.new(top_frame, "Workstation:", nil, LAYOUT_TOP|JUSTIFY_RIGHT)
220
+ @workstation_txt = FXTextField.new(top_frame, 10,
221
+ :target => @workstation_dt, :selector => FXDataTarget::ID_VALUE,
222
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)
223
+
224
+ table_frame = FXHorizontalFrame.new(main_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)
225
+ @auth_table = AuthTable.new(table_frame, :opts => FRAME_SUNKEN|TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY)
226
+
227
+ @auth_table.subscribe(:item_selected){ |selection|
228
+ unless selection.nil? then
229
+ @rem_auth_btn.enable
230
+ selection.each_key do |k|
231
+ settings = selection[k]
232
+ @site_dt.value = k
233
+ @sites_combo.setText(k)
234
+ @username_dt.value = settings[:username]
235
+ # @password_dt.value = settings[:password]
236
+ @domain_dt.value = settings[:domain]
237
+ @workstation_dt.value = settings[:workstation]
238
+ updateFields()
239
+ end
240
+ else
241
+ @rem_auth_btn.disable
242
+ end
243
+ }
244
+
245
+ pas = @project.getWwwAuthentication()
246
+ # puts pas.to_yaml
247
+ pas.each_key do |k|
248
+ auth_settings = {
249
+ :username => pas[k][:username],
250
+ :password => pas[k][:password],
251
+ :domain => pas[k][:domain],
252
+ :workstation => pas[k][:workstation],
253
+ :site => k,
254
+ :type => pas[k][:type]
255
+ }
256
+ @auth_table.addAuthScope(auth_settings)
257
+ end
258
+
259
+ table_btn_frame = FXVerticalFrame.new(table_frame, :opts => LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH)
260
+ @add_auth_btn = FXButton.new(table_btn_frame, "Add")
261
+ @add_auth_btn.connect(SEL_COMMAND){ addAuthenticationItem() }
262
+ #@add_auth_btn.disable
263
+
264
+ @rem_auth_btn = FXButton.new(table_btn_frame, "Remove")
265
+ @rem_auth_btn.connect(SEL_COMMAND){ remAuthenticationItem() }
266
+ @rem_auth_btn.disable
267
+
268
+ frame = FXVerticalFrame.new(main_frame, :opts => LAYOUT_FILL_X)
269
+ @save_pws_cbt = FXCheckButton.new(frame, "save passwords")
270
+ @save_pws_cbt.checkState = false
271
+ @save_pws_cbt.checkState = true if @password_policy[:save_passwords] == true
272
+ note_label = FXLabel.new(frame, "This setting affects all passwords!!!")
273
+
274
+ buttons = FXHorizontalFrame.new(main_frame, :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,
275
+ :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)
276
+
277
+ accept = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT,
278
+ FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
279
+ accept.enable
280
+ # Cancel
281
+ FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL,
282
+ FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
283
+ end
284
+
285
+ private
286
+
287
+ def remAuthenticationItem()
288
+ @auth_table.delCurrentRow()
289
+ end
290
+
291
+ def updateSitesCombo()
292
+ @sites_combo.clearItems
293
+ @sites_combo.appendItem(NO_SELECTION, nil)
294
+ @project.listSites(:in_scope => @scope_only_cb.checked? ){ |site|
295
+ #puts "Site: #{site}"
296
+ @sites_combo.appendItem(site, site)
297
+ }
298
+ @sites_combo.numVisible = @sites_combo.numItems >= 20 ? 20 : @sites_combo.numItems
299
+ @sites_combo.setCurrentItem(0) if @sites_combo.numItems > 0
300
+ end
301
+
302
+ def addAuthenticationItem()
303
+ ci = @sites_combo.currentItem
304
+ site = @site_dt.value
305
+ # site = ( ci >= 0 ) ? @sites_combo.getItemData(ci) : nil
306
+ return nil if site == NO_SELECTION
307
+ auth_settings = {
308
+ :username => @username_dt.value,
309
+ :password => @password_dt.value,
310
+ :domain => @domain_dt.value,
311
+ :workstation => @workstation_dt.value,
312
+ :site => site,
313
+ :type => AUTH_TYPE_NTLM
314
+ }
315
+
316
+ @auth_table.addAuthScope(auth_settings)
317
+
318
+ end
319
+
320
+ def updateFields()
321
+ # @sites_combo.handle(self, FXSEL(SEL_UPDATE, 1), nil)
322
+ @username_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
323
+ @password_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
324
+ @workstation_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
325
+ @domain_txt.handle(self, FXSEL(SEL_UPDATE, 0), nil)
326
+ end
327
+
328
+ def onAccept(sender, sel, event)
329
+ settings = @auth_table.settings
330
+ empty_passwords = false
331
+ settings.each_key do |w3a|
332
+ empty_passwords = true if settings[w3a][:password] == ''
333
+ end
334
+ unless empty_passwords == true then
335
+ @project.setWwwAuthentication(@auth_table.settings)
336
+ # puts @auth_table.settings.to_yaml
337
+ getApp().stopModal(self, 1)
338
+ self.hide()
339
+ return 1
340
+ else
341
+ FXMessageBox.information(self, MBOX_OK, "Empty Passwords", "You must enter a password!")
342
+ end
343
+
344
+ end
345
+ end
346
+
347
+ end
348
+ end
@@ -0,0 +1,114 @@
1
+ # .
2
+ # xml_viewer_frame.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
+ #
23
+ # XML/SOAP Resources
24
+ #
25
+ # http://calagenda.berkeley.edu/help_training/developer/calendar-ws/sample-code/ruby-soap4r/geteventsbyrange.rb
26
+ # http://www.service-repository.com/
27
+ #
28
+ module Watobo
29
+ module Gui
30
+
31
+ class XmlTree < FXTreeList
32
+
33
+ def addTreeElement(parent=nil, element=nil)
34
+ node = self.appendItem(parent, element.name)
35
+ element.elements.each do |e|
36
+ sn = self.appendItem(node, e.name)
37
+ if e.has_elements?
38
+ e.elements.each do |se|
39
+ self.addTreeElement(sn, se)
40
+ end
41
+
42
+ end
43
+ end
44
+ end
45
+
46
+ def initialize(parent, xml_data=nil)
47
+ super(parent, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_RIGHT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT)
48
+ @xml_data = REXML::Document.new(xml_data)
49
+ @root = @xml_data.root
50
+ # @root.each_recursive { |x|
51
+ #puts x.name if x.has_text? and x.text == "?"
52
+ # puts x.name #unless x.has_elements?
53
+ #}
54
+ #puts @xml_data.root.methods.sort
55
+
56
+ addTreeElement(nil, @root)
57
+
58
+ end
59
+ end
60
+
61
+ class XmlViewerFrame < FXVerticalFrame
62
+
63
+
64
+
65
+ def initialize(owner, xmldata=nil, opts=0)
66
+ super(owner, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y , :padding => 0)
67
+ @xml_tree = XmlTree.new(self, xmldata)
68
+ #puts xmldata
69
+ end
70
+
71
+
72
+
73
+ end #EOC
74
+ #--
75
+ end
76
+ end
77
+
78
+
79
+ if __FILE__ == $0
80
+ require 'rexml/document'
81
+
82
+ include REXML
83
+
84
+ xmldata = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ort="http://www.mathertel.de/OrteLookup/">
85
+ <soap:Header/>
86
+ <soap:Body>
87
+ <ort:GetPrefixedEntries>
88
+ <!--Optional:-->
89
+ <ort:prefix>?</ort:prefix>
90
+ </ort:GetPrefixedEntries>
91
+ </soap:Body>
92
+ </soap:Envelope>'
93
+
94
+ class TestGui < FXMainWindow
95
+
96
+ def initialize(app, xmldata)
97
+ # Call base class initializer first
98
+ super(app, "Test Application", :width => 800, :height => 600)
99
+ frame = FXVerticalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)
100
+
101
+ xmlframe = Watobo::Gui::XmlViewerFrame.new(frame, xmldata, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
102
+ end
103
+ # Create and show the main window
104
+ def create
105
+ super # Create the windows
106
+ show(PLACEMENT_SCREEN) # Make the main window appear
107
+
108
+ end
109
+ end
110
+ application = FXApp.new('LayoutTester', 'FoxTest')
111
+ TestGui.new(application, xmldata)
112
+ application.create
113
+ application.run
114
+ end
data/lib/watobo/gui.rb ADDED
@@ -0,0 +1,139 @@
1
+ # .
2
+ # gui.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
+ begin
23
+ require 'fox16'
24
+ require 'fox16/colors'
25
+ rescue LoadError
26
+ puts "!!! Seems like FXRuby is not installed !!!"
27
+ puts "please check the installation tutorial at http://watobo.sourceforge.net"
28
+ exit
29
+ end
30
+
31
+ if RUBY_PLATFORM =~ /(linux|bsd|solaris|hpux|darwin)/i
32
+ begin
33
+ require 'selenium-webdriver'
34
+ rescue LoadError
35
+ puts "To use the Preview-Featur of WATOBO on your platform (#{RUBY_PLATFORM}) you first must install the 'selenium-webdriver' gem."
36
+ puts "Simply enter the command 'gem install selenium-webdriver'"
37
+ puts "Press a key to continue or CTRL-C to abort."
38
+ gets
39
+ end
40
+ end
41
+
42
+
43
+ include Fox
44
+
45
+ module Watobo
46
+ module Gui
47
+ @application = nil
48
+ @icon_path = File.expand_path(File.join(File.dirname(__FILE__),"..","..","icons"))
49
+
50
+ @active_project = nil
51
+ def self.history
52
+ unless defined? @history
53
+ hf = Watobo::Conf::Gui.history_file
54
+ puts Watobo::Conf::Gui.dump.to_yaml
55
+ wd = Watobo.working_directory
56
+ puts "* create new history"
57
+ puts "* in working directory: #{wd}"
58
+ puts "* history file: #{hf}"
59
+
60
+ history_file = File.join(wd , hf)
61
+ @history = SessionHistory.new(history_file)
62
+ end
63
+ @history
64
+ end
65
+
66
+ def self.start
67
+ # create_application
68
+ @main_window = Watobo::Gui::MainWindow.new(@application)
69
+ FXToolTip.new(@application)
70
+
71
+ @application.create
72
+ @application.threadsEnabled = true
73
+
74
+ Thread.abort_on_exception = true
75
+
76
+ @history = Gui.history
77
+
78
+ check_first_run()
79
+
80
+ @application.run
81
+
82
+ end
83
+
84
+ def self.create_application
85
+ @application = FXApp.new("Watobo", "The Webapplication Toolbox")
86
+ end
87
+
88
+ def self.application
89
+ @application
90
+ end
91
+
92
+ def self.active_project
93
+ @active_project
94
+ end
95
+
96
+ def self.active_project=(project)
97
+ puts "[GUI] Active Project; project.object_id"
98
+ @active_project = project
99
+ end
100
+
101
+ private
102
+
103
+ def self.check_first_run
104
+ file = File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "disclaimer.chk")
105
+ unless File.exists?(file)
106
+ first_start_info = Watobo::Gui::AboutWatobo.new(@main_window)
107
+ if first_start_info.execute != 0 then
108
+ File.new(file, "w")
109
+ else
110
+ exit
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
116
+
117
+ %w( load_icons gui_utils load_plugins session_history save_default_settings master_password session_history save_project_settings save_proxy_settings ).each do |l|
118
+ require File.join("watobo","gui","utils", l)
119
+ end
120
+ #require 'watobo/gui/utils/load_icons'
121
+ #require 'watobo/gui/utils/gui_utils'
122
+ #require 'watobo/gui/utils/load_plugins'
123
+ #require 'watobo/gui/utils/session_history'
124
+ #require 'watobo/gui/utils/save_default_settings'
125
+
126
+ Watobo::Gui.create_application
127
+
128
+ require 'watobo/gui/utils/init_icons'
129
+
130
+ gui_path = File.expand_path(File.join(File.dirname(__FILE__), "gui"))
131
+ #puts "* loading gui #{gui_path}"
132
+ Dir.glob("#{gui_path}/*.rb").each do |cf|
133
+ next if File.basename(cf) == 'main_window.rb' # skip main_window here, because it must be loaded last
134
+ require File.join("watobo","gui", File.basename(cf))
135
+
136
+ end
137
+ require 'watobo/gui/templates/plugin'
138
+ require 'watobo/gui/templates/plugin2'
139
+ require 'watobo/gui/main_window'