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
- # full_scan_dialog.rb
3
- #.
4
- # Copyright 2014 by siberas, http://www.siberas.de
5
- # This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
6
- # WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
7
- # WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
8
- # You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
9
-
10
1
  # @private
11
2
  module Watobo#:nodoc: all
12
3
  module Gui
@@ -1,1579 +1,1561 @@
1
- #.
2
- # fuzzer_gui.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
  require 'watobo/gui/request_editor.rb'
11
2
  # @private
12
- module Watobo#:nodoc: all
3
+ module Watobo #:nodoc: all
13
4
 
14
5
 
15
- module Gui
6
+ module Gui
16
7
 
17
- class FuzzerCheck < Watobo::ActiveCheck
8
+ class FuzzerCheck < Watobo::ActiveCheck
18
9
 
19
- def initialize(project, fuzzer_list, filter_list, requestEditor, prefs={} )
20
- super(project.object_id, prefs)
21
- @fuzzer_list = fuzzer_list
22
- @requestEditor = requestEditor
23
- @filter_list = filter_list
24
- @prefs = prefs
25
- end
10
+ def initialize(project, fuzzer_list, filter_list, requestEditor, prefs={})
11
+ super(project.object_id, prefs)
12
+ @fuzzer_list = fuzzer_list
13
+ @requestEditor = requestEditor
14
+ @filter_list = filter_list
15
+ @prefs = prefs
16
+ end
26
17
 
27
- def fuzzels(fuzzers, index=0, result=nil)
28
- begin
29
- unless fuzzers[index].nil?
30
- fuzzers[index].run(result) do |fuzz|
31
- if index < fuzzers.length - 1
32
- fuzzels(fuzzers, index+1, fuzz) do |sr|
33
- yield sr
34
- end
35
- else
36
- yield fuzz
37
- end
38
- end
39
- end
40
- rescue => bang
41
- puts bang
42
- puts bang.backtrace if $DEBUG
18
+ def fuzzels(fuzzers, index=0, result=nil)
19
+ begin
20
+ unless fuzzers[index].nil?
21
+ fuzzers[index].run(result) do |fuzz|
22
+ if index < fuzzers.length - 1
23
+ fuzzels(fuzzers, index+1, fuzz) do |sr|
24
+ yield sr
25
+ end
26
+ else
27
+ yield fuzz
28
+ end
43
29
  end
44
- end
30
+ end
31
+ rescue => bang
32
+ puts bang
33
+ puts bang.backtrace if $DEBUG
34
+ end
35
+ end
45
36
 
46
37
 
38
+ def reset()
47
39
 
48
- def reset()
40
+ end
49
41
 
50
- end
42
+ def generateChecks(chat)
43
+ unless @fuzzer_list.empty?
44
+ fuzzels(@fuzzer_list) do |fuzzle|
45
+ test_fuzzle = Hash.new
46
+ test_fuzzle.update YAML.load(YAML.dump(fuzzle))
47
+ checker = proc {
48
+ #puts test_fuzzle
49
+ fuzz_request = @requestEditor.parseRequest(test_fuzzle)
50
+ fuzz_request.extend Watobo::Mixin::Shaper::Web10
51
+ fuzz_request.extend Watobo::Mixin::Parser::Web10
52
+ fuzz_request.extend Watobo::Mixin::Parser::Url
51
53
 
52
- def generateChecks(chat)
53
- unless @fuzzer_list.empty?
54
- fuzzels(@fuzzer_list) do |fuzzle|
55
- test_fuzzle = Hash.new
56
- test_fuzzle.update YAML.load(YAML.dump(fuzzle))
57
- checker = proc{
58
- #puts test_fuzzle
59
- fuzz_request = @requestEditor.parseRequest(test_fuzzle)
60
- fuzz_request.extend Watobo::Mixin::Shaper::Web10
61
- fuzz_request.extend Watobo::Mixin::Parser::Web10
62
- fuzz_request.extend Watobo::Mixin::Parser::Url
54
+ test_request, test_response = doRequest(fuzz_request, @prefs)
63
55
 
64
- test_request, test_response = doRequest(fuzz_request, @prefs)
65
-
66
- notify(:stats, test_response)
56
+ notify(:stats, test_response)
67
57
 
68
- notify(:fuzzer_match, test_fuzzle, test_request, test_response, test_response.join) if @filter_list.empty?
58
+ notify(:fuzzer_match, test_fuzzle, test_request, test_response, test_response.join) if @filter_list.empty?
69
59
 
70
- @filter_list.each do |f|
71
- matches = f.func.call(test_response) if f.func.respond_to? :call
72
- matches.each do |match|
73
- notify(:fuzzer_match, test_fuzzle, test_request, test_response, match)
74
- end
75
- end
60
+ @filter_list.each do |f|
61
+ matches = f.func.call(test_response) if f.func.respond_to? :call
62
+ matches.each do |match|
63
+ notify(:fuzzer_match, test_fuzzle, test_request, test_response, match)
64
+ end
65
+ end
76
66
 
77
- [ test_request, test_response ]
78
- }
79
- yield checker
80
- end
81
- end
82
- end
67
+ [test_request, test_response]
68
+ }
69
+ yield checker
70
+ end
71
+ end
83
72
  end
73
+ end
84
74
 
85
- class FuzzerTag
86
-
87
- attr :name
88
- attr :generators
89
- attr :collector
90
- attr :trigger
91
-
92
- def is_tag?()
93
- true
94
- end
75
+ class FuzzerTag
95
76
 
96
- def addGenerator(gen)
97
- @generators.push gen
98
- end
77
+ attr :name
78
+ attr :generators
79
+ attr :collector
80
+ attr :trigger
99
81
 
100
- def deleteGenerator(gen)
101
- @generators.delete(gen)
102
- end
82
+ def is_tag?()
83
+ true
84
+ end
103
85
 
104
- def run(result)
105
- @generators.each do |g|
106
- g.run(result) { |x| yield x }
107
- end
108
- end
86
+ def addGenerator(gen)
87
+ @generators.push gen
88
+ end
109
89
 
110
- def initialize(name)
111
- @name = name
112
- @generators = []
113
- @collector = nil
114
- @trigger = nil
115
- end
90
+ def deleteGenerator(gen)
91
+ @generators.delete(gen)
116
92
  end
117
93
 
94
+ def run(result)
95
+ @generators.each do |g|
96
+ g.run(result) { |x| yield x }
97
+ end
98
+ end
118
99
 
100
+ def initialize(name)
101
+ @name = name
102
+ @generators = []
103
+ @collector = nil
104
+ @trigger = nil
105
+ end
106
+ end
119
107
 
120
- class CreateFuzzerDlg < FXDialogBox
121
108
 
122
- def tag
123
- @tag_dt.value
124
- end
109
+ class CreateFuzzerDlg < FXDialogBox
125
110
 
126
- def initialize(owner)
127
- super(owner, "Create New Tag", DECOR_TITLE|DECOR_BORDER)
128
- main = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
129
- frame = FXHorizontalFrame.new(main, :opts => LAYOUT_FILL_X)
130
- FXLabel.new(frame, "Enter Label For Tag:")
131
- input = FXHorizontalFrame.new(main, :opts => LAYOUT_FILL_X)
132
- @tag_dt = FXDataTarget.new('')
133
- @tag_text = FXTextField.new(input, 1, :target => @tag_dt, :selector => FXDataTarget::ID_VALUE,
134
- :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
111
+ def tag
112
+ @tag_dt.value
113
+ end
135
114
 
136
- FXLabel.new(main, "Note:\nTo define the position in the request enclose the tag name\nbetween '%%', eg. '%%tag%%'.\nIt will turn green if the given tag name is correct.\n" +
115
+ def initialize(owner)
116
+ super(owner, "Create New Tag", DECOR_TITLE|DECOR_BORDER)
117
+ main = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
118
+ frame = FXHorizontalFrame.new(main, :opts => LAYOUT_FILL_X)
119
+ FXLabel.new(frame, "Enter Label For Tag:")
120
+ input = FXHorizontalFrame.new(main, :opts => LAYOUT_FILL_X)
121
+ @tag_dt = FXDataTarget.new('')
122
+ @tag_text = FXTextField.new(input, 1, :target => @tag_dt, :selector => FXDataTarget::ID_VALUE,
123
+ :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
124
+
125
+ FXLabel.new(main, "Note:\nTo define the position in the request enclose the tag name\nbetween '%%', eg. '%%tag%%'.\nIt will turn green if the given tag name is correct.\n" +
137
126
  "Don't forget to specify a generator!").justify = JUSTIFY_LEFT
138
127
 
139
- @tag_text.setFocus()
140
- @tag_text.setDefault()
128
+ @tag_text.setFocus()
129
+ @tag_text.setDefault()
141
130
 
142
- @tag_dt.connect(SEL_COMMAND) {
143
- @accept_btn.setFocus()
144
- @accept_btn.setDefault()
145
- }
146
- buttons = FXHorizontalFrame.new(main, :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,
147
- :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)
148
- # Accept
149
- @accept_btn = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
131
+ @tag_dt.connect(SEL_COMMAND) {
132
+ @accept_btn.setFocus()
133
+ @accept_btn.setDefault()
134
+ }
135
+ buttons = FXHorizontalFrame.new(main, :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,
136
+ :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)
137
+ # Accept
138
+ @accept_btn = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
150
139
 
151
- # Cancel
152
- FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
153
- end
140
+ # Cancel
141
+ FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
154
142
  end
143
+ end
155
144
 
156
- class CreateActionDlg < FXDialogBox
145
+ class CreateActionDlg < FXDialogBox
157
146
 
158
- def getAction()
159
- return @actionSelection.createAction()
160
- end
147
+ def getAction()
148
+ return @actionSelection.createAction()
149
+ end
161
150
 
162
- def initialize(owner)
163
- super(owner, "Create Action", DECOR_TITLE|DECOR_BORDER, :width => 300, :height => 500)
164
- main = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
151
+ def initialize(owner)
152
+ super(owner, "Create Action", DECOR_TITLE|DECOR_BORDER, :width => 300, :height => 500)
153
+ main = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
165
154
 
166
- @actionSelection = ActionSelect.new(main, self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, :padding => 0)
155
+ @actionSelection = ActionSelect.new(main, self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, :padding => 0)
167
156
 
168
- buttons = FXHorizontalFrame.new(main, :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,:padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)
169
- # Accept
170
- accept = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
157
+ buttons = FXHorizontalFrame.new(main, :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH, :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)
158
+ # Accept
159
+ accept = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
171
160
 
172
- # Cancel
173
- FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
174
- end
161
+ # Cancel
162
+ FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
175
163
  end
164
+ end
176
165
 
177
- class CreateGeneratorDlg < FXDialogBox
166
+ class CreateGeneratorDlg < FXDialogBox
178
167
 
179
- def getGenerator(fuzzer)
180
- return @fuzzerSelection.createGenerator(fuzzer)
181
- end
168
+ def getGenerator(fuzzer)
169
+ return @fuzzerSelection.createGenerator(fuzzer)
170
+ end
182
171
 
183
- def initialize(owner)
184
- super(owner, "Create Generator", DECOR_TITLE|DECOR_BORDER)
185
- main = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, :padding => 0)
172
+ def initialize(owner)
173
+ super(owner, "Create Generator", DECOR_TITLE|DECOR_BORDER)
174
+ main = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, :padding => 0)
186
175
 
187
- @fuzzerSelection = FuzzerGenSelect.new(main, self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, :padding => 0)
176
+ @fuzzerSelection = FuzzerGenSelect.new(main, self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, :padding => 0)
188
177
 
189
- buttons = FXHorizontalFrame.new(main, :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,
190
- :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)
191
- # Accept
192
- accept = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT,
193
- FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
178
+ buttons = FXHorizontalFrame.new(main, :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,
179
+ :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)
180
+ # Accept
181
+ accept = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT,
182
+ FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
194
183
 
195
- # Cancel
196
- FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL,
197
- FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
198
- end
184
+ # Cancel
185
+ FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL,
186
+ FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
199
187
  end
188
+ end
200
189
 
201
- class CreateFilterDlg < FXDialogBox
190
+ class CreateFilterDlg < FXDialogBox
202
191
 
203
- def filter()
204
- return @filterFrame.selection()
205
- end
192
+ def filter()
193
+ return @filterFrame.selection()
194
+ end
206
195
 
207
- def initialize(owner, project)
208
- super(owner, "Create Filter", DECOR_TITLE|DECOR_BORDER)
209
- main = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, :padding => 0)
196
+ def initialize(owner, project)
197
+ super(owner, "Create Filter", DECOR_TITLE|DECOR_BORDER)
198
+ main = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, :padding => 0)
210
199
 
211
- @filterFrame = FilterFrame.new(main, project.getSidPatterns, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, :padding => 0)
200
+ @filterFrame = FilterFrame.new(main, project.getSidPatterns, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, :padding => 0)
212
201
 
213
- buttons = FXHorizontalFrame.new(main, :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,
214
- :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)
215
- # Accept
216
- accept = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT,
217
- FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
202
+ buttons = FXHorizontalFrame.new(main, :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,
203
+ :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)
204
+ # Accept
205
+ accept = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT,
206
+ FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
218
207
 
219
- # Cancel
220
- FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL,
221
- FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
222
- end
208
+ # Cancel
209
+ FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL,
210
+ FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
223
211
  end
212
+ end
224
213
 
225
- class FuzzRequestEditor < Watobo::Gui::RequestEditor
214
+ class FuzzRequestEditor < Watobo::Gui::RequestEditor
226
215
 
227
- def highlight(pattern)
228
- sindex = nil
229
- eindex = nil
216
+ def highlight(pattern)
217
+ sindex = nil
218
+ eindex = nil
230
219
 
231
- dummy = @textbox.to_s
232
- @textbox.setText(dummy)
220
+ dummy = @textbox.to_s
221
+ @textbox.setText(dummy)
233
222
 
234
- pos = 0
235
- @pattern_matches.clear
223
+ pos = 0
224
+ @pattern_matches.clear
236
225
 
237
- loop do
226
+ loop do
238
227
 
239
- sindex, eindex = @textbox.findText(pattern, pos, SEARCH_EXACT|SEARCH_IGNORECASE|SEARCH_FORWARD)
240
- # puts sindex
241
- sindex, eindex = @textbox.findText(pattern, pos, :flags => SEARCH_REGEX|SEARCH_IGNORECASE|SEARCH_FORWARD) if not sindex
242
- # puts sindex
243
- sindex, eindex = @textbox.findText(Regexp.quote(pattern), pos, :flags => SEARCH_REGEX|SEARCH_IGNORECASE|SEARCH_FORWARD) if not sindex
228
+ sindex, eindex = @textbox.findText(pattern, pos, SEARCH_EXACT|SEARCH_IGNORECASE|SEARCH_FORWARD)
229
+ # puts sindex
230
+ sindex, eindex = @textbox.findText(pattern, pos, :flags => SEARCH_REGEX|SEARCH_IGNORECASE|SEARCH_FORWARD) if not sindex
231
+ # puts sindex
232
+ sindex, eindex = @textbox.findText(Regexp.quote(pattern), pos, :flags => SEARCH_REGEX|SEARCH_IGNORECASE|SEARCH_FORWARD) if not sindex
244
233
 
