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,83 +1,74 @@
1
- #.
2
- # grabber.rb
3
- #.
4
- # Copyright 2014 by siberas, http://www.siberas.de
5
- # This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
6
- # WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
7
- # WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
8
- # You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
9
-
10
1
  # @private
11
- module Watobo#:nodoc: all
12
- module Crawler
13
- class Grabber
14
- def get_page(linkbag)
15
- begin
16
- return nil if linkbag.nil?
17
- return nil unless linkbag.respond_to? :link
18
- page = nil
19
-
20
- uri = linkbag.link
21
- uri = linkbag.link.uri if linkbag.link.respond_to? :uri
22
-
23
- unless @opts[:head_request_pattern].empty?
24
- pext = uri.path.match(/\.[^\.]*$/)
25
- unless pext.nil?
26
- if pext[0] =~ /\.#{@opts[:head_request_pattern]}/i
27
- page = @agent.head uri
28
- end
29
- end
30
- end
31
-
2
+ module Watobo#:nodoc: all
3
+ module Crawler
4
+ class Grabber
5
+ def get_page(linkbag)
6
+ begin
7
+ return nil if linkbag.nil?
8
+ return nil unless linkbag.respond_to? :link
9
+ page = nil
10
+
11
+ uri = linkbag.link
12
+ uri = linkbag.link.uri if linkbag.link.respond_to? :uri
13
+
14
+ unless @opts[:head_request_pattern].empty?
15
+ pext = uri.path.match(/\.[^\.]*$/)
16
+ unless pext.nil?
17
+ if pext[0] =~ /\.#{@opts[:head_request_pattern]}/i
18
+ page = @agent.head uri
19
+ end
20
+ end
21
+ end
22
+
32
23
  page = @agent.get uri if page.nil?
33
24
 
34
- Watobo::Crawler::Status.inc_requests
35
-
36
- sleep(@opts[:delay]/1000.0).round(3) if @opts[:delay] > 0
37
- return nil if page.nil?
38
- return PageBag.new( page, linkbag.depth+1 )
39
- rescue => bang
40
- puts bang #if $DEBUG
41
- puts bang.backtrace if $DEBUG
42
- end
43
- return nil
44
- end
45
-
46
- def run
47
- @grab_thread = Thread.new(@link_queue, @page_queue){ |lq, pq|
48
- loop do
49
- begin
50
- #link, referer, depth = lq.deq
51
- link = lq.deq
52
- next if link.depth > @opts[:max_depth]
53
- page = get_page(link)
54
- pq << page unless page.nil?
55
-
56
- rescue => bang
57
- puts bang
58
- puts bang.backtrace
59
- end
60
- end
25
+ Watobo::Crawler::Status.inc_requests
26
+
27
+ sleep(@opts[:delay]/1000.0).round(3) if @opts[:delay] > 0
28
+ return nil if page.nil?
29
+ return PageBag.new( page, linkbag.depth+1 )
30
+ rescue => bang
31
+ puts bang #if $DEBUG
32
+ puts bang.backtrace if $DEBUG
33
+ end
34
+ return nil
35
+ end
36
+
37
+ def run
38
+ @grab_thread = Thread.new(@link_queue, @page_queue){ |lq, pq|
39
+ loop do
40
+ begin
41
+ #link, referer, depth = lq.deq
42
+ link = lq.deq
43
+ next if link.depth > @opts[:max_depth]
44
+ page = get_page(link)
45
+ pq << page unless page.nil?
46
+
47
+ rescue => bang
48
+ puts bang
49
+ puts bang.backtrace
50
+ end
51
+ end
61
52
  }
62
- @grab_thread
63
- end
64
-
65
- def initialize(link_queue, page_queue, opts = {} )
66
- @link_queue = link_queue
67
- @page_queue = page_queue
53
+ @grab_thread
54
+ end
55
+
56
+ def initialize(link_queue, page_queue, opts = {} )
57
+ @link_queue = link_queue
58
+ @page_queue = page_queue
68
59
  @opts = opts
69
60
  @grab_thread = nil
70
-
71
- begin
72
- @agent = Crawler::Agent.new(@opts)
73
-
74
- rescue => bang
75
- puts bang
76
- puts bang.backtrace
77
- end
78
-
79
- end
80
-
81
- end
82
- end
83
- end
61
+
62
+ begin
63
+ @agent = Crawler::Agent.new(@opts)
64
+
65
+ rescue => bang
66
+ puts bang
67
+ puts bang.backtrace
68
+ end
69
+
70
+ end
71
+
72
+ end
73
+ end
74
+ end
@@ -1,82 +1,73 @@
1
- #.
2
- # status.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
1
+ module Watobo
2
+ module Crawler
3
+ module Status
4
+ include Watobo::Plugin::Crawler::Constants
9
5
 
10
- module Watobo
11
- module Crawler
12
- module Status
13
- include Watobo::Plugin::Crawler::Constants
14
-
15
- @status_lock = Mutex.new
16
- @request_count = 0
17
- @engine_status = CRAWL_NONE
18
- @page_size = 0
19
- @link_size = 0
20
-
21
- def self.reset
22
- @request_count = 0
23
- @engine_status = CRAWL_NONE
24
- @page_size = 0
25
- end
26
-
27
- def self.page_size=(ps)
28
- @status_lock.synchronize do
29
- @page_size= ps
30
- end
31
- true
32
- end
33
-
34
- def self.link_size=(ps)
35
- @status_lock.synchronize do
36
- @link_size= ps
37
- end
38
- true
39
- end
40
-
41
- def self.engine=(s)
42
- @status_lock.synchronize do
43
- @engine_status = s
44
- end
45
- end
46
-
47
- def self.engine
48
- e = nil
49
- @status_lock.synchronize do
50
- e = @engine_status
51
- end
52
- e
53
- end
54
-
55
- def self.inc_requests(i = 1)
56
- @status_lock.synchronize do
57
- @request_count += i
58
- end
59
- end
60
-
61
- def self.set(status)
62
- @status_lock.synchronize do
63
-
64
- end
65
- end
66
-
67
- def self.get
68
- s = {}
69
- @status_lock.synchronize do
70
- s = {
71
- :engine_status => @engine_status,
72
- :total_requests => @request_count,
73
- :page_size => @page_size,
74
- :link_size => @link_size
75
- # :skipped_domains => 0
76
- }
77
- end
78
- s
79
- end
80
- end
81
- end
6
+ @status_lock = Mutex.new
7
+ @request_count = 0
8
+ @engine_status = CRAWL_NONE
9
+ @page_size = 0
10
+ @link_size = 0
11
+
12
+ def self.reset
13
+ @request_count = 0
14
+ @engine_status = CRAWL_NONE
15
+ @page_size = 0
16
+ end
17
+
18
+ def self.page_size=(ps)
19
+ @status_lock.synchronize do
20
+ @page_size= ps
21
+ end
22
+ true
23
+ end
24
+
25
+ def self.link_size=(ps)
26
+ @status_lock.synchronize do
27
+ @link_size= ps
28
+ end
29
+ true
30
+ end
31
+
32
+ def self.engine=(s)
33
+ @status_lock.synchronize do
34
+ @engine_status = s
35
+ end
36
+ end
37
+
38
+ def self.engine
39
+ e = nil
40
+ @status_lock.synchronize do
41
+ e = @engine_status
42
+ end
43
+ e
44
+ end
45
+
46
+ def self.inc_requests(i = 1)
47
+ @status_lock.synchronize do
48
+ @request_count += i
49
+ end
50
+ end
51
+
52
+ def self.set(status)
53
+ @status_lock.synchronize do
54
+
55
+ end
56
+ end
57
+
58
+ def self.get
59
+ s = {}
60
+ @status_lock.synchronize do
61
+ s = {
62
+ :engine_status => @engine_status,
63
+ :total_requests => @request_count,
64
+ :page_size => @page_size,
65
+ :link_size => @link_size
66
+ # :skipped_domains => 0
67
+ }
68
+ end
69
+ s
70
+ end
71
+ end
72
+ end
82
73
  end
@@ -1,21 +1,12 @@
1
- #.
2
- # uri_mp.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
- module URI
11
- def site
12
- "#{self.host}:#{self.port}"
13
- end
14
-
15
- # path ( Monkey Patched )
16
- def path_mp
17
- #p = self.path
18
- self.path.gsub(/\/[^\/]*$/,'/')
19
-
20
- end
21
- end
1
+ module URI
2
+ def site
3
+ "#{self.host}:#{self.port}"
4
+ end
5
+
6
+ # path ( Monkey Patched )
7
+ def path_mp
8
+ #p = self.path
9
+ self.path.gsub(/\/[^\/]*$/,'/')
10
+
11
+ end
12
+ end
@@ -1,119 +1,109 @@
1
- #.
2
- # filefinder.rb
3
- #.
4
- # Copyright 2014 by siberas, http://www.siberas.de
5
- # This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
6
- # WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
7
- # WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
8
- # You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
9
-
10
1
  # @private
11
- module Watobo#:nodoc: all
2
+ module Watobo #:nodoc: all
12
3
  module Plugin
13
4
  module Filefinder
14
-
5
+
15
6
  class Check < Watobo::ActiveCheck
16
7
  attr_accessor :db_file
17
8
  attr_accessor :path
18
- attr_accessor :append_slash
19
-
9
+ attr_accessor :append_slash
10
+
20
11
  @info.update(
21
- :check_name => 'File Finder', # name of check which briefly describes functionality, will be used for tree and progress views
22
- :description => "Test list of file names.", # description of checkfunction
23
- :author => "Andreas Schmidt", # author of check
24
- :version => "1.0" # check version
25
- )
26
-
27
- @finding.update(
28
- :threat => 'Hidden files may reveal sensitive information or can enhance the attack surface.', # thread of vulnerability, e.g. loss of information
29
- :class => "Hidden-File", # vulnerability class, e.g. Stored XSS, SQL-Injection, ...
30
- :type => FINDING_TYPE_VULN, # FINDING_TYPE_HINT, FINDING_TYPE_INFO, FINDING_TYPE_VULN
31
- :rating => VULN_RATING_LOW
32
- )
33
-
12
+ :check_name => 'File Finder', # name of check which briefly describes functionality, will be used for tree and progress views
13
+ :description => "Test list of file names.", # description of checkfunction
14
+ :author => "Andreas Schmidt", # author of check
15
+ :version => "1.0" # check version
16
+ )
17
+
18
+ @finding.update(
19
+ :threat => 'Hidden files may reveal sensitive information or can enhance the attack surface.', # thread of vulnerability, e.g. loss of information
20
+ :class => "Hidden-File", # vulnerability class, e.g. Stored XSS, SQL-Injection, ...
21
+ :type => FINDING_TYPE_VULN, # FINDING_TYPE_HINT, FINDING_TYPE_INFO, FINDING_TYPE_VULN
22
+ :rating => VULN_RATING_LOW
23
+ )
24
+
34
25
  def add_extension(ext)
35
- ext.gsub!(/^\.+/,"")
26
+ ext.gsub!(/^\.+/, "")
36
27
  @extensions << ext
37
28
  end
38
-
29
+
39
30
  def set_extensions(extensions)
40
31
  @extensions = extensions if extensions.is_a? Array
41
32
  @extensions << nil
42
33
  end
43
-
34
+
44
35
  def initialize(project, file, prefs)
45
36
  super(project, prefs)
46
-
47
-
48
- @path = nil
37
+
38
+
39
+ @path = nil
49
40
  @db_file = file
50
41
  @prefs = prefs
51
- @extensions = [ nil ]
42
+ @extensions = [nil]
52
43
  @append_slash = false
53
44
  end
54
-
55
-
56
-
45
+
46
+
57
47
  def reset()
58
48
  # @catalog_checks.clear
59
49
  end
60
-
50
+
61
51
  def generateChecks(chat)
62
52
  begin
63
53
  puts "* generating checks for #{@db_file} ..."
64
54
  return false unless File.exist?(@db_file)