245
- break if not sindex or sindex.length == 0
234
+ break if not sindex or sindex.length == 0
246
235
 
247
236
 
248
- pos = eindex.last+1
237
+ pos = eindex.last+1
249
238
 
250
- sindex.length.times do |i|
251
- start = sindex[i]
252
- len = eindex[i] - sindex[i]
253
- @pattern_matches.push [ start, len] if start >= 0
239
+ sindex.length.times do |i|
240
+ start = sindex[i]
241
+ len = eindex[i] - sindex[i]
242
+ @pattern_matches.push [start, len] if start >= 0
254
243
 
255
- end
244
+ end
256
245
 
257
- break if sindex.last < 0
258
- # puts sindex
246
+ break if sindex.last < 0
247
+ # puts sindex
259
248
 
260
- end
249
+ end
261
250
 
262
- # puts "* found pattern #{pattern} #{@pattern_matches.length} times"
263
-
264
- @pattern_matches.each do |start, len|
265
- begin
266
- style = @style
267
- match = @textbox.to_s.slice(start, len)
268
- # puts "#{match}/#{start}/#{len}"
269
- match.gsub!(/%%/, '')
270
- style = @tags.include?(match) ? 1 : 2
271
-
272
- @textbox.changeStyle(start, len, style)
273
- rescue => bang
274
- puts "outch"
275
- puts bang
276
- end
277
- end
278
- return @pattern_matches
279
- end
251
+ # puts "* found pattern #{pattern} #{@pattern_matches.length} times"
280
252
 
253
+ @pattern_matches.each do |start, len|
254
+ begin
255
+ style = @style
256
+ match = @textbox.to_s.slice(start, len)
257
+ # puts "#{match}/#{start}/#{len}"
258
+ match.gsub!(/%%/, '')
259
+ style = @tags.include?(match) ? 1 : 2
281
260
 
261
+ @textbox.changeStyle(start, len, style)
262
+ rescue => bang
263
+ puts "outch"
264
+ puts bang
265
+ end
266
+ end
267
+ return @pattern_matches
268
+ end
282
269
 