65
-
66
- content = File.readlines(@db_file)
67
-
55
+
56
+ content = File.readlines(@db_file)
57
+
68
58
  content.each do |uri|
69
- # puts "+ #{uri}"
70
- @extensions.each do |ext|
71
- # puts " + #{ext}"
72
- next if uri.strip =~ /^#/
73
- # cleanup dir
74
- uri.strip!
75
- uri.gsub!(/^[\/\.]+/,'')
76
- uri.gsub!(/\/$/,'')
77
- next if uri.strip.empty?
78
-
79
- checker = proc {
80
- test_request = nil
81
- test_response = nil
82
- # !!! ATTENTION !!!
83
- # MAKE COPY BEFORE MODIFIYING REQUEST
84
- test = chat.copyRequest
85
- new_uri = "#{uri}"
86
- unless ext.nil? or ext.empty?
87
- new_uri << ".#{ext}"
88
- end
89
- new_uri << "/" if @append_slash == true
90
- # puts ">> #{new_uri}"
91
- test.replaceFileExt(new_uri)
92
- # puts test.url
93
- status, test_request, test_response = fileExists?(test, @prefs)
94
-
95
-
96
- if status == true
97
-
98
- puts "FileFinder >> #{test.url}"
99
-
100
- addFinding( test_request, test_response,
101
- :test_item => new_uri,
102
- # :proof_pattern => "#{Regexp.quote(uri)}",
103
- :check_pattern => "#{Regexp.quote(new_uri)}",
104
- :chat => chat,
105
- :threat => "depends on the file ;)",
106
- :title => "[#{new_uri}]"
107
-
108
- )
109
-
110
- end
111
-
112
- # notify(:db_finished)
113
- [ test_request, test_response ]
114
- }
115
- yield checker
116
- end
59
+ # puts "+ #{uri}"
60
+ @extensions.each do |ext|
61
+ # puts " + #{ext}"
62
+ next if uri.strip =~ /^#/
63
+ # cleanup dir
64
+ uri.strip!
65
+ uri.gsub!(/^[\/\.]+/, '')
66
+ uri.gsub!(/\/$/, '')
67
+ next if uri.strip.empty?
68
+
69
+ checker = proc {
70
+ test_request = nil
71
+ test_response = nil
72
+ # !!! ATTENTION !!!
73
+ # MAKE COPY BEFORE MODIFIYING REQUEST
74
+ test = chat.copyRequest
75
+ new_uri = "#{uri}"
76
+ unless ext.nil? or ext.empty?
77
+ new_uri << ".#{ext}"
78
+ end
79
+ new_uri << "/" if @append_slash == true
80
+ # puts ">> #{new_uri}"
81
+ test.replaceFileExt(new_uri)
82
+ # puts test.url
83
+ status, test_request, test_response = fileExists?(test, @prefs)
84
+
85
+
86
+ if status == true
87
+
88
+ puts "FileFinder >> #{test.url}"
89
+
90
+ addFinding(test_request, test_response,
91
+ :test_item => new_uri,
92
+ # :proof_pattern => "#{Regexp.quote(uri)}",
93
+ :check_pattern => "#{Regexp.quote(new_uri)}",
94
+ :chat => chat,
95
+ :threat => "depends on the file ;)",
96
+ :title => "[#{new_uri}]"
97
+
98
+ )
99
+
100
+ end
101
+
102
+ # notify(:db_finished)
103
+ [test_request, test_response]
104
+ }
105
+ yield checker
106
+ end
117
107
  end
118
108
  rescue => bang
119
109
  puts "!error in module #{Module.nesting[0].name}"
@@ -121,27 +111,27 @@ module Watobo#:nodoc: all
121
111
  end
122
112
  end
123
113
  end
124
-
114
+
125
115
  class Filefinder < Watobo::Template::Plugin
126
-
127
- include Watobo::Constants
116
+
117
+ include Watobo::Constants
128
118
  class DBSelectFrame < FXVerticalFrame
129
-
119
+
130
120
  def select_db(db_name)
131
121
  @db_listbox.numItems.times do |i|
132
122
  if db_name == @db_listbox.getItemData(i)
133
123
  @db_listbox.currentItem = i
134
124
  end
135
- end
125
+ end
136
126
  end
137
-
127
+
138
128
  def get_db_name
139
129
  i = @db_listbox.currentItem
140
130
  db = ''
141
131
  db = @db_listbox.getItemData(i) if i >= 0
142
132
  db
143
133
  end
144
-
134
+
145
135
  def get_db_list
146
136
  l = []
147
137
  @db_listbox.numItems.times do |i|
@@ -149,163 +139,167 @@ module Watobo#:nodoc: all
149
139
  end
150
140
  l
151
141
  end
152
-
142
+
153
143
  def initialize(parent, db_list, opts)
154
144
  super(parent, opts)
155
145
  @db_list = []
156
146
  db_list.each do |f|
157
147
  @db_list << f if File.exist? f
158
148
  end
159
-
160
- FXLabel.new(self, "Each filename must be in a seperate line, e.g. DirBuster-DBs" )
149
+
150
+ FXLabel.new(self, "Each filename must be in a seperate line, e.g. DirBuster-DBs")
161
151
  frame = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X)
162
-
152
+
163
153
  @db_listbox = FXListBox.new(frame, :opts => LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK)
164
154
  @db_list.each do |db|
165
155
  item = @db_listbox.appendItem(db)
166
- @db_listbox.setItemData(@db_listbox.numItems-1, db )
156
+ @db_listbox.setItemData(@db_listbox.numItems-1, db)
167
157
  end
168
158
  @db_listbox.numVisible = @db_listbox.numItems
169
-
159
+
170
160
  @add_db_btn = FXButton.new(frame, "add")
171
161
  @add_db_btn.connect(SEL_COMMAND) { add_db }
172
162
  end
173
-
163
+
174
164
  private
175
-
165
+
176
166
  def add_db
177
167
  db_path = File.dirname(get_db_name)
178
- db = FXFileDialog.getOpenFilename(self, "Open DB", db_path, "All Files (*)")
179
- unless db.empty?
180
- item = @db_listbox.appendItem(db)
181
- i= @db_listbox.numItems-1
182
- @db_listbox.setItemData(i, db )
168
+ db = FXFileDialog.getOpenFilename(self, "Open DB", db_path, "All Files (*)")
169
+ unless db.empty?
170
+ item = @db_listbox.appendItem(db)
171
+ i= @db_listbox.numItems-1
172
+ @db_listbox.setItemData(i, db)
183
173
  @db_listbox.currentItem = i
174
+ end
184
175
  end
185
176
  end
186
- end
187
-
177
+
188
178
  def updateView()
189
179
  #@project = project
190
180
  @sites_combo.clearItems()
191
181
  @dir_combo.clearItems()
192
182
  @dir_combo.disable
193
-
194
-
195
- @sites_combo.appendItem("no site selected", nil)
196
- Watobo::Chats.sites(:in_scope => Watobo::Scope.exist? ).each do |site|
197
- #puts "Site: #{site}"
198
- @sites_combo.appendItem(site.slice(0..35), site)
199
- end
200
- @sites_combo.setCurrentItem(0) if @sites_combo.numItems > 0
201
- ci = @sites_combo.currentItem
202
- site = ( ci >= 0 ) ? @sites_combo.getItemData(ci) : nil
203
- @sites_combo.numVisible = @sites_combo.numItems
204
- @sites_combo.numColumns = 35
205
-
206
- if site
207
- @dir_combo.enable
208
- Watobo::Chats.dirs(@site) do |dir|
209
- @dir_combo.appendItem(dir.slice(0..35), dir)
210
- end
211
- @dir_combo.setCurrentItem(0, true) if @dir_combo.numItems > 0
212
-
183
+
184
+
185
+ @sites_combo.appendItem("no site selected", nil)
186
+ Watobo::Chats.sites(:in_scope => Watobo::Scope.exist?).each do |site|
187
+ #puts "Site: #{site}"
188
+ @sites_combo.appendItem(site.slice(0..35), site)
189
+ end
190
+ @sites_combo.setCurrentItem(0) if @sites_combo.numItems > 0
191
+ ci = @sites_combo.currentItem
192
+ site = (ci >= 0) ? @sites_combo.getItemData(ci) : nil
193
+ @sites_combo.numVisible = @sites_combo.numItems
194
+ @sites_combo.numColumns = 35
195
+
196
+ if site
197
+ @dir_combo.enable
198
+ Watobo::Chats.dirs(@site) do |dir|
199
+ @dir_combo.appendItem(dir.slice(0..35), dir)
213
200
  end
201
+ @dir_combo.setCurrentItem(0, true) if @dir_combo.numItems > 0
202
+
203
+ end
214
204
  end
215
-
216
-
205
+
206
+
217
207
  def initialize(owner, project)
218
- super(owner, "File Finder", project, :opts => DECOR_ALL, :width=>800, :height=>600)
208
+ super(owner, "File Finder", project, :opts => DECOR_ALL, :width => 800, :height => 600)
219
209
  load_icon(__FILE__)
220
-
210
+
221
211
  @event_dispatcher_listeners = Hash.new
222
212
  @scanner = nil
223
213
  @plugin_name = "File-Finder"
224
214
  @project = project
225
215
  @path = Dir.getwd
226
-
227
-
216
+
217
+
228
218
  @site = nil
229
219
  @dir = nil
230
220
  @db_list = []
231
221
  @db_name = ""
232
222
  @file_name = ""
233
-
223
+
234
224
  config = load_config
235
225
 
236
-
226
+
237
227
  if config.respond_to? :has_key?
238
- if config.has_key? :db_list
239
- config[:db_list].each do |db|
240
- @db_list << db if File.exist? db
228
+ if config.has_key? :db_list
229
+ config[:db_list].each do |db|
230
+ @db_list << db if File.exist? db
231
+ end
241
232
  end
242
- end
243
-
244
- if config.has_key? :name
245
- @db_list.each do |db|
246
- @db_name = db if config[:name] == db
233
+
234
+ if config.has_key? :name
235
+ @db_list.each do |db|
236
+ @db_name = db if config[:name] == db
237
+ end
238
+ @file_name = config[:name] if @db_name.empty?
247
239
  end
248
- @file_name = config[:name] if @db_name.empty?
249
240
  end
241
+
242
+ # load predefined dbs
243
+ db_path = File.expand_path(File.join(File.dirname(__FILE__), 'dbs'))
244
+ Dir.glob("#{db_path}/*").each do |db|
245
+ @db_list << db
250
246
  end
251
- puts @db_list
252
-
253
- begin
247
+
248
+ begin
254
249
  hs_green = FXHiliteStyle.new
255
- hs_green.normalForeColor = FXRGBA(255,255,255,255) #FXColor::Red
256
- hs_green.normalBackColor = FXRGBA(0,255,0,1) # FXColor::White
250
+ hs_green.normalForeColor = FXRGBA(255, 255, 255, 255) #FXColor::Red
251
+ hs_green.normalBackColor = FXRGBA(0, 255, 0, 1) # FXColor::White
257
252
  hs_green.style = FXText::STYLE_BOLD
258
-
253
+
259
254
  hs_red = FXHiliteStyle.new
260
- hs_red.normalForeColor = FXRGBA(255,255,255,255) # FXColor::Red
261
- hs_red.normalBackColor = FXRGBA(255,0,0,1) # FXColor::White
255
+ hs_red.normalForeColor = FXRGBA(255, 255, 255, 255) # FXColor::Red
256
+ hs_red.normalBackColor = FXRGBA(255, 0, 0, 1) # FXColor::White
262
257
  hs_red.style = FXText::STYLE_BOLD
263
-
264
-
258
+
259
+
265
260
  path = Dir.getwd
266
-
261
+
267
262
  mr_splitter = FXSplitter.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_VERTICAL|SPLITTER_REVERSED|SPLITTER_TRACKING)
268
263
  # top = FXHorizontalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_SIDE_BOTTOM)