283
- def parseRequest(fuzzels)
284
- begin
285
- new_request = nil
286
- if fuzzels then
287
- new_request = @textbox.to_s
288
- fuzzels.each do |marker, value|
289
- new_request.gsub!(/%%#{marker}%%/, value.to_s)
290
- end
291
- end
292
270
 
293
- return Watobo::Utils.text2request(new_request)
294
- rescue => bang
295
- puts bang
296
- puts bang.backtrace if $DEBUG
271
+ def parseRequest(fuzzels)
272
+ begin
273
+ new_request = nil
274
+ if fuzzels then
275
+ new_request = @textbox.to_s
276
+ fuzzels.each do |marker, value|
277
+ new_request.gsub!(/%%#{marker}%%/, value.to_s)
297
278
  end
298
- return nil
299
- end
279
+ end
280
+
281
+ return Watobo::Utils.text2request(new_request)
282
+ rescue => bang
283
+ puts bang
284
+ puts bang.backtrace if $DEBUG
285
+ end
286
+ return nil
287
+ end
300
288
 
301
- def addTag(tag)
302
- @tags.push tag
303
- end
289
+ def addTag(tag)
290
+ @tags.push tag
291
+ end
304
292
 
305
- def removeTag(tag)
306
- @tags.delete(tag)
307
- end
293
+ def removeTag(tag)
294
+ @tags.delete(tag)
295
+ end
308
296
 
309
- def highlightTags()
310
- highlight("(%%[^%]*%%)")
311
- end
297
+ def highlightTags()
298
+ highlight("(%%[^%]*%%)")
299
+ end
312
300
 
313
- def initialize(owner, opts)
314
- super(owner, opts)
301
+ def initialize(owner, opts)
302
+ super(owner, opts)
315
303
 
316
- @tags = []
304
+ @tags = []
317
305
 
318
- end
319
306
  end
307
+ end
320
308
 
321
- class Action
322
- attr :action_type
323
- attr :func
324
- attr :info
309
+ class Action
310
+ attr :action_type
311
+ attr :func
312
+ attr :info
325
313
 
326
- def is_action?
327
- true
328
- end
314
+ def is_action?
315
+ true
316
+ end
317
+
318
+ def initialize(action_proc, prefs)
319
+ @func = action_proc
320
+ @action_type = prefs[:action_type] || "undefined"
321
+ @info = prefs[:info] || "undefined"
322
+ end
323
+ end
329
324
 
330
- def initialize(action_proc, prefs)
331
- @func = action_proc
332
- @action_type = prefs[:action_type] || "undefined"
333
- @info = prefs[:info] || "undefined"
334
- end
325
+ class Filter
326
+ attr :func
327
+ attr :filter_type
328
+ attr :value
329
+ attr :info
330
+
331
+ def is_filter?
332
+ true
335
333
  end
336
334
 
337
- class Filter
338
- attr :func
339
- attr :filter_type
340
- attr :value
341
- attr :info
335
+ def initialize(filter_proc, prefs)
336
+ @filter_type = prefs[:filter_type] || "undefined"
337
+ @value = prefs[:value] || "undefined"
338
+ @func = filter_proc
339
+ @info = prefs[:info] || "undefined"
340
+ end
341
+ end
342
342
 
343
- def is_filter?
344
- true
345
- end
343
+ class StatisticsFrame < FXVerticalFrame
346
344
 
347
- def initialize(filter_proc, prefs)
348
- @filter_type = prefs[:filter_type] || "undefined"
349
- @value = prefs[:value] || "undefined"
350
- @func = filter_proc
351
- @info = prefs[:info] || "undefined"
352
- end
345
+ def clearView()
346
+ @count_total = 0
347
+ clearResponseCodeTable()
348
+ clearResponseLengthTable()
353
349
  end
354
350
 
355
- class StatisticsFrame < FXVerticalFrame
351
+ def addResponse(response)
352
+
353
+ @log_queue << response
356
354
 
357
- def clearView()
358
- @count_total = 0
359
- clearResponseCodeTable()
360
- clearResponseLengthTable()
361
- end
355
+ end
362
356
 
363
- def addResponse(response)
364
-
365
- @log_queue << response
357
+ def clearResponseCodeTable()
358
+ @response_code_tbl.clearItems()
359
+ @response_code_tbl.setTableSize(0, 2)
366
360
 
367
- end
361
+ @response_code_tbl.setColumnText(0, "STATUS")
362
+ @response_code_tbl.setColumnText(1, "COUNT")
368
363
 
369
- def clearResponseCodeTable()
370
- @response_code_tbl.clearItems()
371
- @response_code_tbl.setTableSize(0, 2)
364
+ @response_code_tbl.rowHeader.width = 0
365
+ @response_code_tbl.setColumnWidth(0, 70)
372
366
 
373
- @response_code_tbl.setColumnText( 0, "STATUS" )
374
- @response_code_tbl.setColumnText( 1, "COUNT" )
367
+ @response_code_tbl.setColumnWidth(1, 70)
375
368
 
376
- @response_code_tbl.rowHeader.width = 0
377
- @response_code_tbl.setColumnWidth(0, 70)
378
369
 
379
- @response_code_tbl.setColumnWidth(1, 70)
370
+ end
380
371
 
372
+ def start_update_timer
373
+ Watobo.save_thread {
381
374
 
382
- end
383
-
384
- def start_update_timer
385
- @timer = FXApp.instance.addTimeout( 1000, :repeat => true) {
386
375
  #print @log_queue.length
387
376
  while @log_queue.length > 0
388
377
  response = @log_queue.deq
389
-
378
+
390
379
  if response.respond_to? :status
391
380
  @count_total += 1
392
381
  @count_text.text = "Total: #{@count_total}"
393
382
 
394
- cstatus = response.status
395
- count_item = nil
396
- @response_code_tbl.getNumRows.times do |i|
397
- rc_item = @response_code_tbl.getItem(i, 0)
398
- count_item = @response_code_tbl.getItem(i, 1) if rc_item.text == response.status
399
- break unless count_item.nil?
400
- end
401
-
402
- if count_item.nil?
403
- lastRowIndex = @response_code_tbl.getNumRows
404
- @response_code_tbl.appendRows(1)
405
- @response_code_tbl.setItemText(lastRowIndex, 0, cstatus)
406
- @response_code_tbl.setItemText(lastRowIndex, 1, "1")
407
- count_item = @response_code_tbl.getItem(lastRowIndex, 1)
408
- else
409
- c = count_item.text.to_i
410
- count_item.text = ( c + 1 ).to_s
411
- end
412
- @count_text.handle(self, FXSEL(SEL_UPDATE, 0), nil)
383
+ cstatus = response.status
384
+ count_item = nil
385
+ @response_code_tbl.getNumRows.times do |i|
386
+ rc_item = @response_code_tbl.getItem(i, 0)
387
+ count_item = @response_code_tbl.getItem(i, 1) if rc_item.text == response.status
388
+ break unless count_item.nil?
389
+ end
390
+
391
+ if count_item.nil?
392
+ lastRowIndex = @response_code_tbl.getNumRows
393
+ @response_code_tbl.appendRows(1)
394
+ @response_code_tbl.setItemText(lastRowIndex, 0, cstatus)
395
+ @response_code_tbl.setItemText(lastRowIndex, 1, "1")
396
+ count_item = @response_code_tbl.getItem(lastRowIndex, 1)
397
+ else
398
+ c = count_item.text.to_i
399
+ count_item.text = (c + 1).to_s
400
+ end
401
+ @count_text.handle(self, FXSEL(SEL_UPDATE, 0), nil)
413
402
  end
414
-
403
+
415
404
  end
416
- }
405
+ }
417
406
 
418
407
  end
419
408
 
420
- def clearResponseLengthTable()
421
- @response_length_tbl.clearItems()
422
- @response_length_tbl.setTableSize(0, 2)
423
- @response_length_tbl.columnHeader.height = 0
424
- @response_length_tbl.rowHeader.width = 0
425
- @response_length_tbl.setColumnWidth(0, 40)
426
- @response_length_tbl.setColumnWidth(1, 40)
427
-
428
- lastRowIndex = @response_length_tbl.getNumRows
409
+ def clearResponseLengthTable()
410
+ @response_length_tbl.clearItems()
411
+ @response_length_tbl.setTableSize(0, 2)
412
+ @response_length_tbl.columnHeader.height = 0
413
+ @response_length_tbl.rowHeader.width = 0
414
+ @response_length_tbl.setColumnWidth(0, 40)
415
+ @response_length_tbl.setColumnWidth(1, 40)
416
+
417
+ lastRowIndex = @response_length_tbl.getNumRows
418
+
419
+ %w( MIN MAX AVRG ).each do |i|
420
+ lastRowIndex = @response_length_tbl.getNumRows
421
+ @response_length_tbl.appendRows(1)
422
+ @response_length_tbl.setItemText(lastRowIndex, 0, i)
423
+ @response_length_tbl.setItemText(lastRowIndex, 1, "0")
424
+ @response_length_tbl.getItem(lastRowIndex, 0).justify = FXTableItem::LEFT
425
+ @response_length_tbl.getItem(lastRowIndex, 1).justify = FXTableItem::LEFT
426
+ end
427
+ end
429
428
 
430
- %w( MIN MAX AVRG ).each do |i|
431
- lastRowIndex = @response_length_tbl.getNumRows
432
- @response_length_tbl.appendRows(1)
433
- @response_length_tbl.setItemText(lastRowIndex, 0, i)
434
- @response_length_tbl.setItemText(lastRowIndex, 1, "0")
435
- @response_length_tbl.getItem(lastRowIndex, 0).justify = FXTableItem::LEFT
436
- @response_length_tbl.getItem(lastRowIndex, 1).justify = FXTableItem::LEFT
437
- end
438
- end
439
-
440
-
441
- def initialize(parent, opts)
442
- super(parent, opts)
443
-
444
- @log_queue = Queue.new
445
-
446
- @count_total = 0
447
-
448
- @count_text = FXLabel.new(self, "Total: 0")
449
- @count_text.setFont(FXFont.new(getApp(), "helvetica", 11, FONTWEIGHT_BOLD, FONTENCODING_DEFAULT))
450
-
451
- counter_frame = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
452
- response_code_gb = FXGroupBox.new(counter_frame, "Response Codes", LAYOUT_SIDE_BOTTOM|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
453
- frame = FXVerticalFrame.new(response_code_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y )
454
- sunken = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
455
- @response_code_tbl = FXTable.new(sunken, :opts => FRAME_SUNKEN|TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2)
456
- @response_code_tbl.columnHeader.connect(SEL_COMMAND) { }
457
- clearResponseCodeTable()
458
-
459
- response_length_gb = FXGroupBox.new(counter_frame, "Response Length", LAYOUT_SIDE_BOTTOM|FRAME_GROOVE|LAYOUT_FILL_Y, 0, 0, 0, 0)
460
- frame = FXVerticalFrame.new(response_length_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y )
461
- sunken = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
462
- @response_length_tbl = FXTable.new(sunken, :opts => FRAME_SUNKEN|TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2)
463
- @response_length_tbl.columnHeader.connect(SEL_COMMAND) { }
464
-
465
-
466
- clearResponseLengthTable()
467
-
468
- start_update_timer
469
- end
470
- end
471
-
472
- class FilterFrame < FXVerticalFrame
473
-
474
- def selection()
475
- filter = case @filter_dt.value
476
- when 0
477
- index = @patternCombo.currentItem
478
- if @patternCombo.getItemText(index)
479
- func = proc { |response|
480
- pattern = @patternCombo.getItemText(index)
481
- matchlist = []
482
- response.each do |line|
483
- if line =~ /#{pattern}/i then
484
- match = $2
485
- matchlist.push "#{match}"
486
- end
487
- end
488
- matchlist
489
- }
490
- Filter.new(func, :filter_type => "SID", :value => "#{filter}", :info => "#{@patternCombo.getItemText(index)}" )
491
- else
492
- nil
493
- end
494
429
 
495
- when 1
430
+ def initialize(parent, opts)
431
+ super(parent, opts)
496
432
 
497
- if @regex_filter_dt.value != '' then
498
- func = proc { |response|
499
- pattern = @regex_filter_dt.value
500
- matchlist = []
501
- # puts "...regex (#{pattern})..."
502
- # puts response
503
- #response.each do |line|
504
- #if line =~ /#{pattern}/i then
505
- if @negate_regex_cb.checked?
506
- puts "* filter negate regex"
507
- unless response.join =~ /#{pattern}/i then
508
- match = $1
509
- puts "* #{match}"
510
- match = "#{response.join}" unless match
511
- matchlist.push "#{match}"
512
- end
513
- else
514
- if response.join =~ /#{pattern}/i then
515
- match = $1
516
- puts "* #{match}"
517
- match = "#{response.join}" unless match
518
- matchlist.push "#{match}"
519
- end
520
- end
521
- #end
522
- matchlist
523
- }
524
- Filter.new(func, :filter_type => "Regex", :value => "#{filter}", :info => "#{@regex_filter_dt.value}")
525
- else
526
- nil
527
- end
528
- end
529
- return filter
530
- end
531
-
532
-
533
- def initialize(owner, sidpatterns, opts)
534
- @sid_patterns = sidpatterns
535
- super(owner, opts)
536
-
537
- @filter_dt = FXDataTarget.new(0)
538
- group_box = FXGroupBox.new(self, "Filter", LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
539
- sid_frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X)
540
- @sid_rb = FXRadioButton.new(sid_frame, "Session-ID", @filter_dt, FXDataTarget::ID_OPTION)
541
-
542
- regex_frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X)
543
- @regex_rb = FXRadioButton.new(regex_frame, "Regex", @filter_dt, FXDataTarget::ID_OPTION + 1)
544
- @regex_filter_dt = FXDataTarget.new('')
545
- @regex_filter = FXTextField.new(regex_frame, 1, :target => @regex_filter_dt, :selector => FXDataTarget::ID_VALUE,
546
- :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
547
- @negate_regex_cb = FXCheckButton.new(group_box, "negate", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|LAYOUT_RIGHT|LAYOUT_FILL_Y)
548
- # group_box = FXGroupBox.new(self, "Collection",LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
549
- # frame = FXVerticalFrame.new(group_box, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_GROOVE)
550
- # @collectionList = FXList.new(frame, :opts => LIST_EXTENDEDSELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y)
551
- @filter_dt.connect(SEL_COMMAND) {
552
- @sid_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
553
- @regex_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
554
- }
433
+ @log_queue = Queue.new
555
434
 
556
- if @sid_patterns then
557
- @patternCombo = FXComboBox.new(sid_frame, @sid_patterns.length, nil, 0,
558
- :opts => COMBOBOX_INSERT_LAST|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
559
- @patternCombo.numVisible = @sid_patterns.length
560
- @sid_patterns.each do |pattern|
561
- @patternCombo.appendItem(pattern, nil)
562
- end
563
- else
564
- FXLabel.new(sid_frame, "NO SID PATTERNS DEFINED!")
565
- @sid_rb.disable
566
- @filter_dt.value = 1
567
- @regex_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
568
- end
435
+ @count_total = 0
569
436
 
570
- @sid_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
571
- @regex_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
572
- # group_box = FXGroupBox.new(self, "Test", LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
573
- # @sample_count_dt = FXDataTarget.new('')
574
- # frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X)
575
- # @sample_count = FXTextField.new(frame, 3, :target => @sample_count_dt, :selector => FXDataTarget::ID_VALUE,
576
- # :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN)
577
- # button = FXButton.new(frame, "Sample", nil, nil, 0, FRAME_RAISED|FRAME_THICK)
578
- # button.connect(SEL_COMMAND) do |sender, sel, ptr|
579
- # @interface.startSample()
580
- # end
581
- # frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X)
582
- # FXLabel.new(frame, "Matched:")
437
+ @count_text = FXLabel.new(self, "Total: 0")
438
+ @count_text.setFont(FXFont.new(getApp(), "helvetica", 11, FONTWEIGHT_BOLD, FONTENCODING_DEFAULT))
583
439
 
440
+ counter_frame = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
441
+ response_code_gb = FXGroupBox.new(counter_frame, "Response Codes", LAYOUT_SIDE_BOTTOM|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
442
+ frame = FXVerticalFrame.new(response_code_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
443
+ sunken = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
444
+ @response_code_tbl = FXTable.new(sunken, :opts => FRAME_SUNKEN|TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2)
445
+ @response_code_tbl.columnHeader.connect(SEL_COMMAND) {}
446
+ clearResponseCodeTable()
584
447
 
585
- end
586
- end
587
-
588
- class FuzzerGenSelect < FXVerticalFrame
448
+ response_length_gb = FXGroupBox.new(counter_frame, "Response Length", LAYOUT_SIDE_BOTTOM|FRAME_GROOVE|LAYOUT_FILL_Y, 0, 0, 0, 0)
449
+ frame = FXVerticalFrame.new(response_length_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
450
+ sunken = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
451
+ @response_length_tbl = FXTable.new(sunken, :opts => FRAME_SUNKEN|TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2)
452
+ @response_length_tbl.columnHeader.connect(SEL_COMMAND) {}
589
453
 
590
- include Watobo
591
454
 
592
- def updateFields
593
- @file_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
594
- @gen_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
595
- @list_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
596
- @sourceFileText.handle(self, FXSEL(SEL_UPDATE, 0), nil)
597
- @cstartText.handle(self, FXSEL(SEL_UPDATE, 0), nil)
598
- @cstopText.handle(self, FXSEL(SEL_UPDATE, 0), nil)
599
- @cstepText.handle(self, FXSEL(SEL_UPDATE, 0), nil)
600
- end
601
-
602
- def selectFile(sender, sel, ptr)
603
- filename = FXFileDialog.getOpenFilename(self, "Select Source File", @source_file.value)
604
- if filename != "" then
605
- if File.exists?(filename) then
606
- @source_file.value = filename
607
- @sourceFileText.handle(self, FXSEL(SEL_UPDATE, 0), nil)
608
- end
455
+ clearResponseLengthTable()
609
456
 
610
- end
611
- end
457
+ start_update_timer
458
+ end
459
+ end
612
460
 
613
- def onValueSelect(sender, sel, selected)
614
- item = @valueList.currentItem
615
- if item >= 0 then
616
- @new_list_item_dt.value = @valueList.getItemText(item)
617
- end
618
- end
461
+ class FilterFrame < FXVerticalFrame
462
+
463
+ def selection()
464
+ filter = case @filter_dt.value
465
+ when 0
466
+ index = @patternCombo.currentItem
467
+ if @patternCombo.getItemText(index)
468
+ func = proc { |response|
469
+ pattern = @patternCombo.getItemText(index)
470
+ matchlist = []
471
+ response.each do |line|
472
+ if line =~ /#{pattern}/i then
473
+ match = $2
474
+ matchlist.push "#{match}"
475
+ end
476
+ end
477
+ matchlist
478
+ }
479
+ Filter.new(func, :filter_type => "SID", :value => "#{filter}", :info => "#{@patternCombo.getItemText(index)}")
480
+ else
481
+ nil
482
+ end
619
483
 
620
- def removeValue(sender, sel, ptr)
621
- item = @valueList.currentItem
622
- if item >= 0 then
623
- @valueList.removeItem(item)
624
- end
625
- end
626
-
627
- def addValue(sender, sel, ptr)
628
- if @new_list_item_dt.value != '' then
629
- index = @valueList.appendItem(@new_list_item_dt.value )
630
- @valueList.makeItemVisible(index)
631
- @new_list_item_dt.value = ''
632
- @new_list_item.handle(self, FXSEL(SEL_UPDATE, 0), nil)
633
- end
634
- end
484
+ when 1
485
+
486
+ if @regex_filter_dt.value != '' then
487
+ func = proc { |response|
488
+ pattern = @regex_filter_dt.value
489
+ matchlist = []
490
+ # puts "...regex (#{pattern})..."
491
+ # puts response
492
+ #response.each do |line|
493
+ #if line =~ /#{pattern}/i then
494
+ if @negate_regex_cb.checked?
495
+ puts "* filter negate regex"
496
+ unless response.join =~ /#{pattern}/i then
497
+ match = $1
498
+ puts "* #{match}"
499
+ match = "#{response.join}" unless match
500
+ matchlist.push "#{match}"
501
+ end
502
+ else
503
+ if response.join =~ /#{pattern}/i then
504
+ match = $1
505
+ puts "* #{match}"
506
+ match = "#{response.join}" unless match
507
+ matchlist.push "#{match}"
508
+ end
509
+ end
510
+ #end
511
+ matchlist
512
+ }
513
+ Filter.new(func, :filter_type => "Regex", :value => "#{filter}", :info => "#{@regex_filter_dt.value}")
514
+ else
515
+ nil
516
+ end
517
+ end
518
+ return filter
519
+ end
635
520
 
636
- def createGenerator(fuzzer)
637
- gen = case @source_dt.value
638
- when 0
639
- #puts "File Generator Selected"
640
- Watobo::FuzzFile.new(fuzzer,
641
- @source_file.value)
642
- when 1
643
- # counter selected
644
- Watobo::FuzzCounter.new(fuzzer,
645
- :start => @cstart.value.to_i,
646
- :stop => @cstop.value.to_i,
647
- #:count => @ccount.value.to_i,
648
- :step => @cstep.value.to_i)
649
- when 2
650
521
 
651
- list = []
652
- @valueList.each do |item|
653
- # puts item
654
- list.push item.text
655
- end
656
- Watobo::FuzzList.new(fuzzer, list)
657
- end
658
-
659
- return gen
660
- end
661
-
662
- def disableFrame(frame)
663
- frame.children.each do |c|
664
- c.children.each do |sc|
665
- sc.disable
666
- sc.selBackColor = sc.parent.backColor if sc.respond_to? :selBackColor
667
- end
668
- c.disable
669
- c.selBackColor = c.parent.backColor if c.respond_to? :selBackColor
670
- end
671
- end
672
-
673
- def enableFrame(frame)
674
- frame.children.each do |c|
675
- c.children.each do |sc|
676
- sc.enable
677
- sc.selBackColor = FXColor::White if sc.respond_to? :selBackColor
678
- end
679
- c.enable
680
- c.selBackColor = FXColor::White if c.respond_to? :selBackColor
681
- end
682
- end
683
-
684
- def initialize(owner, interface, opts)
685
- super(owner, opts)
686
-
687
- @interface = interface
688
-
689
- group_box = FXGroupBox.new(self, "Select Source", LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
690
- @source_dt = FXDataTarget.new(0)
691
-
692
- @source_dt.connect(SEL_COMMAND) do
693
- case @source_dt.value
694
- when 0
695
- # puts "File"
696
- enableFrame(@file_select_frame)
697
- disableFrame(@counter_frame)
698
- disableFrame(@list_frame)
699
- when 1
700
- disableFrame(@file_select_frame)
701
- disableFrame(@list_frame)
702
- enableFrame(@counter_frame)
703
- # puts "Generator"
704
- when 2
705
- disableFrame(@counter_frame)
706
- enableFrame(@list_frame)
707
- disableFrame(@file_select_frame)
708
- # puts "List"
709
- end
710
- @file_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
711
- @gen_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
712
- @list_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
713
- end
714
- file_rb_frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X)
715
- @file_rb = FXRadioButton.new(file_rb_frame, "File", @source_dt, FXDataTarget::ID_OPTION)
522
+ def initialize(owner, sidpatterns, opts)
523
+ @sid_patterns = sidpatterns
524
+ super(owner, opts)
525
+
526
+ @filter_dt = FXDataTarget.new(0)
527
+ group_box = FXGroupBox.new(self, "Filter", LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
528
+ sid_frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X)
529
+ @sid_rb = FXRadioButton.new(sid_frame, "Session-ID", @filter_dt, FXDataTarget::ID_OPTION)
530
+
531
+ regex_frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X)
532
+ @regex_rb = FXRadioButton.new(regex_frame, "Regex", @filter_dt, FXDataTarget::ID_OPTION + 1)
533
+ @regex_filter_dt = FXDataTarget.new('')
534
+ @regex_filter = FXTextField.new(regex_frame, 1, :target => @regex_filter_dt, :selector => FXDataTarget::ID_VALUE,
535
+ :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
536
+ @negate_regex_cb = FXCheckButton.new(group_box, "negate", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|LAYOUT_RIGHT|LAYOUT_FILL_Y)
537
+ # group_box = FXGroupBox.new(self, "Collection",LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
538
+ # frame = FXVerticalFrame.new(group_box, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_GROOVE)
539
+ # @collectionList = FXList.new(frame, :opts => LIST_EXTENDEDSELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y)
540
+ @filter_dt.connect(SEL_COMMAND) {
541
+ @sid_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
542
+ @regex_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
543
+ }
544
+
545
+ if @sid_patterns then
546
+ @patternCombo = FXComboBox.new(sid_frame, @sid_patterns.length, nil, 0,
547
+ :opts => COMBOBOX_INSERT_LAST|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
548
+ @patternCombo.numVisible = @sid_patterns.length
549
+ @sid_patterns.each do |pattern|
550
+ @patternCombo.appendItem(pattern, nil)
551
+ end
552
+ else
553
+ FXLabel.new(sid_frame, "NO SID PATTERNS DEFINED!")
554
+ @sid_rb.disable
555
+ @filter_dt.value = 1
556
+ @regex_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
557
+ end
558
+
559
+ @sid_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
560
+ @regex_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
561
+ # group_box = FXGroupBox.new(self, "Test", LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
562
+ # @sample_count_dt = FXDataTarget.new('')
563
+ # frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X)
564
+ # @sample_count = FXTextField.new(frame, 3, :target => @sample_count_dt, :selector => FXDataTarget::ID_VALUE,
565
+ # :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN)
566
+ # button = FXButton.new(frame, "Sample", nil, nil, 0, FRAME_RAISED|FRAME_THICK)
567
+ # button.connect(SEL_COMMAND) do |sender, sel, ptr|
568
+ # @interface.startSample()
569
+ # end
570
+ # frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X)
571
+ # FXLabel.new(frame, "Matched:")
716
572
 
717
- @file_select_frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X, :padding => 0)
718
- @source_file = FXDataTarget.new('')
719
- @sourceFileText = FXTextField.new(@file_select_frame, 1, :target => @source_file, :selector => FXDataTarget::ID_VALUE,
720
- :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
721
- button = FXButton.new(@file_select_frame, "Select")
722
- button.connect(SEL_COMMAND, method(:selectFile) )
723
573
 
724
- counter_rb_frame = FXHorizontalFrame.new(group_box, LAYOUT_FILL_X)
725
- @gen_rb = FXRadioButton.new(counter_rb_frame, "Counter", @source_dt, FXDataTarget::ID_OPTION + 1)
726
- @counter_frame = FXHorizontalFrame.new(group_box, LAYOUT_FILL_X, :padding => 0 )
574
+ end
575
+ end
727
576
 
728
- @cstep = FXDataTarget.new(0)
729
- @cstepText = FXTextField.new(@counter_frame, 3, :target => @cstep, :selector => FXDataTarget::ID_VALUE,
730
- :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_RIGHT)
731
- FXLabel.new(@counter_frame, "Step",nil, :opts => LAYOUT_RIGHT)
577
+ class FuzzerGenSelect < FXVerticalFrame
732
578
 
579
+ include Watobo
733
580
 
581
+ def updateFields
582
+ @file_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
583
+ @gen_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
584
+ @list_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
585
+ @sourceFileText.handle(self, FXSEL(SEL_UPDATE, 0), nil)
586
+ @cstartText.handle(self, FXSEL(SEL_UPDATE, 0), nil)
587
+ @cstopText.handle(self, FXSEL(SEL_UPDATE, 0), nil)
588
+ @cstepText.handle(self, FXSEL(SEL_UPDATE, 0), nil)
589
+ end
734
590
 
735
- @cstop = FXDataTarget.new(0)
736
- @cstopText = FXTextField.new(@counter_frame, 3, :target => @cstop, :selector => FXDataTarget::ID_VALUE,
737
- :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_RIGHT)
738
- FXLabel.new(@counter_frame, "Stop",nil, :opts => LAYOUT_RIGHT)
591
+ def selectFile(sender, sel, ptr)
592
+ filename = FXFileDialog.getOpenFilename(self, "Select Source File", @source_file.value)
593
+ if filename != "" then
594
+ if File.exists?(filename) then
595
+ @source_file.value = filename
596
+ @sourceFileText.handle(self, FXSEL(SEL_UPDATE, 0), nil)
597
+ end
739
598
 
599
+ end
600
+ end
740
601
 
741
- @cstart = FXDataTarget.new(0)
742
- @cstartText = FXTextField.new(@counter_frame, 3, :target => @cstart, :selector => FXDataTarget::ID_VALUE,
743
- :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_RIGHT)
744
- FXLabel.new(@counter_frame, "Start",nil, :opts => LAYOUT_RIGHT)
602
+ def onValueSelect(sender, sel, selected)
603
+ item = @valueList.currentItem
604
+ if item >= 0 then
605
+ @new_list_item_dt.value = @valueList.getItemText(item)
606
+ end
607
+ end
745
608
 
746
- list_rb_frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
747
- @list_rb = FXRadioButton.new(list_rb_frame, "List", @source_dt, FXDataTarget::ID_OPTION + 2)
748
- @list_frame = FXVerticalFrame.new(list_rb_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
749
- frame = FXHorizontalFrame.new(@list_frame, :opts => LAYOUT_FILL_X, :padding => 0)
609
+ def removeValue(sender, sel, ptr)
610
+ item = @valueList.currentItem
611
+ if item >= 0 then
612
+ @valueList.removeItem(item)
613
+ end
614
+ end
750
615
 
751
- @new_list_item_dt = FXDataTarget.new('')
752
- @new_list_item = FXTextField.new(frame, 10,
753
- :target => @new_list_item_dt, :selector => FXDataTarget::ID_VALUE,
754
- :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_LEFT|LAYOUT_FILL_X)
755
- # FXLabel.new(frame, "Value: ")
756
- @addButton = FXButton.new(frame, "Add", nil, nil, 0, :opts => FRAME_RAISED|FRAME_THICK)
757
- @addButton.connect(SEL_COMMAND, method(:addValue))
758
- @remButton = FXButton.new(frame, "Remove", nil, nil, 0, :opts => FRAME_RAISED|FRAME_THICK)
759
- @remButton.connect(SEL_COMMAND, method(:removeValue))
760
-
761
- list_border = FXVerticalFrame.new(@list_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_GROOVE, :padding => 0)
762
- @valueList = FXList.new(list_border, :opts => LIST_EXTENDEDSELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y)
763
- @valueList.numVisible = 4
616
+ def addValue(sender, sel, ptr)
617
+ if @new_list_item_dt.value != '' then
618
+ index = @valueList.appendItem(@new_list_item_dt.value)
619
+ @valueList.makeItemVisible(index)
620
+ @new_list_item_dt.value = ''
621
+ @new_list_item.handle(self, FXSEL(SEL_UPDATE, 0), nil)
622
+ end
623
+ end
764
624
 
765
- @valueList.connect(SEL_COMMAND, method(:onValueSelect))
625
+ def createGenerator(fuzzer)
626
+ gen = case @source_dt.value
627
+ when 0
628
+ #puts "File Generator Selected"
629
+ Watobo::FuzzFile.new(fuzzer,
630
+ @source_file.value)
631
+ when 1
632
+ # counter selected
633
+ Watobo::FuzzCounter.new(fuzzer,
634
+ :start => @cstart.value.to_i,
635
+ :stop => @cstop.value.to_i,
636
+ #:count => @ccount.value.to_i,
637
+ :step => @cstep.value.to_i)
638
+ when 2
639
+
640
+ list = []
641
+ @valueList.each do |item|
642
+ # puts item
643
+ list.push item.text
644
+ end
645
+ Watobo::FuzzList.new(fuzzer, list)
646
+ end
766
647
 
767
- enableFrame(@file_select_frame)
768
- disableFrame(@counter_frame)
769
- disableFrame(@list_frame)
648
+ return gen
649
+ end
770
650
 
771
- updateFields()
651
+ def disableFrame(frame)
652
+ frame.children.each do |c|
653
+ c.children.each do |sc|
654
+ sc.disable
655
+ sc.selBackColor = sc.parent.backColor if sc.respond_to? :selBackColor
656
+ end
657
+ c.disable
658
+ c.selBackColor = c.parent.backColor if c.respond_to? :selBackColor
659
+ end
660
+ end
772
661
 
773
- end
662
+ def enableFrame(frame)
663
+ frame.children.each do |c|
664
+ c.children.each do |sc|
665
+ sc.enable
666
+ sc.selBackColor = FXColor::White if sc.respond_to? :selBackColor
667
+ end
668
+ c.enable
669
+ c.selBackColor = FXColor::White if c.respond_to? :selBackColor
670
+ end
774
671
  end
775
672
 
776
- class ActionSelect < FXVerticalFrame
777
- include Watobo
673
+ def initialize(owner, interface, opts)
674
+ super(owner, opts)
778
675
 
779
- def updateFields
780
- @b64_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
781
- @url_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
782
- @md5_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
783
- @ruby_proc_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
676
+ @interface = interface
784
677
 
785
- end
678
+ group_box = FXGroupBox.new(self, "Select Source", LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
679
+ @source_dt = FXDataTarget.new(0)
786
680
 
787
- def createAction()
788
- action = case @source_dt.value
681
+ @source_dt.connect(SEL_COMMAND) do
682
+ case @source_dt.value
789
683
  when 0
790
- action_proc = proc{ |input| Base64.encode64(input)}
791
- Action.new(action_proc, :action_type => 'Encode: Base64')
684
+ # puts "File"
685
+ enableFrame(@file_select_frame)
686
+ disableFrame(@counter_frame)
687
+ disableFrame(@list_frame)
792
688
  when 1
793
- action_proc = proc{ |input| CGI::escape(input)}
794
- Action.new(action_proc, :action_type => 'Encode: URL')
689
+ disableFrame(@file_select_frame)
690
+ disableFrame(@list_frame)
691
+ enableFrame(@counter_frame)
692
+ # puts "Generator"
795
693
  when 2
796
- action_proc = proc{ |input| Digest::MD5.hexdigest(input)}
797
- Action.new(action_proc, :action_type => 'Hash: MD5')
798
- when 3
799
- begin
800
- # puts "* Action: Proc"
801
- # puts @textbox.to_s
802
- code = @textbox.to_s
803
- action_proc = eval(code)
804
- # puts action_proc
805
-
806
- rescue SyntaxError => bang
807
- puts bang
808
- puts code
809
- rescue LocalJumpError => bang
810
- puts bang
811
- puts code
812
- rescue SecurityError => bang
813
- puts "desired functionality forbidden. it may harm your system!"
814
- puts code
815
- rescue => bang
816
- puts bang
817
- puts code
818
-
819
- end
820
- if action_proc
821
- Action.new(action_proc, :action_type => "Ruby: Proc", :info => "#{@textbox.to_s}")
822
- else
823
- nil
824
- end
825
- end
694
+ disableFrame(@counter_frame)
695
+ enableFrame(@list_frame)
696
+ disableFrame(@file_select_frame)
697
+ # puts "List"
698
+ end
699
+ @file_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
700
+ @gen_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
701
+ @list_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
702
+ end
703
+ file_rb_frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X)
704
+ @file_rb = FXRadioButton.new(file_rb_frame, "File", @source_dt, FXDataTarget::ID_OPTION)
705
+
706
+ @file_select_frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X, :padding => 0)
707
+ @source_file = FXDataTarget.new('')
708
+ @sourceFileText = FXTextField.new(@file_select_frame, 1, :target => @source_file, :selector => FXDataTarget::ID_VALUE,
709
+ :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
710
+ button = FXButton.new(@file_select_frame, "Select")
711
+ button.connect(SEL_COMMAND, method(:selectFile))
712
+
713
+ counter_rb_frame = FXHorizontalFrame.new(group_box, LAYOUT_FILL_X)
714
+ @gen_rb = FXRadioButton.new(counter_rb_frame, "Counter", @source_dt, FXDataTarget::ID_OPTION + 1)
715
+ @counter_frame = FXHorizontalFrame.new(group_box, LAYOUT_FILL_X, :padding => 0)
716
+
717
+ @cstep = FXDataTarget.new(0)
718
+ @cstepText = FXTextField.new(@counter_frame, 3, :target => @cstep, :selector => FXDataTarget::ID_VALUE,
719
+ :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_RIGHT)
720
+ FXLabel.new(@counter_frame, "Step", nil, :opts => LAYOUT_RIGHT)
721
+
722
+
723
+ @cstop = FXDataTarget.new(0)
724
+ @cstopText = FXTextField.new(@counter_frame, 3, :target => @cstop, :selector => FXDataTarget::ID_VALUE,
725
+ :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_RIGHT)
726
+ FXLabel.new(@counter_frame, "Stop", nil, :opts => LAYOUT_RIGHT)
727
+
728
+
729
+ @cstart = FXDataTarget.new(0)
730
+ @cstartText = FXTextField.new(@counter_frame, 3, :target => @cstart, :selector => FXDataTarget::ID_VALUE,
731
+ :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_RIGHT)
732
+ FXLabel.new(@counter_frame, "Start", nil, :opts => LAYOUT_RIGHT)
733
+
734
+ list_rb_frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
735
+ @list_rb = FXRadioButton.new(list_rb_frame, "List", @source_dt, FXDataTarget::ID_OPTION + 2)
736
+ @list_frame = FXVerticalFrame.new(list_rb_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
737
+ frame = FXHorizontalFrame.new(@list_frame, :opts => LAYOUT_FILL_X, :padding => 0)
738
+
739
+ @new_list_item_dt = FXDataTarget.new('')
740
+ @new_list_item = FXTextField.new(frame, 10,
741
+ :target => @new_list_item_dt, :selector => FXDataTarget::ID_VALUE,
742
+ :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_LEFT|LAYOUT_FILL_X)
743
+ # FXLabel.new(frame, "Value: ")
744
+ @addButton = FXButton.new(frame, "Add", nil, nil, 0, :opts => FRAME_RAISED|FRAME_THICK)
745
+ @addButton.connect(SEL_COMMAND, method(:addValue))
746
+ @remButton = FXButton.new(frame, "Remove", nil, nil, 0, :opts => FRAME_RAISED|FRAME_THICK)
747
+ @remButton.connect(SEL_COMMAND, method(:removeValue))
748
+
749
+ list_border = FXVerticalFrame.new(@list_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_GROOVE, :padding => 0)
750
+ @valueList = FXList.new(list_border, :opts => LIST_EXTENDEDSELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y)
751
+ @valueList.numVisible = 4
752
+
753
+ @valueList.connect(SEL_COMMAND, method(:onValueSelect))
754
+
755
+ enableFrame(@file_select_frame)
756
+ disableFrame(@counter_frame)
757
+ disableFrame(@list_frame)
758
+
759
+ updateFields()
826
760
 
827
- return action
828
- end
761
+ end
762
+ end
829
763
 
764
+ class ActionSelect < FXVerticalFrame
765
+ include Watobo
830
766
 
831
- def initialize(owner, interface, opts)
832
- super(owner, opts)
767
+ def updateFields
768
+ @b64_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
769
+ @url_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
770
+ @md5_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
771
+ @ruby_proc_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
833
772
 
834
- @interface = interface
773
+ end
835
774
 
836
- group_box = FXGroupBox.new(self, "Select Action", LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
837
- @source_dt = FXDataTarget.new(0)
775
+ def createAction()
776
+ action = case @source_dt.value
777
+ when 0
778
+ action_proc = proc { |input| Base64.encode64(input) }
779
+ Action.new(action_proc, :action_type => 'Encode: Base64')
780
+ when 1
781
+ action_proc = proc { |input| CGI::escape(input) }
782
+ Action.new(action_proc, :action_type => 'Encode: URL')
783
+ when 2
784
+ action_proc = proc { |input| Digest::MD5.hexdigest(input) }
785
+ Action.new(action_proc, :action_type => 'Hash: MD5')
786
+ when 3
787
+ begin
788
+ # puts "* Action: Proc"
789
+ # puts @textbox.to_s
790
+ code = @textbox.to_s
791
+ action_proc = eval(code)
792
+ # puts action_proc
793
+
794
+ rescue SyntaxError => bang
795
+ puts bang
796
+ puts code
797
+ rescue LocalJumpError => bang
798
+ puts bang
799
+ puts code
800
+ rescue SecurityError => bang
801
+ puts "desired functionality forbidden. it may harm your system!"
802
+ puts code
803
+ rescue => bang
804
+ puts bang
805
+ puts code
838
806
 
839
- @source_dt.connect(SEL_COMMAND) do
840
- @b64_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
841
- @url_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
842
- @md5_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
843
- @ruby_proc_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
844
- if @source_dt.value != 3
845
- @textbox.enabled = false
846
- @textbox.backColor = FXColor::LightGrey
847
- else
848
- @textbox.enabled = true
849
- @textbox.backColor = FXColor::White
850
- end
807
+ end
808
+ if action_proc
809
+ Action.new(action_proc, :action_type => "Ruby: Proc", :info => "#{@textbox.to_s}")
810
+ else
811
+ nil
812
+ end
813
+ end
851
814
 
852
- end
815
+ return action
816
+ end
853
817
 
854
- begin
855
- frame = FXVerticalFrame.new(group_box, LAYOUT_FILL_X)
856
- @b64_rb = FXRadioButton.new(frame, "Encode Base64", @source_dt, FXDataTarget::ID_OPTION)
857
818
 
858
- frame = FXVerticalFrame.new(group_box, LAYOUT_FILL_X)
859
- @url_rb = FXRadioButton.new(frame, "Encode URL", @source_dt, FXDataTarget::ID_OPTION + 1)
860
- # @textbox = FXText.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :width => 100, :height => 100)
819
+ def initialize(owner, interface, opts)
820
+ super(owner, opts)
861
821
 
862
- frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X)
863
- @md5_rb = FXRadioButton.new(frame, "Hash MD5", @source_dt, FXDataTarget::ID_OPTION + 2)
822
+ @interface = interface
864
823
 
865
- frame = FXVerticalFrame.new(group_box, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
866
- @ruby_proc_rb = FXRadioButton.new(frame, "Ruby Proc", @source_dt, FXDataTarget::ID_OPTION + 3)
867
- text_frame = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_SUNKEN, :padding => 0)
868
- @textbox = FXText.new(text_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :width => 100, :height => 100)
869
- proc_skeleton = "proc { |input|\n# place your code betweenhere\n# e.g. 'input + \"TAIL\"\n\n\n# and here\n}"
870
- @textbox.setText(proc_skeleton)
871
- @textbox.enabled = false
872
- @textbox.backColor = FXColor::LightGrey
824
+ group_box = FXGroupBox.new(self, "Select Action", LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
825
+ @source_dt = FXDataTarget.new(0)
873
826
 
827
+ @source_dt.connect(SEL_COMMAND) do
828
+ @b64_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
829
+ @url_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
830
+ @md5_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
831
+ @ruby_proc_rb.handle(self, FXSEL(SEL_UPDATE, 0), nil)
832
+ if @source_dt.value != 3
833
+ @textbox.enabled = false
834
+ @textbox.backColor = FXColor::LightGrey
835
+ else
836
+ @textbox.enabled = true
837
+ @textbox.backColor = FXColor::White
838
+ end
874
839
 
840
+ end
875
841
 
876
- # @textbox.editable = true
877
- rescue => bang
878
- puts "AAAAAA"
879
- puts bang
880
- end
881
- updateFields()
842
+ begin
843
+ frame = FXVerticalFrame.new(group_box, LAYOUT_FILL_X)
844
+ @b64_rb = FXRadioButton.new(frame, "Encode Base64", @source_dt, FXDataTarget::ID_OPTION)
882
845
 
883
- end
884
- end
846
+ frame = FXVerticalFrame.new(group_box, LAYOUT_FILL_X)
847
+ @url_rb = FXRadioButton.new(frame, "Encode URL", @source_dt, FXDataTarget::ID_OPTION + 1)
848
+ # @textbox = FXText.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :width => 100, :height => 100)
885
849
 
850
+ frame = FXHorizontalFrame.new(group_box, :opts => LAYOUT_FILL_X)
851
+ @md5_rb = FXRadioButton.new(frame, "Hash MD5", @source_dt, FXDataTarget::ID_OPTION + 2)
886
852
 
887
- class FuzzerGui < FXDialogBox
853
+ frame = FXVerticalFrame.new(group_box, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
854
+ @ruby_proc_rb = FXRadioButton.new(frame, "Ruby Proc", @source_dt, FXDataTarget::ID_OPTION + 3)
855
+ text_frame = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_SUNKEN, :padding => 0)
856
+ @textbox = FXText.new(text_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :width => 100, :height => 100)
857
+ proc_skeleton = "proc { |input|\n# place your code betweenhere\n# e.g. 'input + \"TAIL\"\n\n\n# and here\n}"
858
+ @textbox.setText(proc_skeleton)
859
+ @textbox.enabled = false
860
+ @textbox.backColor = FXColor::LightGrey
888
861
 
889
- include Watobo::Gui::Utils
890
- include Watobo::Gui::Icons
891
- include Watobo::Constants
892
862
 
893
- def onRequestReset(sender,sel,item)
894
- @requestEditor.setText(@request)
895
- end
863
+ # @textbox.editable = true
864
+ rescue => bang
865
+ puts "AAAAAA"
866
+ puts bang
867
+ end
868
+ updateFields()
896
869
 
897
- def hide()
898
- @scanner.cancel() if @scanner
899
- super
900
- end
870
+ end
871
+ end
901
872
 
902
- def listTags()
903
- tags = []
904
- tags.concat @sourceSelect.getTags()
905
- return tags
906
- end
907
873
 
908
- def initTable(table)
909
- table.clearItems()
910
- table.setTableSize(0, 2)
911
- table.visibleRows = 20
912
- table.rowHeader.width = 0
913
- table.setColumnText( 0, "Tag/Value" )
914
- table.setColumnText( 1, "Match" )
915
- end
874
+ class FuzzerGui < FXDialogBox
916
875
 
917
- def selectLogDirectory(sender, sel, item)
918
- workspace_dt = FXFileDialog.getOpenDirectory(self, "Select Log Directory", @log_dir_dt.value)
919
- if workspace_dt != "" then
920
- if File.exists?(workspace_dt) then
921
- @log_dir_dt.value = workspace_dt
922
- @log_dir_text.handle(self, FXSEL(SEL_UPDATE, 0), nil)
923
- end
924
- end
925
- end
876
+ include Watobo::Gui::Utils
877
+ include Watobo::Gui::Icons
878
+ include Watobo::Constants
926
879
 
927
- def saveMatches(sender, sel, ptr)
928
- begin
929
- # puts @project.settings[:session_path]
930
- # path = @project.settings[:session_path]+"/"
931
- filename = FXFileDialog.getSaveFilename(self, "Save file", nil, "All Files (*)")
932
- if filename != ""
933
- if File.exists?(filename)
934
- response = FXMessageBox.question(self, MBOX_YES_NO, "File exists", "Overwrite existing file?")
935
- return 0 if response != MBOX_CLICKED_YES
880
+ def onRequestReset(sender, sel, item)
881
+ @requestEditor.setText(@request)
882
+ end
936
883
 
937
- end
938
- r = []
939
- @matchTable.numRows.times do |i|
940
- #puts items[1].to_s
941
- tv = @matchTable.getItemData(i,0)
942
- data = @matchTable.getItemData(i,1)
943
- if data
944
- r << { :tag => tv, :data => data.strip }
945
- end
946
- end
947
- fh = File.new(filename, "w")
948
- fh.puts YAML.dump(r)
949
- fh.close
950
- end
951
- rescue => bang
952
- puts bang
953
- puts bang.backtrace if $DEBUG
954
- end
955
- end
884
+ def hide()
885
+ @scanner.cancel() if @scanner
886
+ super
887
+ end
956
888
 
957
- def startSample(count)
958
- #TODO: Create and viewer for sample requests
959
- end
889
+ def listTags()
890
+ tags = []
891
+ tags.concat @sourceSelect.getTags()
892
+ return tags
893
+ end
960
894
 
961
- def filterResponse(response, fuzzle)
895
+ def initTable(table)
896
+ table.clearItems()
897
+ table.setTableSize(0, 2)
898
+ table.visibleRows = 20
899
+ table.rowHeader.width = 0
900
+ table.setColumnText(0, "Tag/Value")
901
+ table.setColumnText(1, "Match")
902
+ end
962
903
 
963
- @filters.each do |f|
964
- matches = f.func.call(response) if f.func.respond_to? :call
965
- if matches.length > 0
904
+ def selectLogDirectory(sender, sel, item)
905
+ workspace_dt = FXFileDialog.getOpenDirectory(self, "Select Log Directory", @log_dir_dt.value)
906
+ if workspace_dt != "" then
907
+ if File.exists?(workspace_dt) then
908
+ @log_dir_dt.value = workspace_dt
909
+ @log_dir_text.handle(self, FXSEL(SEL_UPDATE, 0), nil)
910
+ end
911
+ end
912
+ end
966
913
 
967
- matches.each do |m|
968
- yield fuzzle, m
969
- end
914
+ def saveMatches(sender, sel, ptr)
915
+ begin
916
+ # puts @project.settings[:session_path]
917
+ # path = @project.settings[:session_path]+"/"
918
+ filename = FXFileDialog.getSaveFilename(self, "Save file", nil, "All Files (*)")
919
+ if filename != ""
920
+ if File.exists?(filename)
921
+ response = FXMessageBox.question(self, MBOX_YES_NO, "File exists", "Overwrite existing file?")
922
+ return 0 if response != MBOX_CLICKED_YES
970
923
 
971
- end
972
924
  end
925
+ r = []
926
+ @matchTable.numRows.times do |i|
927
+ #puts items[1].to_s
928
+ tv = @matchTable.getItemData(i, 0)
929
+ data = @matchTable.getItemData(i, 1)
930
+ if data
931
+ r << {:tag => tv, :data => data.strip}
932
+ end
933
+ end
934
+ fh = File.new(filename, "w")
935
+ fh.puts YAML.dump(r)
936
+ fh.close
937
+ end
938
+ rescue => bang
939
+ puts bang
940
+ puts bang.backtrace if $DEBUG
941
+ end
942
+ end
973
943
 
974
- end
944
+ def startSample(count)
945
+ #TODO: Create and viewer for sample requests
946
+ end
975
947
 
976
- def updateStatistics(request, response)
948
+ def filterResponse(response, fuzzle)
977
949
 
978
- end
950
+ @filters.each do |f|
951
+ matches = f.func.call(response) if f.func.respond_to? :call
952
+ if matches.length > 0
979
953
 
980
- def addMatch(fuzzle, match)
981
- s = []
982
- fuzzle.each_pair do |k, v|
983
- s.push "#{k}=#{v}"
954
+ matches.each do |m|
955
+ yield fuzzle, m
984
956
  end
985
- lastRowIndex = @matchTable.getNumRows
986
- @matchTable.appendRows(1)
987
- @matchTable.setItemText(lastRowIndex, 0, s.join("\n"))
988
- @matchTable.setItemData(lastRowIndex, 0, fuzzle )
989
- @matchTable.getItem(lastRowIndex, 0).justify = FXTableItem::LEFT
990
- @matchTable.fitRowsToContents(lastRowIndex)
991
- cell_text = match.gsub(/(\n+|\r+)/, " ")
992
- cell_text = ( cell_text.slice(0..150) + "..." ).strip if match.length > 150
993
- @matchTable.setItemText(lastRowIndex, 1, cell_text)
994
- @matchTable.setItemData(lastRowIndex, 1, match)
995
- @matchTable.getItem(lastRowIndex, 1).justify = FXTableItem::LEFT
996
- end
997
957
 
958
+ end
959
+ end
998
960
 
999
- def startFuzzing()
1000
- initTable(@matchTable)
961
+ end
1001
962
 
1002
- @log_viewer.log(LOG_INFO,"Prepare Fuzzing: Generators")
1003
- check_list = []
1004
- check_list << FuzzerCheck.new(@project, @fuzzer_tags, @filters, @requestEditor)
963
+ def updateStatistics(request, response)
1005
964
 
1006
- # create dummy chat, not needed for fuzzing
1007
- chat_list = []
1008
- chat_list << Watobo::Chat.new(@chat.request, @chat.response, :source => CHAT_SOURCE_FUZZER, :id => 0 )
965
+ end
1009
966
 
967
+ def addMatch(fuzzle, match)
968
+ s = []
969
+ fuzzle.each_pair do |k, v|
970
+ s.push "#{k}=#{v}"
971
+ end
972
+ lastRowIndex = @matchTable.getNumRows
973
+ @matchTable.appendRows(1)
974
+ @matchTable.setItemText(lastRowIndex, 0, s.join("\n"))
975
+ @matchTable.setItemData(lastRowIndex, 0, fuzzle)
976
+ @matchTable.getItem(lastRowIndex, 0).justify = FXTableItem::LEFT
977
+ @matchTable.fitRowsToContents(lastRowIndex)
978
+ cell_text = match.gsub(/(\n+|\r+)/, " ")
979
+ cell_text = (cell_text.slice(0..150) + "...").strip if match.length > 150
980
+ @matchTable.setItemText(lastRowIndex, 1, cell_text)
981
+ @matchTable.setItemData(lastRowIndex, 1, match)
982
+ @matchTable.getItem(lastRowIndex, 1).justify = FXTableItem::LEFT
983
+ end
1010
984
 
1011
985
 
986
+ def startFuzzing()
987
+ initTable(@matchTable)
988
+
989
+ @log_viewer.log(LOG_INFO, "Prepare Fuzzing: Generators")
990
+ check_list = []
991
+ check_list << FuzzerCheck.new(@project, @fuzzer_tags, @filters, @requestEditor)
992
+
993
+ # create dummy chat, not needed for fuzzing
994
+ chat_list = []
995
+ chat_list << Watobo::Chat.new(@chat.request, @chat.response, :source => CHAT_SOURCE_FUZZER, :id => 0)
996
+
997
+
998
+ scan_prefs = @project.getScanPreferences
999
+ # we don't want logout detection in manual requests ... yet
1000
+ scan_prefs[:logout_signatures] = []
1001
+ # scan_prefs[:csrf_requests] = @csrf_requests
1002
+ scan_prefs[:check_online] = false
1003
+ # check if logging all scan chat
1004
+
1005
+ if @logScanChats.checked?
1006
+ scan_prefs[:scanlog_name] = @log_dir_dt.value unless @log_dir_dt.value.empty?
1007
+ end
1008
+
1009
+ # @scanner = Watobo::Scanner2.new(chat_list, check_list, @project.passive_checks, scan_prefs)
1010
+ @scanner = Watobo::Scanner3.new(chat_list, check_list, [], scan_prefs)
1011
+ @pbar.total = @scanner.sum_total
1012
+ @pbar.progress = 0
1013
+ @pbar.barColor = 'red'
1014
+
1015
+ @scanner.subscribe(:progress) { |m|
1016
+ @pbar.increment(1)
1017
+ }
1018
+
1019
+ @stat_viewer.clearView
1020
+
1021
+ check_list.first.subscribe(:stats) { |response|
1022
+ @stat_viewer.addResponse(response)
1023
+ }
1024
+
1025
+ check_list.first.subscribe(:fuzzer_match) { |fuzzle, request, response, match|
1026
+ @stat_viewer.addResponse(response)
1027
+ addMatch(fuzzle, match)
1028
+
1029
+ }
1030
+
1031
+ # Thread.new {
1032
+ begin
1033
+ m = "start fuzzing..."
1034
+ @log_viewer.log(LOG_INFO, m)
1035
+ scan_prefs = Hash.new
1036
+ scan_prefs[:update_session] = @updateSession.checked?
1037
+ scan_prefs[:run_passive_checks] = false
1038
+ scan_prefs[:update_content_length] = @updateContentLength.checked?
1039
+
1040
+ puts scan_prefs.to_yaml
1041
+ puts "run scanner"
1042
+ @scanner.run(scan_prefs)
1043
+ #@fuzz_button.text = "Start"
1044
+ #@pbar.total = 0
1045
+ #@pbar.progress = 0
1046
+ #@pbar.barColor = 'grey'
1047
+ #m = "finished fuzzing!"
1048
+ #@log_viewer.log(LOG_INFO,m)
1049
+ rescue => bang
1050
+ puts bang
1051
+ puts bang.backtrace if $DEBUG
1052
+ end
1053
+ # }
1012
1054
 
1013
- scan_prefs = @project.getScanPreferences
1014
- # we don't want logout detection in manual requests ... yet
1015
- scan_prefs[:logout_signatures] = []
1016
- # scan_prefs[:csrf_requests] = @csrf_requests
1017
- scan_prefs[:check_online] = false
1018
- # check if logging all scan chat
1055
+ end
1019
1056
 
1020
- if @logScanChats.checked?
1021
- scan_prefs[:scanlog_name] = @log_dir_dt.value unless @log_dir_dt.value.empty?
1022
- end
1023
-
1024
- # @scanner = Watobo::Scanner2.new(chat_list, check_list, @project.passive_checks, scan_prefs)
1025
- @scanner = Watobo::Scanner3.new(chat_list, check_list , [], scan_prefs)
1026
- @pbar.total = @scanner.sum_total
1027
- @pbar.progress = 0
1028
- @pbar.barColor = 'red'
1029
1057
 
1030
- @scanner.subscribe(:progress) { |m|
1031
- @pbar.increment(1)
1032
- }
1058
+ def initialize(owner, project, chat)
1059
+ # Invoke base class initialize function first
1060
+ super(owner, "Fuzzer", :opts => DECOR_ALL, :width => 800, :height => 600)
1061
+ self.icon = ICON_FUZZER
1062
+ @project = project
1063
+ @chat = chat
1064
+ @request = chat.request.dup
1065
+ @fuzzing_paused = false
1066
+ @fuzzing_started = false
1067
+ @scan_status_lock = Mutex.new
1033
1068
 
1034
- @stat_viewer.clearView
1035
-
1036
- check_list.first.subscribe(:stats) { |response|
1037
- @stat_viewer.addResponse(response)
1038
- }
1039
-
1040
- check_list.first.subscribe(:fuzzer_match) { |fuzzle, request, response, match|
1041
- @stat_viewer.addResponse(response)
1042
- addMatch(fuzzle, match)
1069
+ # @scan_prefs = @project.getScanPreferences()
1043
1070
 
1044
- }
1071
+ @numRunningChecks = 0
1045
1072
 
1046
- # Thread.new {
1047
- begin
1048
- m = "start fuzzing..."
1049
- @log_viewer.log(LOG_INFO,m)
1050
- scan_prefs = Hash.new
1051
- scan_prefs[:update_session] = @updateSession.checked?
1052
- scan_prefs[:run_passive_checks] = false
1053
- scan_prefs[:update_content_length] = @updateContentLength.checked?
1054
-
1055
- puts scan_prefs.to_yaml
1056
- puts "run scanner"
1057
- @scanner.run(scan_prefs)
1058
- #@fuzz_button.text = "Start"
1059
- #@pbar.total = 0
1060
- #@pbar.progress = 0
1061
- #@pbar.barColor = 'grey'
1062
- #m = "finished fuzzing!"
1063
- #@log_viewer.log(LOG_INFO,m)
1064
- rescue => bang
1065
- puts bang
1066
- puts bang.backtrace if $DEBUG
1067
- end
1068
- # }
1069
-
1070
- end
1071
-
1072
-
1073
- def initialize(owner, project, chat)
1074
- # Invoke base class initialize function first
1075
- super(owner, "Fuzzer", :opts => DECOR_ALL,:width=>800, :height=>600)
1076
- self.icon = ICON_FUZZER
1077
- @project = project
1078
- @chat = chat
1079
- @request = chat.request.dup
1080
- @fuzzing_paused = false
1081
- @fuzzing_started = false
1082
- @scan_status_lock = Mutex.new
1083
-
1084
- # @scan_prefs = @project.getScanPreferences()
1085
-
1086
- @numRunningChecks = 0
1087
-
1088
- @fuzzer_tags = []
1089
- @filters = []
1090
- @scanner = nil
1091
-
1092
- # @fuzzels = FXDataTarget.new()
1093
-
1094
- mr_splitter = FXSplitter.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_VERTICAL|SPLITTER_REVERSED|SPLITTER_TRACKING)
1095
- # top = FXHorizontalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_SIDE_BOTTOM)
1096
- top_frame = FXVerticalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y||LAYOUT_FIX_HEIGHT|LAYOUT_BOTTOM,:height => 500)
1097
- top_splitter = FXSplitter.new(top_frame, LAYOUT_FILL_X|SPLITTER_HORIZONTAL|LAYOUT_FILL_Y|SPLITTER_TRACKING)
1098
-
1099
- log_frame = FXVerticalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM,:height => 100)
1100
-
1101
- #LAYOUT_FILL_X in combination with LAYOUT_FIX_WIDTH
1102
-
1103
- req_editor = FXVerticalFrame.new(top_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FIX_WIDTH|LAYOUT_FILL_Y|FRAME_GROOVE,:width => 400, :height => 500)
1104
-
1105
-
1106
-
1107
- req_edit_header = FXHorizontalFrame.new(req_editor, :opts => LAYOUT_FILL_X)
1108
- FXLabel.new(req_edit_header, "Request:" )
1109
- req_viewer = FXVerticalFrame.new(req_editor, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
1110
- req_reset_button = FXButton.new(req_edit_header, "Reset", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT)
1111
- req_reset_button.connect(SEL_COMMAND, method(:onRequestReset))
1112
-
1113
-
1114
- frame = FXHorizontalFrame.new(req_editor, :opts => LAYOUT_FILL_X|FRAME_GROOVE)
1115
- @fuzz_button = FXButton.new(frame, "Start", nil, nil, 0, FRAME_RAISED|FRAME_THICK)
1116
- @fuzz_button.connect(SEL_COMMAND) { |sender, sel, data|
1117
- if sender.text =~ /cancel/i then
1118
- @fuzz_button.text = "Start"
1119
- @log_viewer.log(LOG_INFO,"Fuzzing canceled!")
1120
- @scanner.cancel if @scanner
1121
- @pbar.progress = 0
1122
- @pbar.total = 0
1123
- @pbar.barColor=0
1124
- @pbar.barColor = 'grey' #FXRGB(255,0,0)
1125
- else
1126
- @fuzz_button.text = "Cancel"
1127
- startFuzzing()
1128
- @fuzz_button.text = "Start" if @scanner.nil?
1129
- end
1130
- }
1073
+ @fuzzer_tags = []
1074
+ @filters = []
1075
+ @scanner = nil
1076
+
1077
+ # @fuzzels = FXDataTarget.new()
1131
1078
 
1132
- @pbar = FXProgressBar.new(frame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK|PROGRESSBAR_HORIZONTAL)
1079
+ mr_splitter = FXSplitter.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_VERTICAL|SPLITTER_REVERSED|SPLITTER_TRACKING)
1080
+ # top = FXHorizontalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_SIDE_BOTTOM)
1081
+ top_frame = FXVerticalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y||LAYOUT_FIX_HEIGHT|LAYOUT_BOTTOM, :height => 500)
1082
+ top_splitter = FXSplitter.new(top_frame, LAYOUT_FILL_X|SPLITTER_HORIZONTAL|LAYOUT_FILL_Y|SPLITTER_TRACKING)
1133
1083
 
1084
+ log_frame = FXVerticalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM, :height => 100)
1085
+
1086
+ #LAYOUT_FILL_X in combination with LAYOUT_FIX_WIDTH
1087
+
1088
+ req_editor = FXVerticalFrame.new(top_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FIX_WIDTH|LAYOUT_FILL_Y|FRAME_GROOVE, :width => 400, :height => 500)
1089
+
1090
+
1091
+ req_edit_header = FXHorizontalFrame.new(req_editor, :opts => LAYOUT_FILL_X)
1092
+ FXLabel.new(req_edit_header, "Request:")
1093
+ req_viewer = FXVerticalFrame.new(req_editor, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
1094
+ req_reset_button = FXButton.new(req_edit_header, "Reset", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT)
1095
+ req_reset_button.connect(SEL_COMMAND, method(:onRequestReset))
1096
+
1097
+
1098
+ frame = FXHorizontalFrame.new(req_editor, :opts => LAYOUT_FILL_X|FRAME_GROOVE)
1099
+ @fuzz_button = FXButton.new(frame, "Start", nil, nil, 0, FRAME_RAISED|FRAME_THICK)
1100
+ @fuzz_button.connect(SEL_COMMAND) { |sender, sel, data|
1101
+ if sender.text =~ /cancel/i then
1102
+ @fuzz_button.text = "Start"
1103
+ @log_viewer.log(LOG_INFO, "Fuzzing canceled!")
1104
+ @scanner.cancel if @scanner
1134
1105
  @pbar.progress = 0
1135
1106
  @pbar.total = 0
1136
1107
  @pbar.barColor=0
1137
1108
  @pbar.barColor = 'grey' #FXRGB(255,0,0)
1138
- @requestEditor = FuzzRequestEditor.new(req_viewer, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
1139
- @requestEditor.setText(@request)
1140
-
1141
- # req_options = FXVerticalFrame.new(req_editor, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
1142
- #eq_options = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM)
1143
- opt = FXGroupBox.new(req_editor, "Fuzzing Options", LAYOUT_SIDE_BOTTOM|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
1144
-
1145
- # opt = FXVerticalFrame.new(frame,:opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
1146
- # btn = FXVerticalFrame.new(frame,:opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
1147
- #FXCheckButton.new(rob, "URL Encoding", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
1148
- @updateContentLength = FXCheckButton.new(opt, "Update Content-Length", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
1149
- @updateContentLength.checkState = true
1150
-
1151
- @updateSession = FXCheckButton.new(opt, "Update Session Information", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
1152
- @updateSession.checkState = true
1153
-
1154
- #@updateSession.connect(SEL_COMMAND) do |sender, sel, item|
1155
- # @runLogin.enabled = @updateSession.checked?
1156
- #end
1157
- # @runLogin = FXCheckButton.new(opt, "Run Login", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
1158
- # @runLogin.checkState = false
1159
-
1160
- @logScanChats = FXCheckButton.new(opt, "Log Scan", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
1161
- @logScanChats.checkState = false
1162
- @logScanChats.connect(SEL_COMMAND) do |sender, sel, item|
1163
- if @logScanChats.checked? then
1164
- @log_dir_text.enabled = true
1165
- @log_dir_label.enabled = true
1166
- # @log_dir_btn.enable
1167
- else
1168
- @log_dir_text.enabled = false
1169
- @log_dir_label.enabled = false
1170
- # @log_dir_btn.disable
1171
- end
1172
- end
1109
+ else
1110
+ @fuzz_button.text = "Cancel"
1111
+ startFuzzing()
1112
+ @fuzz_button.text = "Start" if @scanner.nil?
1113
+ end
1114
+ }
1115
+
1116
+ @pbar = FXProgressBar.new(frame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK|PROGRESSBAR_HORIZONTAL)
1117
+
1118
+ @pbar.progress = 0
1119
+ @pbar.total = 0
1120
+ @pbar.barColor=0
1121
+ @pbar.barColor = 'grey' #FXRGB(255,0,0)
1122
+ @requestEditor = FuzzRequestEditor.new(req_viewer, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
1123
+ @requestEditor.setText(@request)
1124
+
1125
+ # req_options = FXVerticalFrame.new(req_editor, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
1126
+ #eq_options = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM)
1127
+ opt = FXGroupBox.new(req_editor, "Fuzzing Options", LAYOUT_SIDE_BOTTOM|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
1128
+
1129
+ # opt = FXVerticalFrame.new(frame,:opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
1130
+ # btn = FXVerticalFrame.new(frame,:opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
1131
+ #FXCheckButton.new(rob, "URL Encoding", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
1132
+ @updateContentLength = FXCheckButton.new(opt, "Update Content-Length", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
1133
+ @updateContentLength.checkState = true
1134
+
1135
+ @updateSession = FXCheckButton.new(opt, "Update Session Information", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
1136
+ @updateSession.checkState = true
1137
+
1138
+ #@updateSession.connect(SEL_COMMAND) do |sender, sel, item|
1139
+ # @runLogin.enabled = @updateSession.checked?
1140
+ #end
1141
+ # @runLogin = FXCheckButton.new(opt, "Run Login", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
1142
+ # @runLogin.checkState = false
1143
+
1144
+ @logScanChats = FXCheckButton.new(opt, "Log Scan", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
1145
+ @logScanChats.checkState = false
1146
+ @logScanChats.connect(SEL_COMMAND) do |sender, sel, item|
1147
+ if @logScanChats.checked? then
1148
+ @log_dir_text.enabled = true
1149
+ @log_dir_label.enabled = true
1150
+ # @log_dir_btn.enable
1151
+ else
1152
+ @log_dir_text.enabled = false
1153
+ @log_dir_label.enabled = false
1154
+ # @log_dir_btn.disable
1155
+ end
1156
+ end
1173
1157
 
1174
1158
 
1175
- @log_dir_dt = FXDataTarget.new('')
1176
- # @log_dir_dt.value = @project.scanLogDirectory() if File.exist?(@project.scanLogDirectory())
1177
- @log_dir_label = FXLabel.new(opt, "Scan Name:" )
1178
- scanlog_frame = FXHorizontalFrame.new(opt,:opts => LAYOUT_FILL_X|LAYOUT_SIDE_TOP)
1179
- @log_dir_text = FXTextField.new(scanlog_frame, 20,
1180
- :target => @log_dir_dt, :selector => FXDataTarget::ID_VALUE,
1181
- :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN)
1182
- @log_dir_text.handle(self, FXSEL(SEL_UPDATE, 0), nil)
1183
- # @log_dir_btn = FXButton.new(scanlog_frame, "Change")
1184
- # @log_dir_btn.connect(SEL_COMMAND, method(:selectLogDirectory))
1159
+ @log_dir_dt = FXDataTarget.new('')
1160
+ # @log_dir_dt.value = @project.scanLogDirectory() if File.exist?(@project.scanLogDirectory())
1161
+ @log_dir_label = FXLabel.new(opt, "Scan Name:")
1162
+ scanlog_frame = FXHorizontalFrame.new(opt, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_TOP)
1163
+ @log_dir_text = FXTextField.new(scanlog_frame, 20,
1164
+ :target => @log_dir_dt, :selector => FXDataTarget::ID_VALUE,
1165
+ :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN)
1166
+ @log_dir_text.handle(self, FXSEL(SEL_UPDATE, 0), nil)
1167
+ # @log_dir_btn = FXButton.new(scanlog_frame, "Change")
1168
+ # @log_dir_btn.connect(SEL_COMMAND, method(:selectLogDirectory))
1185
1169
 
1186
- @log_dir_text.enabled = false
1187
- @log_dir_label.enabled = false
1188
- #@log_dir_btn.disable
1170
+ @log_dir_text.enabled = false
1171
+ @log_dir_label.enabled = false
1172
+ #@log_dir_btn.disable
1189
1173
 
1190
1174
 
1175
+ fuzz_setup_frame = FXVerticalFrame.new(top_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE|LAYOUT_FIX_WIDTH, :width => 400)
1191
1176
 
1177
+ @tabBook = FXTabBook.new(fuzz_setup_frame, nil, 0, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT)
1192
1178
 
1193
- fuzz_setup_frame = FXVerticalFrame.new(top_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE|LAYOUT_FIX_WIDTH, :width => 400)
1179
+ FXTabItem.new(@tabBook, "Settings", nil)
1180
+ rframe = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
1181
+ frame = FXVerticalFrame.new(rframe, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN, :padding => 0)
1182
+ @fuzzer_tree = FuzzerTree.new(frame, @project)
1194
1183
 
1195
- @tabBook = FXTabBook.new(fuzz_setup_frame, nil, 0, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT)
1184
+ @fuzzer_tree.subscribe(:new_tag) do |tag|
1185
+ @fuzzer_tags.push tag
1186
+ @requestEditor.addTag(tag.name)
1187
+ @requestEditor.highlightTags()
1188
+ end
1196
1189
 
1197
- FXTabItem.new(@tabBook, "Settings", nil)
1198
- rframe = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
1199
- frame = FXVerticalFrame.new(rframe, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN, :padding => 0)
1200
- @fuzzer_tree = FuzzerTree.new(frame, @project)
1190
+ @fuzzer_tree.subscribe(:remove_tag) do |tag|
1191
+ @fuzzer_tags.delete(tag)
1192
+ @requestEditor.removeTag(tag.name)
1193
+ @requestEditor.highlightTags()
1194
+ end
1201
1195
 
1202
- @fuzzer_tree.subscribe(:new_tag) do |tag|
1203
- @fuzzer_tags.push tag
1204
- @requestEditor.addTag(tag.name)
1205
- @requestEditor.highlightTags()
1206
- end
1196
+ @fuzzer_tree.subscribe(:new_filter) do |filter|
1197
+ @filters.push filter
1198
+ end
1207
1199
 
1208
- @fuzzer_tree.subscribe(:remove_tag) do |tag|
1209
- @fuzzer_tags.delete(tag)
1210
- @requestEditor.removeTag(tag.name)
1211
- @requestEditor.highlightTags()
1212
- end
1200
+ @fuzzer_tree.subscribe(:remove_filter) do |filter|
1201
+ @filters.delete(filter)
1202
+ end
1213
1203
 
1214
- @fuzzer_tree.subscribe(:new_filter) do |filter|
1215
- @filters.push filter
1216
- end
1204
+ FXTabItem.new(@tabBook, "Results", nil)
1205
+ rframe = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
1206
+ frame = FXVerticalFrame.new(rframe, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN, :padding => 0)
1207
+ @matchTable = FXTable.new(frame, :opts => TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2)
1208
+ initTable(@matchTable)
1217
1209
 
1218
- @fuzzer_tree.subscribe(:remove_filter) do |filter|
1219
- @filters.delete(filter)
1220
- end
1210
+ btnframe = FXHorizontalFrame.new(rframe, :opts => LAYOUT_FILL_X|FRAME_SUNKEN)
1211
+ button = FXButton.new(btnframe, "Save Matches", nil, nil, 0, FRAME_RAISED|FRAME_THICK)
1212
+
1213
+ button.connect(SEL_COMMAND, method(:saveMatches))
1214
+
1215
+ FXTabItem.new(@tabBook, "Statistics", nil)
1216
+ statframe = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
1217
+ @stat_viewer = StatisticsFrame.new(statframe, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED, :padding => 0)
1218
+ FXVerticalFrame.new(statframe, :opts => LAYOUT_FILL_X|LAYOUT_FIX_HEIGHT|FRAME_NONE, :height => 250)
1219
+
1220
+ log_frame_header = FXHorizontalFrame.new(log_frame, :opts => LAYOUT_FILL_X)
1221
+ FXLabel.new(log_frame_header, "Logs:")
1222
+ log_text_frame = FXVerticalFrame.new(log_frame, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_GROOVE, :padding => 0)
1223
+ @log_viewer = LogViewer.new(log_text_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
1224
+
1225
+ add_update_timer(250)
1226
+
1227
+ end
1228
+
1229
+ def add_update_timer(ms)
1230
+ Watobo.save_thread{
1231
+ unless @scanner.nil?
1232
+ @scan_status_lock.synchronize do
1233
+
1234
+ if @pbar.total > 0
1235
+ sum_progress = 0
1236
+ @scanner.progress.each_value do |v|
1237
+ sum_progress += v[:progress]
1238
+ end
1239
+ @pbar.progress = sum_progress
1240
+ end
1221
1241
 
1222
- FXTabItem.new(@tabBook, "Results", nil)
1223
- rframe = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
1224
- frame = FXVerticalFrame.new(rframe, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN, :padding => 0)
1225
- @matchTable = FXTable.new(frame, :opts => TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2)
1226
- initTable(@matchTable)
1227
-
1228
- btnframe = FXHorizontalFrame.new(rframe, :opts => LAYOUT_FILL_X|FRAME_SUNKEN)
1229
- button = FXButton.new(btnframe, "Save Matches", nil, nil, 0, FRAME_RAISED|FRAME_THICK)
1230
-
1231
- button.connect(SEL_COMMAND, method(:saveMatches))
1232
-
1233
- FXTabItem.new(@tabBook, "Statistics", nil)
1234
- statframe = FXVerticalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
1235
- @stat_viewer = StatisticsFrame.new(statframe, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED, :padding => 0)
1236
- FXVerticalFrame.new(statframe, :opts => LAYOUT_FILL_X|LAYOUT_FIX_HEIGHT|FRAME_NONE, :height => 250)
1237
-
1238
- log_frame_header = FXHorizontalFrame.new(log_frame, :opts => LAYOUT_FILL_X)
1239
- FXLabel.new(log_frame_header, "Logs:" )
1240
- log_text_frame = FXVerticalFrame.new(log_frame, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_GROOVE, :padding=>0)
1241
- @log_viewer = LogViewer.new(log_text_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
1242
-
1243
- add_update_timer(250)
1244
-
1245
- end
1246
-
1247
- def add_update_timer(ms)
1248
- @update_timer = FXApp.instance.addTimeout( ms, :repeat => true) {
1249
- unless @scanner.nil?
1250
- @scan_status_lock.synchronize do
1251
-
1252
- if @pbar.total > 0
1253
- sum_progress = 0
1254
- @scanner.progress.each_value do |v|
1255
- sum_progress += v[:progress]
1242
+ if @scanner.finished?
1243
+ @scanner = nil
1244
+ #logger("Scan Finished!")
1245
+ @log_viewer.log(LOG_INFO, "Done fuzzing!")
1246
+ @pbar.progress = 0
1247
+ @pbar.total = 0
1248
+ @pbar.barColor = 'grey' #FXRGB(255,0,0)
1249
+ # @btn_quickscan.text = "QuickScan"
1250
+ end
1256
1251
  end
1257
- @pbar.progress = sum_progress
1252
+
1258
1253
  end
1259
-
1260
- if @scanner.finished?
1261
- @scanner = nil
1262
- #logger("Scan Finished!")
1263
- @log_viewer.log(LOG_INFO,"Done fuzzing!")
1264
- @pbar.progress = 0
1265
- @pbar.total = 0
1266
- @pbar.barColor = 'grey' #FXRGB(255,0,0)
1267
- # @btn_quickscan.text = "QuickScan"
1268
- end
1269
- end
1270
-
1271
- end
1272
- }
1273
- end
1254
+ }
1274
1255
  end
1256
+ end
1275
1257
 
1276
- class FuzzerTree < FXTreeList
1277
- attr :fuzzTags
1278
- include Watobo::Gui::Icons
1258
+ class FuzzerTree < FXTreeList
1259
+ attr :fuzzTags
1260
+ include Watobo::Gui::Icons
1279
1261
 
1280
- def setup_listeners
1281
- @event_dispatcher_listeners = {}
1262
+ def setup_listeners
1263
+ @event_dispatcher_listeners = {}
1282
1264
 
1283
- end
1265
+ end
1284
1266
 
1285
- def subscribe(event, &callback)
1286
- (@event_dispatcher_listeners[event] ||= []) << callback
1287
- end
1267
+ def subscribe(event, &callback)
1268
+ (@event_dispatcher_listeners[event] ||= []) << callback
1269
+ end
1288
1270
 
1289
- def notify(event, *args)
1290
- if @event_dispatcher_listeners[event]
1291
- @event_dispatcher_listeners[event].each do |m|
1292
- m.call(*args) if m.respond_to? :call
1293
- end
1294
- end
1295
- end
1271
+ def notify(event, *args)
1272
+ if @event_dispatcher_listeners[event]
1273
+ @event_dispatcher_listeners[event].each do |m|
1274
+ m.call(*args) if m.respond_to? :call
1275
+ end
1276
+ end
1277
+ end
1296
1278
 
1297
1279
 
1298
- def addFilterItem(filter)
1280
+ def addFilterItem(filter)
1299
1281
 
1300
- filter_root = self.findItem("Filters", nil, SEARCH_FORWARD|SEARCH_IGNORECASE)
1282
+ filter_root = self.findItem("Filters", nil, SEARCH_FORWARD|SEARCH_IGNORECASE)
1301
1283
 
1302
- filter_item = self.appendItem(filter_root, "Filter: #{filter.filter_type}")
1303
- self.setItemData(filter_item, filter)
1304
- self.appendItem(filter_item, filter.info)
1305
- end
1284
+ filter_item = self.appendItem(filter_root, "Filter: #{filter.filter_type}")
1285
+ self.setItemData(filter_item, filter)
1286
+ self.appendItem(filter_item, filter.info)
1287
+ end
1306
1288
 
1307
1289
 
1308
- def addTag()
1309
- dlg = Watobo::Gui::CreateFuzzerDlg.new(self)
1310
- if dlg.execute != 0 then
1311
- tag = dlg.tag
1312
- tag_is_valid = true
1313
- @fuzzTags.each do |f|
1314
- tag_is_valid = false if f.name == tag
1315
- end
1316
- if tag_is_valid and tag != ""
1317
- new_fuzz_tag = FuzzerTag.new(tag)
1318
- @fuzzTags.push new_fuzz_tag
1319
- notify(:new_tag, new_fuzz_tag)
1320
- refresh()
1321
- else
1322
- puts "!!! Could not create empty/used tag !!!"
1323
- end
1324
- end
1325
- end
1290
+ def addTag()
1291
+ dlg = Watobo::Gui::CreateFuzzerDlg.new(self)
1292
+ if dlg.execute != 0 then
1293
+ tag = dlg.tag
1294
+ tag_is_valid = true
1295
+ @fuzzTags.each do |f|
1296
+ tag_is_valid = false if f.name == tag
1297
+ end
1298
+ if tag_is_valid and tag != ""
1299
+ new_fuzz_tag = FuzzerTag.new(tag)
1300
+ @fuzzTags.push new_fuzz_tag
1301
+ notify(:new_tag, new_fuzz_tag)
1302
+ refresh()
1303
+ else
1304
+ puts "!!! Could not create empty/used tag !!!"
1305
+ end
1306
+ end
1307
+ end
1326
1308
 
1327
- def addTagItem(tag)
1309
+ def addTagItem(tag)
1328
1310
 
1329
- tag_root = self.findItem("Tags", nil, SEARCH_FORWARD|SEARCH_IGNORECASE)
1311
+ tag_root = self.findItem("Tags", nil, SEARCH_FORWARD|SEARCH_IGNORECASE)
1330
1312
 
1331
- item = self.findItem(tag.name, tag_root, SEARCH_FORWARD|SEARCH_IGNORECASE)
1313
+ item = self.findItem(tag.name, tag_root, SEARCH_FORWARD|SEARCH_IGNORECASE)
1332
1314
 
1333
- return nil if item
1334
- tag_item = self.appendItem(tag_root, "Tag: #{tag.name}")
1335
- self.setItemData(tag_item, tag)
1315
+ return nil if item
1316
+ tag_item = self.appendItem(tag_root, "Tag: #{tag.name}")
1317
+ self.setItemData(tag_item, tag)
1336
1318
 
1337
- # item = self.appendItem(fuzz_item, "Generator", ICON_VULN, ICON_VULN)
1338
- # self.setItemData(item, :generator)
1319
+ # item = self.appendItem(fuzz_item, "Generator", ICON_VULN, ICON_VULN)
1320
+ # self.setItemData(item, :generator)
1339
1321
 
1340
- tag.generators.each do |gen|
1341
- addGeneratorItem(tag_item, gen)
1342
- end
1322
+ tag.generators.each do |gen|
1323
+ addGeneratorItem(tag_item, gen)
1324
+ end
1343
1325
 
1344
1326
 
1345
- end
1327
+ end
1346
1328
 
1347
- def initTree()
1348
- fuzz_item = self.appendItem(nil, "Tags", ICON_FUZZ_TAG, ICON_FUZZ_TAG)
1349
- self.setItemData(fuzz_item, :tags)
1329
+ def initTree()
1330
+ fuzz_item = self.appendItem(nil, "Tags", ICON_FUZZ_TAG, ICON_FUZZ_TAG)
1331
+ self.setItemData(fuzz_item, :tags)
1350
1332
 
1351
- item = self.appendItem(nil, "Filters", ICON_FUZZ_FILTER, ICON_FUZZ_FILTER)
1352
- self.setItemData(item, :filter)
1333
+ item = self.appendItem(nil, "Filters", ICON_FUZZ_FILTER, ICON_FUZZ_FILTER)
1334
+ self.setItemData(item, :filter)
1353
1335
 
1354
- #item = self.appendItem(nil, "Collector", ICON_INFO, ICON_INFO)
1355
- #self.setItemData(item, :collector)
1356
- end
1336
+ #item = self.appendItem(nil, "Collector", ICON_INFO, ICON_INFO)
1337
+ #self.setItemData(item, :collector)
1338
+ end
1357
1339
 
1358
- def addAction(generator)
1359
- dlg = Watobo::Gui::CreateActionDlg.new(self)
1360
- if dlg.execute != 0 then
1361
- puts "new action"
1362
- new_action = dlg.getAction()
1363
- generator.addAction(new_action) if new_action
1364
- refresh()
1365
- end
1366
- end
1340
+ def addAction(generator)
1341
+ dlg = Watobo::Gui::CreateActionDlg.new(self)
1342
+ if dlg.execute != 0 then
1343
+ puts "new action"
1344
+ new_action = dlg.getAction()
1345
+ generator.addAction(new_action) if new_action
1346
+ refresh()
1347
+ end
1348
+ end
1367
1349
 
1368
- def addGeneratorItem(tag_item, generator)
1369
- begin
1370
- item = self.appendItem(tag_item, generator.genType, ICON_FUZZ_GENERATOR, ICON_FUZZ_GENERATOR)
1371
- self.setItemData(item, generator)
1372
- self.appendItem(item, generator.info)
1373
-
1374
- generator.actions.each do |a|
1375
- action_item = self.appendItem(item, a.action_type, ICON_FUZZER, ICON_FUZZER)
1376
- self.setItemData(action_item, a)
1377
- self.appendItem(action_item, a.info)
1378
- end
1379
- self.expandTree(item)
1380
- rescue => bang
1381
- puts "!ERROR: could not add GeneratorItem"
1382
- puts bang
1383
- end
1384
- end
1385
-
1386
- def expandSubtree(item=nil)
1387
- if item
1388
- self.expandTree(item)
1389
- item.each do |child|
1390
- expandSubtree(child)
1391
- end
1392
- end
1393
- end
1350
+ def addGeneratorItem(tag_item, generator)
1351
+ begin
1352
+ item = self.appendItem(tag_item, generator.genType, ICON_FUZZ_GENERATOR, ICON_FUZZ_GENERATOR)
1353
+ self.setItemData(item, generator)
1354
+ self.appendItem(item, generator.info)
1394
1355
 
1395
- def expandSettings(item=nil)
1396
- self.each do |root_item|
1397
- expandSubtree(root_item)
1398
- end
1399
- end
1356
+ generator.actions.each do |a|
1357
+ action_item = self.appendItem(item, a.action_type, ICON_FUZZER, ICON_FUZZER)
1358
+ self.setItemData(action_item, a)
1359
+ self.appendItem(action_item, a.info)
1360
+ end
1361
+ self.expandTree(item)
1362
+ rescue => bang
1363
+ puts "!ERROR: could not add GeneratorItem"
1364
+ puts bang
1365
+ end
1366
+ end
1400
1367
 
1401
- def refresh()
1402
- self.clearItems()
1403
- initTree()
1404
- @fuzzTags.each do |f|
1405
- addTagItem(f)
1406
- end
1368
+ def expandSubtree(item=nil)
1369
+ if item
1370
+ self.expandTree(item)
1371
+ item.each do |child|
1372
+ expandSubtree(child)
1373
+ end
1374
+ end
1375
+ end
1407
1376
 
1408
- @filters.each do |f|
1409
- addFilterItem(f)
1410
- end
1377
+ def expandSettings(item=nil)
1378
+ self.each do |root_item|
1379
+ expandSubtree(root_item)
1380
+ end
1381
+ end
1411
1382
 
1412
- expandSettings()
1413
- end
1383
+ def refresh()
1384
+ self.clearItems()
1385
+ initTree()
1386
+ @fuzzTags.each do |f|
1387
+ addTagItem(f)
1388
+ end
1414
1389
 
1415
- def initialize(owner, project)
1416
- super(owner, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_RIGHT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT)
1417
- # f = Fuzzer.new("FUZZ")
1418
- @fuzzTags = []
1419
- @project = project
1420
- @filters = []
1390
+ @filters.each do |f|
1391
+ addFilterItem(f)
1392
+ end
1421
1393
 
1422
- setup_listeners()
1394
+ expandSettings()
1395
+ end
1423
1396
 
1424
- refresh()
1397
+ def initialize(owner, project)
1398
+ super(owner, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_RIGHT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT)
1399
+ # f = Fuzzer.new("FUZZ")
1400
+ @fuzzTags = []
1401
+ @project = project
1402
+ @filters = []
1425
1403
 
1404
+ setup_listeners()
1426
1405
 
1427
- self.connect(SEL_COMMAND) do |sender, sel, item|
1428
- if self.itemLeaf?(item)
1429
- getApp().beginWaitCursor do
1430
- begin
1431
- if item.data
1432
- if item.data.is_a? Finding
1433
- @interface.show_vuln(item.data)
1434
- end
1435
- end
1436
- rescue => bang
1437
- puts "!!! Error: could not show selected finding"
1438
- puts bang
1439
- end
1406
+ refresh()
1407
+
1408
+
1409
+ self.connect(SEL_COMMAND) do |sender, sel, item|
1410
+ if self.itemLeaf?(item)
1411
+ getApp().beginWaitCursor do
1412
+ begin
1413
+ if item.data
1414
+ if item.data.is_a? Finding
1415
+ @interface.show_vuln(item.data)
1440
1416
  end
1441
- elsif item.data == :title then
1442
- @interface.show_vuln(item.first.data) if item.first.data
1443
- end
1417
+ end
1418
+ rescue => bang
1419
+ puts "!!! Error: could not show selected finding"
1420
+ puts bang
1421
+ end
1444
1422
  end
1423
+ elsif item.data == :title then
1424
+ @interface.show_vuln(item.first.data) if item.first.data
1425
+ end
1426
+ end
1445
1427
 
1446
- self.connect(SEL_DOUBLECLICKED) do |sender, sel, item|
1447
- if self.itemLeaf?(item)
1448
- begin
1449
- if item.data and item.data.is_a? Symbol then
1450
- case item.data
1451
- when :tags
1452
- addTag()
1453
- when :filter
1454
- dlg = Watobo::Gui::CreateFilterDlg.new(self, @project)
1455
- if dlg.execute != 0 then
1456
- f = dlg.filter
1457
- notify(:new_filter, f)
1458
- @filters.push f
1459
- refresh()
1460
- end
1461
- end
1462
- elsif item.data.respond_to? :is_tag?
1463
- dlg = Watobo::Gui::CreateGeneratorDlg.new(self)
1464
- if dlg.execute != 0 then
1465
- # puts "new generator"
1466
- fuzzer = item.data
1467
- gen = dlg.getGenerator(fuzzer)
1468
- fuzzer.addGenerator(gen)
1469
- refresh()
1470
- end
1471
- elsif item.data.respond_to? :is_generator?
1472
- gen = item.data
1473
- addAction(gen)
1428
+ self.connect(SEL_DOUBLECLICKED) do |sender, sel, item|
1429
+ if self.itemLeaf?(item)
1430
+ begin
1431
+ if item.data and item.data.is_a? Symbol then
1432
+ case item.data
1433
+ when :tags
1434
+ addTag()
1435
+ when :filter
1436
+ dlg = Watobo::Gui::CreateFilterDlg.new(self, @project)
1437
+ if dlg.execute != 0 then
1438
+ f = dlg.filter
1439
+ notify(:new_filter, f)
1440
+ @filters.push f
1441
+ refresh()
1442
+ end
1443
+ end
1444
+ elsif item.data.respond_to? :is_tag?
1445
+ dlg = Watobo::Gui::CreateGeneratorDlg.new(self)
1446
+ if dlg.execute != 0 then
1447
+ # puts "new generator"
1448
+ fuzzer = item.data
1449
+ gen = dlg.getGenerator(fuzzer)
1450
+ fuzzer.addGenerator(gen)
1451
+ refresh()
1452
+ end
1453
+ elsif item.data.respond_to? :is_generator?
1454
+ gen = item.data
1455
+ addAction(gen)
1474
1456
 
1475
- else
1476
- puts "Unknown Object: #{item.data.class}"
1477
- end
1457
+ else
1458
+ puts "Unknown Object: #{item.data.class}"
1459
+ end
1478
1460
 
1479
- rescue => bang
1480
- puts "!!! Error: could not show selected finding"
1481
- puts bang
1482
- end
1483
- end
1461
+ rescue => bang
1462
+ puts "!!! Error: could not show selected finding"
1463
+ puts bang
1484
1464
  end
1465
+ end
1466
+ end
1467
+
1468
+ self.connect(SEL_RIGHTBUTTONRELEASE) do |sender, sel, event|
1469
+ unless event.moved?
1470
+ item = sender.getItemAt(event.win_x, event.win_y)
1471
+
1472
+ FXMenuPane.new(self) do |menu_pane|
1473
+ data = item ? self.getItemData(item) : nil
1474
+ if data.is_a? Symbol
1475
+ case data
1476
+ when :tags
1477
+
1478
+ m = FXMenuCommand.new(menu_pane, "Add Tag..")
1479
+ m.connect(SEL_COMMAND) {
1480
+ addTag()
1481
+ }
1482
+
1483
+ when :filter
1484
+
1485
+ m = FXMenuCommand.new(menu_pane, "Add Filter..")
1486
+ m.connect(SEL_COMMAND) {
1487
+ dlg = Watobo::Gui::CreateFilterDlg.new(self, @project)
1488
+ if dlg.execute != 0 then
1489
+ f = dlg.filter
1490
+ notify(:new_filter, f)
1491
+ @filters.push f
1492
+ refresh()
1493
+ end
1494
+ }
1495
+ end
1496
+ elsif data.respond_to? :is_tag?
1497
+ m = FXMenuCommand.new(menu_pane, "Add Generator..")
1498
+ m.connect(SEL_COMMAND) {
1499
+ dlg = Watobo::Gui::CreateGeneratorDlg.new(self)
1500
+ if dlg.execute != 0 then
1501
+ # puts "new generator"
1502
+ fuzzer = data
1503
+ gen = dlg.getGenerator(fuzzer)
1504
+ fuzzer.addGenerator(gen)
1505
+ refresh()
1506
+ end
1507
+ }
1508
+ m = FXMenuCommand.new(menu_pane, "Remove Tag")
1509
+ m.connect(SEL_COMMAND) {
1510
+ # puts "Removing Tag [#{data.name}]"
1511
+ if @fuzzTags.include?(data)
1512
+ # puts "...found tag"
1513
+ @fuzzTags.delete(data)
1514
+ end
1515
+ notify(:remove_tag, data)
1516
+ refresh()
1517
+ }
1518
+ elsif data.respond_to? :is_generator?
1519
+ m = FXMenuCommand.new(menu_pane, "Add Action..")
1520
+ m.connect(SEL_COMMAND) {
1521
+ gen = self.getItemData(item)
1522
+ addAction(gen)
1523
+ }
1524
+ m = FXMenuCommand.new(menu_pane, "Remove Generator")
1525
+ m.connect(SEL_COMMAND) {
1526
+ tag = self.getItemData(item.parent)
1527
+ tag.deleteGenerator(data)
1528
+ refresh()
1529
+ }
1530
+ elsif data.respond_to? :is_action?
1531
+ m = FXMenuCommand.new(menu_pane, "Remove Action")
1532
+ m.connect(SEL_COMMAND) {
1533
+ gen = self.getItemData(item.parent)
1534
+ gen.removeAction(data)
1535
+ refresh()
1536
+ }
1537
+ elsif data.respond_to? :is_filter?
1538
+ m = FXMenuCommand.new(menu_pane, "Remove Filter")
1539
+ m.connect(SEL_COMMAND) {
1540
+ @filters.delete(data)
1541
+ notify(:remove_filter, data)
1542
+ refresh()
1543
+ }
1544
+ else
1545
+ puts "Unknown Object: #{data.class}"
1546
+ end
1485
1547
 
1486
- self.connect(SEL_RIGHTBUTTONRELEASE) do |sender, sel, event|
1487
- unless event.moved?
1488
- item = sender.getItemAt(event.win_x, event.win_y)
1489
-
1490
- FXMenuPane.new(self) do |menu_pane|
1491
- data = item ? self.getItemData(item) : nil
1492
- if data.is_a? Symbol
1493
- case data
1494
- when :tags
1495
-
1496
- m = FXMenuCommand.new(menu_pane, "Add Tag.." )
1497
- m.connect(SEL_COMMAND) {
1498
- addTag()
1499
- }
1500
-
1501
- when :filter
1502
-
1503
- m = FXMenuCommand.new(menu_pane, "Add Filter.." )
1504
- m.connect(SEL_COMMAND) {
1505
- dlg = Watobo::Gui::CreateFilterDlg.new(self, @project)
1506
- if dlg.execute != 0 then
1507
- f = dlg.filter
1508
- notify(:new_filter, f)
1509
- @filters.push f
1510
- refresh()
1511
- end
1512
- }
1513
- end
1514
- elsif data.respond_to? :is_tag?
1515
- m = FXMenuCommand.new(menu_pane, "Add Generator.." )
1516
- m.connect(SEL_COMMAND) {
1517
- dlg = Watobo::Gui::CreateGeneratorDlg.new(self)
1518
- if dlg.execute != 0 then
1519
- # puts "new generator"
1520
- fuzzer = data
1521
- gen = dlg.getGenerator(fuzzer)
1522
- fuzzer.addGenerator(gen)
1523
- refresh()
1524
- end
1525
- }
1526
- m = FXMenuCommand.new(menu_pane, "Remove Tag" )
1527
- m.connect(SEL_COMMAND) {
1528
- # puts "Removing Tag [#{data.name}]"
1529
- if @fuzzTags.include?(data)
1530
- # puts "...found tag"
1531
- @fuzzTags.delete(data)
1532
- end
1533
- notify(:remove_tag, data)
1534
- refresh()
1535
- }
1536
- elsif data.respond_to? :is_generator?
1537
- m = FXMenuCommand.new(menu_pane, "Add Action.." )
1538
- m.connect(SEL_COMMAND) {
1539
- gen = self.getItemData(item)
1540
- addAction(gen)
1541
- }
1542
- m = FXMenuCommand.new(menu_pane, "Remove Generator" )
1543
- m.connect(SEL_COMMAND) {
1544
- tag = self.getItemData(item.parent)
1545
- tag.deleteGenerator(data)
1546
- refresh()
1547
- }
1548
- elsif data.respond_to? :is_action?
1549
- m = FXMenuCommand.new(menu_pane, "Remove Action" )
1550
- m.connect(SEL_COMMAND) {
1551
- gen = self.getItemData(item.parent)
1552
- gen.removeAction(data)
1553
- refresh()
1554
- }
1555
- elsif data.respond_to? :is_filter?
1556
- m = FXMenuCommand.new(menu_pane, "Remove Filter" )
1557
- m.connect(SEL_COMMAND) {
1558
- @filters.delete(data)
1559
- notify(:remove_filter, data)
1560
- refresh()
1561
- }
1562
- else
1563
- puts "Unknown Object: #{data.class}"
1564
- end
1565
-
1566
- menu_pane.create
1567
- menu_pane.popup(nil, event.root_x, event.root_y)
1548
+ menu_pane.create
1549
+ menu_pane.popup(nil, event.root_x, event.root_y)
1568
1550
 
1569
1551
 
1570
- app.runModalWhileShown(menu_pane)
1571
- end
1572
- end
1552
+ app.runModalWhileShown(menu_pane)
1573
1553
  end
1574
- end
1554
+ end
1555
+ end
1575
1556
  end
1576
- # namespace end
1577
- end
1557
+ end
1558
+ # namespace end
1559
+ end
1578
1560
 
1579
1561
  end