269
- top_frame = FXVerticalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y||LAYOUT_FIX_HEIGHT|LAYOUT_BOTTOM,:height => 500)
264
+ top_frame = FXVerticalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y||LAYOUT_FIX_HEIGHT|LAYOUT_BOTTOM, :height => 500)
270
265
  top_splitter = FXSplitter.new(top_frame, LAYOUT_FILL_X|SPLITTER_HORIZONTAL|LAYOUT_FILL_Y|SPLITTER_TRACKING)
271
- log_frame = FXVerticalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM,:height => 100)
272
-
266
+ log_frame = FXVerticalFrame.new(mr_splitter, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_BOTTOM, :height => 100)
267
+
273
268
  @settings_tab = FXTabBook.new(top_splitter, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
274
- FXTabItem.new(@settings_tab, "Settings", nil)
269
+ FXTabItem.new(@settings_tab, "Settings", nil)
275
270
  @settings_frame = FXVerticalFrame.new(@settings_tab, :opts => LAYOUT_FILL_Y|LAYOUT_FILL_Y|FRAME_RAISED)
276
-
271
+
277
272
  FXTabItem.new(@settings_tab, "Logging", nil)
278
273
  @logging_frame = FXVerticalFrame.new(@settings_tab, :opts => LAYOUT_FILL_Y|LAYOUT_FILL_Y|FRAME_RAISED)
279
-
280
- request_frame = FXVerticalFrame.new(top_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
281
- @requestCombo = FXComboBox.new(request_frame, 5, nil, 0,
274
+
275
+ request_frame = FXVerticalFrame.new(top_splitter, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
276
+ @requestCombo = FXComboBox.new(request_frame, 5, nil, 0,
282
277
  COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
283
278
  #@filterCombo.width =200
284
-
279
+
285
280
  @requestCombo.numVisible = 0
286
281
  @requestCombo.numColumns = 50
287
282
  @requestCombo.editable = false
288
283
  @requestCombo.connect(SEL_COMMAND, method(:onSelectRequest))
289
-
290
- log_text_frame = FXVerticalFrame.new(request_frame, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding=>0)
284
+
285
+ log_text_frame = FXVerticalFrame.new(request_frame, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
291
286
  @request_editor = RequestEditor.new(log_text_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
292
-
293
- # @scope_only_cb = FXCheckButton.new(@settings_frame, "target scope only", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
294
- # @scope_only_cb.setCheck(false)
295
- # @scope_only_cb.connect(SEL_COMMAND) { updateView() }
296
-
287
+
288
+ # @scope_only_cb = FXCheckButton.new(@settings_frame, "target scope only", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
289
+ # @scope_only_cb.setCheck(false)
290
+ # @scope_only_cb.connect(SEL_COMMAND) { updateView() }
291
+
297
292
  FXLabel.new(@settings_frame, "Select Site:")
298
293
  @sites_combo = FXComboBox.new(@settings_frame, 5, nil, 0,
299
294
  COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
300
295
  #@filterCombo.width =200
301
-
296
+
302
297
  @sites_combo.numVisible = 20
303
298
  @sites_combo.numColumns = 35
304
299
  @sites_combo.editable = false
305
300
  @sites_combo.connect(SEL_COMMAND, method(:onSiteSelect))
306
-
307
-
308
-
301
+
302
+
309
303
  FXLabel.new(@settings_frame, "Root Directory:")
310
304
  @dir_combo = FXComboBox.new(@settings_frame, 5, nil, 0,
311
305
  COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
@@ -313,43 +307,43 @@ module Watobo#:nodoc: all
313
307
  @dir_combo.numColumns = 35
314
308
  @dir_combo.editable = false
315
309
  @dir_combo.connect(SEL_COMMAND, method(:onDirSelect))
316
-
310
+
317
311
  @test_all_dirs = FXCheckButton.new(@settings_frame, "test all sub-directories", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
318
312
  @test_all_dirs.setCheck(false)
319
-
320
-
313
+
314
+
321
315
  @finder_tab = FXTabBook.new(@settings_frame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT)
322
-
316
+
323
317
  FXTabItem.new(@finder_tab, "Filename", nil)
324
318
  frame = FXVerticalFrame.new(@finder_tab, :opts => LAYOUT_FILL_X|FRAME_RAISED)
325
319
  @search_name_dt = FXDataTarget.new(@file_name)
326
-
320
+
327
321
  @dbfile_text = FXTextField.new(frame, 30,
328
322
  :target => @search_name_dt, :selector => FXDataTarget::ID_VALUE,
329
323
  :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X)
330
324
  @dbfile_text.handle(self, FXSEL(SEL_UPDATE, 0), nil)
331
-
332
325
 
333
- FXTabItem.new(@finder_tab, "Database", nil)
326
+
327
+ FXTabItem.new(@finder_tab, "Database", nil)
334
328
  @db_select_frame = DBSelectFrame.new(@finder_tab, @db_list, :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X)
335
-
329
+
336
330
  unless @db_name.empty?
337
331
  @db_select_frame.select_db @db_name
338
332
  @finder_tab.current = 1
339
333
  end
340
-
334
+
341
335
  @fmode_dt = FXDataTarget.new(0)
342
336
  group_box = FXGroupBox.new(@settings_frame, "Mode", LAYOUT_SIDE_TOP|FRAME_GROOVE|LAYOUT_FILL_X, 0, 0, 0, 0)
343
337
  mode_frame = FXVerticalFrame.new(group_box, :opts => LAYOUT_FILL_X)
344
338
  @append_slash_cb = FXCheckButton.new(mode_frame, "append /", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|LAYOUT_FILL_Y)
345
-
339
+
346
340
  @append_extensions_cb = FXCheckButton.new(mode_frame, "append extensions", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|LAYOUT_FILL_Y)
347
341
  frame = FXVerticalFrame.new(mode_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
348
342
  @extensions_text = FXText.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP)
349
- ext = "bak;php;asp;aspx;tgz;tar.gz;gz;tmp;temp;old;_"
350
-
343
+ ext = "bak;php;asp;aspx;tgz;tar.gz;gz;tmp;temp;old;_"
344
+
351
345
  @extensions_text.setText(ext)
352
-
346
+
353
347
  frame = @logging_frame
354
348
  @logScanChats = FXCheckButton.new(frame, "enable", nil, 0, JUSTIFY_LEFT|JUSTIFY_TOP|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP)
355
349
  @logScanChats.checkState = false
@@ -360,43 +354,43 @@ module Watobo#:nodoc: all
360
354
  @scanlog_name_text.backColor = FXColor::White
361
355
  else
362
356
  @scanlog_name_text.enabled = false
363
- @scanlog_name_text.backColor = @scanlog_name_text.parent.backColor
357
+ @scanlog_name_text.backColor = @scanlog_name_text.parent.backColor
364
358
  end
365
359
  end
366
360
 
367
361
  @scanlog_name_dt = FXDataTarget.new('')
368
- # @scanlog_name_dt.value = @project.scanLogDirectory() if File.exist?(@project.scanLogDirectory())
369
- @scanlog_dir_label = FXLabel.new(frame, "Scan Name:" )
370
- scanlog_frame = FXHorizontalFrame.new(frame,:opts => LAYOUT_FILL_X|LAYOUT_SIDE_TOP)
362
+ # @scanlog_name_dt.value = @project.scanLogDirectory() if File.exist?(@project.scanLogDirectory())
363
+ @scanlog_dir_label = FXLabel.new(frame, "Scan Name:")
364
+ scanlog_frame = FXHorizontalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_TOP)
371
365
  @scanlog_name_text = FXTextField.new(scanlog_frame, 20,
372
- :target => @scanlog_name_dt, :selector => FXDataTarget::ID_VALUE,
373
- :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X)
366
+ :target => @scanlog_name_dt, :selector => FXDataTarget::ID_VALUE,
367
+ :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X)
374
368
  @scanlog_name_text.handle(self, FXSEL(SEL_UPDATE, 0), nil)
375
369
  unless @logScanChats.checked?
376
370
  @scanlog_name_text.enabled = false
377
371
  @scanlog_name_text.backColor = @scanlog_name_text.parent.backColor
378
- end
379
-
380
-
372
+ end
373
+
374
+
381
375
  @pbar = FXProgressBar.new(@settings_frame, nil, 0, LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK|PROGRESSBAR_HORIZONTAL)
382
376
  @pbar.progress = 0
383
377
  @pbar.total = 0
384
378
  @pbar.barColor=0
385
379
  @pbar.barColor = 'grey' #FXRGB(255,0,0)
386
-
380
+
387
381
  @speed = FXLabel.new(@settings_frame, "Checks per second: -")
388
382
  @speed.disable
389
-
383
+
390
384
  @start_button = FXButton.new(@settings_frame, "start")
391
385
  @start_button.connect(SEL_COMMAND, method(:start))
392
386
  @start_button.disable
393
-
387
+
394
388
  log_frame_header = FXHorizontalFrame.new(log_frame, :opts => LAYOUT_FILL_X)
395
- FXLabel.new(log_frame_header, "Logs:" )
396
-
397
- log_text_frame = FXVerticalFrame.new(log_frame, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding=>0)
389
+ FXLabel.new(log_frame_header, "Logs:")
390
+
391
+ log_text_frame = FXVerticalFrame.new(log_frame, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
398
392
  @log_viewer = LogViewer.new(log_text_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
399
-
393
+
400
394
  updateView()
401
395
  start_update_timer()
402
396
  rescue => bang
@@ -404,39 +398,38 @@ module Watobo#:nodoc: all
404
398
  puts bang.backtrace if $DEBUG
405
399
  end
406
400
  end
407
-
401
+
408
402
  def create
409
403
  super
410
-
404
+
411
405
  @log_viewer.purge_logs
412
406
  @request_editor.setText('')
413
407
  @requestCombo.clearItems()
414
408
  @start_button.text = "Start"
415
-
409
+
416
410
  updateView()
417
- # Create the windows
411
+ # Create the windows
418
412
  show(PLACEMENT_SCREEN) # Make the main window appear
419
413
  disableOptions()
420
414
  end
421
-
422
-
423
-
415
+
416
+
424
417
  private
425
-
418
+
426
419
  def config
427
420
  name = @search_name_dt.value
428
421
  db_list = @db_select_frame.get_db_list
429
422
  if @finder_tab.current == 1
430
- name = @db_select_frame.get_db_name
423
+ name = @db_select_frame.get_db_name
431
424
  end
432
-
425
+
433
426
  c={
434
- :db_list => db_list,
435
- :name => name
427
+ :db_list => db_list,
428
+ :name => name
436
429
  }
437
-
430
+
438
431
  end
439
-
432
+
440
433
  def onSelectRequest(sender, sel, item)
441
434
  begin
442
435
  chat = @requestCombo.getItemData(@requestCombo.currentItem)
@@ -446,12 +439,12 @@ module Watobo#:nodoc: all
446
439
  puts bang
447
440
  end
448
441
  end
449
-
442
+
450
443
  def updateRequestCombo(chat_list)
451
444
  @requestCombo.clearItems()
452
445
  chat_list.each do |chat|
453
446
  text = "[#{chat.id}] #{chat.request.url.to_s}"
454
- @requestCombo.appendItem(text.slice(0..60), chat)
447
+ @requestCombo.appendItem(text.slice(0..60), chat)
455
448
  end
456
449
  if @requestCombo.numItems > 0 then
457
450
  if @requestCombo.numItems < 10 then
@@ -462,47 +455,47 @@ module Watobo#:nodoc: all
462
455
  @requestCombo.setCurrentItem(0, true)
463
456
  chat = @requestCombo.getItemData(0)
464
457
  end
465
-
458
+
466
459
  end
467
-
468
- def updateRequestEditor(chat=nil)
460
+
461
+ def updateRequestEditor(chat=nil)
469
462
  @request_editor.setText('')
470
463
  return if chat.nil?
471
464
  #chat = createChat(site, dir)
472
465
  #@request_box.setText(chat)
473
466
  request = chat.copyRequest
474
- # request.replaceFileExt('')
475
- @request_editor.setText(request.join.gsub(/\r/,""))
467
+ # request.replaceFileExt('')
468
+ @request_editor.setText(request.join.gsub(/\r/, ""))
476
469
  end
477
-
470
+
478
471
  def createChat()
479
472
  request = @request_editor.parseRequest()
480
473
  chat = Watobo::Chat.new(request, [], :id => 0)
481
- end
482
-
483
- def onSiteSelect(sender, sel, item)
474
+ end
475
+
476
+ def onSiteSelect(sender, sel, item)
484
477
  ci = @sites_combo.currentItem
485
478
  @request_editor.setText('')
486
479
  @requestCombo.clearItems()
487
-
480
+
488
481
  @dir_combo.clearItems()
489
482
  @dir = ""
490
-
491
- if ci > 0 then
483
+
484
+ if ci > 0 then
492
485
  @site = @sites_combo.getItemData(ci)
493
486
  if @site
494
487
  @dir_combo.appendItem("/", nil)
495
-
488
+
496
489
  chats = Watobo::Chats.select(@site, :method => "GET")
497
490
  updateRequestCombo(chats)
498
491
  updateRequestEditor(chats.first)
499
- if @project then
492
+ if @project then
500
493
  Watobo::Chats.dirs(@site) do |dir|
501
494
  text = "/" + dir.slice(0..35)
502
495
  text.gsub!(/\/+/, '/')
503
496
  @dir_combo.appendItem(text, dir)
504
497
  end
505
- @dir_combo.setCurrentItem(0, true) if @dir_combo.numItems > 0
498
+ @dir_combo.setCurrentItem(0, true) if @dir_combo.numItems > 0
506
499
  end
507
500
  end
508
501
  enableOptions()
@@ -515,7 +508,7 @@ module Watobo#:nodoc: all
515
508
  @start_button.disable
516
509
  end
517
510
  end
518
-
511
+
519
512
  def disableOptions()
520
513
  # @use_ssl.setCheck(false)
521
514
  # @use_ssl.disable
@@ -525,70 +518,70 @@ module Watobo#:nodoc: all
525
518
  @dir_combo.disable
526
519
  #@run_passive_checks.disable
527
520
  @request_editor.enabled = false
528
- @request_editor.backColor = FXColor::LightGrey
521
+ @request_editor.backColor = FXColor::LightGrey
529
522
  end
530
-
531
- def enableOptions()
523
+
524
+ def enableOptions()
532
525
  # @use_ssl.enable
533
526
  @test_all_dirs.enable
534
527
  @dir_combo.enable
535
528
  @request_editor.enabled = true
536
- @request_editor.backColor = FXColor::White
529
+ @request_editor.backColor = FXColor::White
537
530
  #@run_passive_checks.enable
538
531
  end
539
-
540
- def onDirSelect(sender, sel, item)
541
-
542
-
543
- ci = @dir_combo.currentItem
544
-
545
- if ci > 0 then
532
+
533
+ def onDirSelect(sender, sel, item)
534
+
535
+
536
+ ci = @dir_combo.currentItem
537
+
538
+ if ci > 0 then
546
539
  @dir = @dir_combo.getItemData(ci)
547
540
  else
548
541
  @dir = ""
549
542
  end
550
- chats = Watobo::Chats.select(@site, :method => "GET", :dir => @dir)
551
- updateRequestCombo(chats)
552
- updateRequestEditor(chats.first)
543
+ chats = Watobo::Chats.select(@site, :method => "GET", :dir => @dir)
544
+ updateRequestCombo(chats)
545
+ updateRequestEditor(chats.first)
553
546
  end
554
-
555
-
547
+
548
+
556
549
  def start_update_timer
557
- @timer = FXApp.instance.addTimeout( 250, :repeat => true) {
558
- unless @scanner.nil?
559
- sum = @scanner.sum_progress
560
-
561
- @speed.text = "Checks per second: #{sum - @pbar.progress}"
562
- @pbar.progress = sum
563
-
564
- if @scanner.finished?
565
- msg = "Scan Finished!"
566
- @log_viewer.log(LOG_INFO, msg)
567
- Watobo.log(msg, :sender => "Catalog")
568
- @scanner = nil
569
- reset_pbar()
570
- @start_button.text = "Start"
571
- @speed.text = "Checks per second: -"
572
- @speed.disable
550
+ Watobo.save_thread {
551
+ unless @scanner.nil?
552
+ sum = @scanner.sum_progress
553
+
554
+ @speed.text = "Checks per second: #{sum - @pbar.progress}"
555
+ @pbar.progress = sum
556
+
557
+ if @scanner.finished?
558
+ msg = "Scan Finished!"
559
+ @log_viewer.log(LOG_INFO, msg)
560
+ Watobo.log(msg, :sender => "Catalog")
561
+ @scanner = nil
562
+ reset_pbar()
563
+ @start_button.text = "Start"
564
+ @speed.text = "Checks per second: -"
565
+ @speed.disable
566
+ end
573
567
  end
574
- end
575
568
  }
576
569
 
577
-
578
- end
579
-
580
-
570
+
571
+ end
572
+
573
+
581
574
  def hide()
582
575
  @scanner.cancel() if @scanner
583
- super
576
+ super
584
577
  end
585
-
578
+
586
579
  def reset_pbar
587
- @pbar.progress = 0
588
- @pbar.total = 0
589
- @pbar.barColor = 'grey' #FXRGB(255,0,0)
580
+ @pbar.progress = 0
581
+ @pbar.total = 0
582
+ @pbar.barColor = 'grey' #FXRGB(255,0,0)
590
583
  end
591
-
584
+
592
585
  def cancel_scanner
593
586
  return false if @scanner.nil?
594
587
  @scanner.cancel()
@@ -596,10 +589,10 @@ module Watobo#:nodoc: all
596
589
  @speed = FXLabel.new(@settings_frame, "Requests per second: -")
597
590
  reset_pbar
598
591
  m = "Scan canceled by user!"
599
- @log_viewer.log(LOG_INFO,m)
592
+ @log_viewer.log(LOG_INFO, m)
600
593
  Watobo.log(">> #{m}", :sender => self.class.to_s)
601
594
  end
602
-
595
+
603
596
  def start(sender, sel, item)
604
597
  if @start_button.text =~ /cancel/i then
605
598
  cancel_scanner
@@ -607,7 +600,7 @@ module Watobo#:nodoc: all
607
600
  end
608
601
  @start_button.text = "Cancel"
609
602
  @speed.enable
610
-
603
+
611
604
  chatlist = []
612
605
  checklist = []
613
606
  #config = { :db_file => @dbfile_dt.value }
@@ -618,43 +611,43 @@ module Watobo#:nodoc: all
618
611
  else
619
612
  name = @db_select_frame.get_db_name
620
613
  end
621
-
622
-
614
+
615
+
623
616
  @check = Check.new(@project, name, @project.getScanPreferences())
624
-
617
+
625
618
  if @append_extensions_cb.checked?
626
- extensions = @extensions_text.text.split(/(;|\n)/).select {|x| !x.strip.empty? }
627
-
628
- @check.set_extensions(extensions)
619
+ extensions = @extensions_text.text.split(/(;|\n)/).select { |x| !x.strip.empty? }
620
+
621
+ @check.set_extensions(extensions)
629
622
  end
630
-
623
+
631
624
  @check.append_slash = @append_slash_cb.checked?
632
-
633
-
625
+
626
+
634
627
  @check.path = @path
635
-
628
+
636
629
  checklist.push @check
637
630
  @check.resetCounters()
638
-
639
-
631
+
632
+
640
633
  @progress_window = Watobo::Gui::ProgressWindow.new(self)
641
-
642
-
634
+
635
+
643
636
  @progress_window.show(PLACEMENT_SCREEN)
644
- t = Thread.new{
637
+ t = Thread.new {
645
638
  begin
646
639
  c=1
647
640
  if @test_all_dirs.checked? then
648
641
  c = 0
649
642
  Watobo::Chats.dirs(@site, :base_dir => @dir, :include_subdirs => @test_all_dirs.checked?) { c += 1 }
650
- @progress_window.update_progress( :title => "File Finder Plugin", :total => c, :job => @dir)
643
+ @progress_window.update_progress(:title => "File Finder Plugin", :total => c, :job => @dir)
651
644
  Watobo::Chats.dirs(@site, :base_dir => @dir, :include_subdirs => @test_all_dirs.checked?) do |dir|
652
- m = "running checks on #{dir}"
653
- @log_viewer.log(LOG_INFO,m)
654
- Watobo.log(">> #{m}", :sender => self.class.to_s)
655
-
645
+ m = "running checks on #{dir}"
646
+ @log_viewer.log(LOG_INFO, m)
647
+ Watobo.log(">> #{m}", :sender => self.class.to_s)
648
+
656
649
  chat = createChat()
657
-
650
+
658
651
  chat.request.replaceFileExt('')
659
652
  chat.request.setDir(dir)
660
653
  chatlist.push chat
@@ -664,8 +657,8 @@ module Watobo#:nodoc: all
664
657
  end
665
658
  else
666
659
  notify(:update_progress, :total => c, :job => @dir)
667
- m = "running checks on #{@dir}"
668
- @log_viewer.log(LOG_INFO,m)
660
+ m = "running checks on #{@dir}"
661
+ @log_viewer.log(LOG_INFO, m)
669
662
  Watobo.log(">> #{m}", :sender => self.class.to_s)
670
663
  chat = createChat()
671
664
  chatlist.push chat
@@ -679,49 +672,49 @@ module Watobo#:nodoc: all
679
672
  @progress_window.hide
680
673
  end
681
674
  }
682
-
683
-
675
+
676
+
684
677
  t.join
685
-
678
+
686
679
  scan_prefs = Watobo.project.getScanPreferences
687
680
  if @logScanChats.checked?
688
681
  scan_prefs[:scanlog_name] = @scanlog_name_dt.value unless @scanlog_name_dt.value.empty?
689
682
  end
690
-
683
+
691
684
  @scanner = Watobo::Scanner3.new(chatlist, checklist, @project.passive_checks, scan_prefs)
692
685
  @pbar.total = @scanner.sum_total
693
686
  @pbar.progress = 0
694
- @pbar.barColor = 'red'
695
-
687
+ @pbar.barColor = 'red'
688
+
696
689
  speed = 0
697
690
  lasttime = 0
698
-
699
-
691
+
692
+
700
693
  m= "Total Requests: #{@check.numChecks}"
701
- @log_viewer.log(LOG_INFO,m)
702
-
694
+ @log_viewer.log(LOG_INFO, m)
695
+
703
696
 
704
697
  begin
705
698
  m = "start scanning..."
706
- @log_viewer.log(LOG_INFO,m)
699
+ @log_viewer.log(LOG_INFO, m)
707
700
  long_log = ["Scan started"]
708
- long_log << "Source: #{name}"
709
- long_log << "Target Dirs:"
710
- chatlist.each do |c|
711
- long_log << c.request.dir
712
- end
713
- Watobo.log(long_log, :sender => self.class.to_s)
714
- scan_prefs = Watobo::Conf::Scanner.to_h
715
- scan_prefs[:run_passive_checks] = false
716
- @scanner.run(scan_prefs)
717
-
718
- rescue => bang
719
- puts bang
720
- puts bang.backtrace if $DEBUG
701
+ long_log << "Source: #{name}"
702
+ long_log << "Target Dirs:"
703
+ chatlist.each do |c|
704
+ long_log << c.request.dir
721
705
  end
706
+ Watobo.log(long_log, :sender => self.class.to_s)
707
+ scan_prefs = Watobo::Conf::Scanner.to_h
708
+ scan_prefs[:run_passive_checks] = false
709
+ @scanner.run(scan_prefs)
710
+
711
+ rescue => bang
712
+ puts bang
713
+ puts bang.backtrace if $DEBUG
714
+ end
722
715
 
723
716
  end
724
-
717
+
725
718
  end
726
719
  end
727
720
  end