arachni 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (348) hide show
  1. data/ACKNOWLEDGMENTS.md +1 -1
  2. data/CHANGELOG.md +146 -0
  3. data/CONTRIBUTORS.md +1 -0
  4. data/HACKING.md +3 -3
  5. data/README.md +81 -49
  6. data/Rakefile +11 -14
  7. data/bin/arachni +4 -8
  8. data/bin/arachni_rpc +17 -0
  9. data/bin/arachni_rpcd +18 -0
  10. data/bin/arachni_rpcd_monitor +18 -0
  11. data/bin/arachni_web +25 -48
  12. data/bin/arachni_web_autostart +3 -3
  13. data/conf/README.webui.yaml.txt +7 -21
  14. data/external/metasploit/plugins/arachni.rb +0 -7
  15. data/extras/modules/recon/raft_dirs.rb +108 -0
  16. data/extras/modules/recon/raft_dirs/raft-large-directories.txt +62290 -0
  17. data/extras/modules/recon/raft_files.rb +110 -0
  18. data/extras/modules/recon/raft_files/raft-large-files.txt +37037 -0
  19. data/extras/modules/recon/svn_digger_dirs.rb +108 -0
  20. data/extras/modules/recon/svn_digger_dirs/Licence.txt +674 -0
  21. data/extras/modules/recon/svn_digger_dirs/ReadMe-Arachni.txt +4 -0
  22. data/extras/modules/recon/svn_digger_dirs/ReadMe.txt +6 -0
  23. data/extras/modules/recon/svn_digger_dirs/all-dirs.txt +5960 -0
  24. data/extras/modules/recon/svn_digger_files.rb +114 -0
  25. data/extras/modules/recon/svn_digger_files/Licence.txt +674 -0
  26. data/extras/modules/recon/svn_digger_files/ReadMe-Arachni.txt +4 -0
  27. data/extras/modules/recon/svn_digger_files/ReadMe.txt +6 -0
  28. data/extras/modules/recon/svn_digger_files/all-extensionless.txt +25419 -0
  29. data/extras/modules/recon/svn_digger_files/all.txt +43135 -0
  30. data/lib/arachni.rb +2 -7
  31. data/lib/{audit_store.rb → arachni/audit_store.rb} +68 -60
  32. data/lib/{component_manager.rb → arachni/component_manager.rb} +8 -8
  33. data/lib/{component_options.rb → arachni/component_options.rb} +34 -4
  34. data/lib/{crypto → arachni/crypto}/rsa_aes_cbc.rb +1 -2
  35. data/lib/arachni/database.rb +4 -0
  36. data/lib/arachni/database/base.rb +125 -0
  37. data/lib/arachni/database/hash.rb +384 -0
  38. data/lib/arachni/database/queue.rb +93 -0
  39. data/lib/{exceptions.rb → arachni/exceptions.rb} +1 -1
  40. data/lib/arachni/framework.rb +899 -0
  41. data/lib/{http.rb → arachni/http.rb} +63 -166
  42. data/lib/{issue.rb → arachni/issue.rb} +46 -17
  43. data/lib/{mixins → arachni/mixins}/observable.rb +1 -1
  44. data/lib/arachni/mixins/progress_bar.rb +81 -0
  45. data/lib/arachni/mixins/terminal.rb +106 -0
  46. data/lib/{module.rb → arachni/module.rb} +0 -0
  47. data/lib/{module → arachni/module}/auditor.rb +250 -86
  48. data/lib/{module → arachni/module}/base.rb +8 -18
  49. data/lib/{module → arachni/module}/element_db.rb +10 -2
  50. data/lib/{module → arachni/module}/key_filler.rb +1 -1
  51. data/lib/arachni/module/manager.rb +145 -0
  52. data/lib/{module → arachni/module}/output.rb +6 -1
  53. data/lib/{module → arachni/module}/trainer.rb +48 -52
  54. data/lib/{module → arachni/module}/utilities.rb +66 -15
  55. data/lib/{nokogiri → arachni/nokogiri}/xml/node.rb +0 -0
  56. data/lib/arachni/options.rb +986 -0
  57. data/lib/{parser.rb → arachni/parser.rb} +0 -0
  58. data/lib/{parser → arachni/parser}/auditable.rb +111 -32
  59. data/lib/{parser → arachni/parser}/elements.rb +28 -20
  60. data/lib/{parser → arachni/parser}/page.rb +20 -3
  61. data/lib/{parser → arachni/parser}/parser.rb +100 -63
  62. data/lib/{plugin.rb → arachni/plugin.rb} +0 -0
  63. data/lib/{plugin → arachni/plugin}/base.rb +43 -6
  64. data/lib/{plugin → arachni/plugin}/manager.rb +40 -13
  65. data/lib/{report.rb → arachni/report.rb} +0 -0
  66. data/lib/{report → arachni/report}/base.rb +43 -2
  67. data/lib/{report → arachni/report}/manager.rb +7 -18
  68. data/lib/arachni/rpc/client/base.rb +42 -0
  69. data/lib/{rpc/xml → arachni/rpc}/client/dispatcher.rb +12 -13
  70. data/lib/arachni/rpc/client/instance.rb +62 -0
  71. data/lib/arachni/rpc/server/base.rb +51 -0
  72. data/lib/arachni/rpc/server/dispatcher.rb +438 -0
  73. data/lib/arachni/rpc/server/framework.rb +1163 -0
  74. data/lib/arachni/rpc/server/instance.rb +184 -0
  75. data/lib/{rpc/xml → arachni/rpc}/server/module/manager.rb +8 -5
  76. data/lib/arachni/rpc/server/node.rb +267 -0
  77. data/lib/{rpc/xml → arachni/rpc}/server/options.rb +6 -35
  78. data/lib/{rpc/xml → arachni/rpc}/server/output.rb +29 -3
  79. data/lib/{rpc/xml → arachni/rpc}/server/plugin/manager.rb +5 -6
  80. data/lib/{ruby.rb → arachni/ruby.rb} +1 -2
  81. data/lib/arachni/ruby/array.rb +31 -0
  82. data/lib/{ruby → arachni/ruby}/object.rb +1 -1
  83. data/lib/{ruby → arachni/ruby}/string.rb +1 -1
  84. data/lib/{spider.rb → arachni/spider.rb} +83 -110
  85. data/lib/arachni/typhoeus/hydra.rb +7 -0
  86. data/lib/{typhoeus → arachni/typhoeus}/request.rb +11 -9
  87. data/lib/{typhoeus → arachni/typhoeus}/response.rb +4 -0
  88. data/lib/{ui → arachni/ui}/cli/cli.rb +154 -84
  89. data/lib/{ui → arachni/ui}/cli/output.rb +57 -19
  90. data/lib/{ui/xmlrpc → arachni/ui/rpc}/dispatcher_monitor.rb +11 -10
  91. data/lib/{ui/xmlrpc/xmlrpc.rb → arachni/ui/rpc/rpc.rb} +102 -158
  92. data/lib/{ui → arachni/ui}/web/addon_manager.rb +23 -3
  93. data/lib/arachni/ui/web/addons/autodeploy.rb +207 -0
  94. data/lib/{ui → arachni/ui}/web/addons/autodeploy/lib/manager.rb +142 -35
  95. data/lib/arachni/ui/web/addons/autodeploy/views/index.erb +291 -0
  96. data/lib/{ui → arachni/ui}/web/addons/sample.rb +1 -1
  97. data/lib/{ui → arachni/ui}/web/addons/sample/views/index.erb +0 -0
  98. data/lib/{ui → arachni/ui}/web/addons/scheduler.rb +30 -22
  99. data/lib/{ui → arachni/ui}/web/addons/scheduler/views/index.erb +56 -22
  100. data/lib/{ui → arachni/ui}/web/addons/scheduler/views/options.erb +0 -0
  101. data/lib/arachni/ui/web/dispatcher_manager.rb +274 -0
  102. data/lib/arachni/ui/web/instance_manager.rb +69 -0
  103. data/lib/{ui → arachni/ui}/web/log.rb +1 -1
  104. data/lib/arachni/ui/web/output_stream.rb +54 -0
  105. data/lib/{ui → arachni/ui}/web/report_manager.rb +48 -54
  106. data/lib/{ui → arachni/ui}/web/scheduler.rb +42 -47
  107. data/lib/arachni/ui/web/server.rb +1197 -0
  108. data/lib/{ui → arachni/ui}/web/server/db/placeholder +0 -0
  109. data/lib/{ui → arachni/ui}/web/server/public/banner.png +0 -0
  110. data/lib/{ui → arachni/ui}/web/server/public/bodybg-small.png +0 -0
  111. data/lib/{ui → arachni/ui}/web/server/public/bodybg.png +0 -0
  112. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/pbar-ani.gif +0 -0
  113. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  114. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  115. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  116. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  117. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  118. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  119. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  120. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  121. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  122. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  123. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  124. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  125. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  126. data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/jquery-ui-1.8.9.custom.css +0 -0
  127. data/lib/{ui → arachni/ui}/web/server/public/favicon.ico +0 -0
  128. data/lib/{ui → arachni/ui}/web/server/public/footer.jpg +0 -0
  129. data/lib/{ui/web/server/public/icons/error.png → arachni/ui/web/server/public/icons/bad.png} +0 -0
  130. data/lib/arachni/ui/web/server/public/icons/error.png +0 -0
  131. data/lib/{ui → arachni/ui}/web/server/public/icons/info.png +0 -0
  132. data/lib/{ui → arachni/ui}/web/server/public/icons/ok.png +0 -0
  133. data/lib/{ui → arachni/ui}/web/server/public/icons/status.png +0 -0
  134. data/lib/{ui → arachni/ui}/web/server/public/js/jquery-1.4.4.min.js +0 -0
  135. data/lib/{ui → arachni/ui}/web/server/public/js/jquery-ui-1.8.9.custom.min.js +0 -0
  136. data/lib/{ui → arachni/ui}/web/server/public/js/jquery-ui-timepicker.js +0 -0
  137. data/lib/{ui → arachni/ui}/web/server/public/logo.png +0 -0
  138. data/lib/{ui → arachni/ui}/web/server/public/nav-left.jpg +0 -0
  139. data/lib/{ui → arachni/ui}/web/server/public/nav-right.jpg +0 -0
  140. data/lib/{ui → arachni/ui}/web/server/public/nav-selected-left.jpg +0 -0
  141. data/lib/{ui → arachni/ui}/web/server/public/nav-selected-right.jpg +0 -0
  142. data/lib/{ui → arachni/ui}/web/server/public/plugins/sample/style.css +0 -0
  143. data/lib/{ui/web/server/tmp → arachni/ui/web/server/public/reports}/placeholder +0 -0
  144. data/lib/{ui → arachni/ui}/web/server/public/sidebar-bottom.jpg +0 -0
  145. data/lib/{ui → arachni/ui}/web/server/public/sidebar-h4.jpg +0 -0
  146. data/lib/{ui → arachni/ui}/web/server/public/sidebar-top.jpg +0 -0
  147. data/lib/{ui → arachni/ui}/web/server/public/spider.png +0 -0
  148. data/lib/{ui → arachni/ui}/web/server/public/style.css +3 -2
  149. data/lib/arachni/ui/web/server/tmp/placeholder +0 -0
  150. data/lib/{ui → arachni/ui}/web/server/views/addon.erb +0 -0
  151. data/lib/{ui → arachni/ui}/web/server/views/addons.erb +0 -0
  152. data/lib/{ui → arachni/ui}/web/server/views/dispatcher_error.erb +0 -0
  153. data/lib/arachni/ui/web/server/views/dispatchers.erb +175 -0
  154. data/lib/arachni/ui/web/server/views/dispatchers_edit.erb +71 -0
  155. data/lib/arachni/ui/web/server/views/error.erb +22 -0
  156. data/lib/{ui → arachni/ui}/web/server/views/flash.erb +2 -2
  157. data/lib/arachni/ui/web/server/views/home.erb +60 -0
  158. data/lib/{ui → arachni/ui}/web/server/views/instance.erb +55 -75
  159. data/lib/arachni/ui/web/server/views/js/home.erb +32 -0
  160. data/lib/{ui → arachni/ui}/web/server/views/layout.erb +2 -2
  161. data/lib/{ui → arachni/ui}/web/server/views/log.erb +0 -0
  162. data/lib/arachni/ui/web/server/views/module.erb +30 -0
  163. data/lib/{ui → arachni/ui}/web/server/views/modules.erb +2 -22
  164. data/lib/{ui → arachni/ui}/web/server/views/options.erb +0 -0
  165. data/lib/{ui → arachni/ui}/web/server/views/output_results.erb +4 -4
  166. data/lib/{ui → arachni/ui}/web/server/views/plugins.erb +23 -12
  167. data/lib/{ui → arachni/ui}/web/server/views/report_formats.erb +1 -1
  168. data/lib/{ui → arachni/ui}/web/server/views/reports.erb +1 -1
  169. data/lib/{ui → arachni/ui}/web/server/views/settings.erb +59 -16
  170. data/lib/{ui → arachni/ui}/web/server/views/welcome.erb +3 -1
  171. data/lib/{ui → arachni/ui}/web/utilities.rb +8 -3
  172. data/lib/arachni/version.rb +16 -0
  173. data/modules/audit/code_injection.rb +11 -20
  174. data/modules/audit/code_injection_timing.rb +2 -6
  175. data/modules/audit/csrf.rb +8 -16
  176. data/modules/audit/ldapi.rb +5 -11
  177. data/modules/audit/os_cmd_injection.rb +5 -9
  178. data/modules/audit/os_cmd_injection_timing.rb +4 -8
  179. data/modules/audit/path_traversal.rb +7 -13
  180. data/modules/audit/response_splitting.rb +8 -21
  181. data/modules/audit/rfi.rb +6 -46
  182. data/modules/audit/sqli.rb +5 -11
  183. data/modules/audit/sqli/regexp_ids.txt +0 -6
  184. data/modules/audit/sqli_blind_rdiff.rb +5 -10
  185. data/modules/audit/sqli_blind_timing.rb +4 -9
  186. data/modules/audit/trainer.rb +6 -12
  187. data/modules/audit/unvalidated_redirect.rb +6 -17
  188. data/modules/audit/xpath.rb +5 -12
  189. data/modules/audit/xss.rb +37 -23
  190. data/modules/audit/xss_event.rb +5 -10
  191. data/modules/audit/xss_path.rb +47 -41
  192. data/modules/audit/xss_script_tag.rb +5 -10
  193. data/modules/audit/xss_tag.rb +5 -10
  194. data/modules/audit/xss_uri.rb +17 -89
  195. data/modules/recon/allowed_methods.rb +6 -15
  196. data/modules/recon/backdoors.rb +12 -52
  197. data/modules/recon/backup_files.rb +25 -88
  198. data/modules/recon/common_directories.rb +8 -54
  199. data/modules/recon/common_files.rb +7 -58
  200. data/modules/recon/directory_listing.rb +6 -15
  201. data/modules/recon/grep/captcha.rb +1 -1
  202. data/modules/recon/grep/credit_card.rb +62 -27
  203. data/modules/recon/grep/cvs_svn_users.rb +1 -1
  204. data/modules/recon/grep/emails.rb +1 -1
  205. data/modules/recon/grep/html_objects.rb +1 -1
  206. data/modules/recon/grep/private_ip.rb +1 -1
  207. data/modules/recon/grep/ssn.rb +9 -9
  208. data/modules/recon/htaccess_limit.rb +6 -14
  209. data/modules/recon/http_put.rb +7 -15
  210. data/modules/recon/interesting_responses.rb +7 -13
  211. data/modules/recon/mixed_resource.rb +100 -0
  212. data/modules/recon/unencrypted_password_forms.rb +8 -20
  213. data/modules/recon/webdav.rb +6 -16
  214. data/modules/recon/xst.rb +7 -13
  215. data/path_extractors/anchors.rb +1 -1
  216. data/path_extractors/forms.rb +1 -1
  217. data/path_extractors/frames.rb +1 -1
  218. data/path_extractors/generic.rb +47 -3
  219. data/path_extractors/links.rb +1 -1
  220. data/path_extractors/meta_refresh.rb +1 -1
  221. data/path_extractors/scripts.rb +3 -4
  222. data/path_extractors/sitemap.rb +1 -1
  223. data/plugins/autologin.rb +9 -18
  224. data/plugins/beep_notify.rb +51 -0
  225. data/plugins/cookie_collector.rb +12 -12
  226. data/plugins/defaults/autothrottle.rb +86 -0
  227. data/plugins/{content_types.rb → defaults/content_types.rb} +25 -19
  228. data/plugins/{healthmap.rb → defaults/healthmap.rb} +30 -18
  229. data/plugins/defaults/metamodules/remedies/discovery.rb +164 -0
  230. data/plugins/defaults/metamodules/remedies/manual_verification.rb +65 -0
  231. data/{metamodules/timeout_notice.rb → plugins/defaults/metamodules/remedies/timing_attacks.rb} +26 -22
  232. data/{metamodules → plugins/defaults/metamodules}/uniformity.rb +15 -14
  233. data/plugins/{profiler.rb → defaults/profiler.rb} +19 -30
  234. data/plugins/defaults/resolver.rb +55 -0
  235. data/plugins/email_notify.rb +108 -0
  236. data/plugins/form_dicattack.rb +8 -16
  237. data/plugins/http_dicattack.rb +4 -12
  238. data/plugins/libnotify.rb +86 -0
  239. data/plugins/proxy.rb +8 -17
  240. data/plugins/proxy/server.rb +3 -3
  241. data/plugins/rescan.rb +60 -0
  242. data/plugins/waf_detector.rb +5 -16
  243. data/profiles/full.afp +3 -30
  244. data/reports/afr.rb +2 -5
  245. data/reports/ap.rb +3 -1
  246. data/reports/html.rb +210 -68
  247. data/reports/html/default.erb +72 -1014
  248. data/reports/html/default/configuration.erb +126 -0
  249. data/reports/html/default/css/jquery-ui.css +570 -0
  250. data/reports/html/default/css/jquery.jqplot.min.css +1 -0
  251. data/reports/html/default/css/main.css +391 -0
  252. data/reports/html/default/issue.erb +189 -0
  253. data/reports/html/default/issues.erb +65 -0
  254. data/reports/html/default/js/charts.js +146 -0
  255. data/reports/html/default/js/helpers.js +95 -0
  256. data/reports/html/default/js/init.js +73 -0
  257. data/reports/html/default/js/lib/jqplot.barRenderer.min.js +57 -0
  258. data/reports/html/default/js/lib/jqplot.categoryAxisRenderer.min.js +57 -0
  259. data/reports/html/default/js/lib/jqplot.cursor.min.js +57 -0
  260. data/reports/html/default/js/lib/jqplot.pieRenderer.min.js +57 -0
  261. data/reports/html/default/js/lib/jqplot.pointLabels.min.js +57 -0
  262. data/reports/html/default/js/lib/jquery-ui.min.js +404 -0
  263. data/reports/html/default/js/lib/jquery.jqplot.min.js +57 -0
  264. data/reports/html/default/js/lib/jquery.min.js +167 -0
  265. data/reports/html/default/plugins.erb +22 -0
  266. data/reports/html/default/search.erb +8 -0
  267. data/reports/html/default/sitemap.erb +15 -0
  268. data/reports/html/default/summary.erb +68 -0
  269. data/reports/html/default/summary_issue.erb +19 -0
  270. data/reports/json.rb +51 -0
  271. data/reports/marshal.rb +49 -0
  272. data/reports/metareport.rb +4 -6
  273. data/reports/metareport/arachni_metareport.rb +1 -1
  274. data/reports/plugin_formatters/html/autologin.rb +30 -41
  275. data/reports/plugin_formatters/html/content_types.rb +1 -10
  276. data/reports/plugin_formatters/html/cookie_collector.rb +36 -44
  277. data/reports/plugin_formatters/html/discovery.rb +50 -0
  278. data/reports/plugin_formatters/html/form_dicattack.rb +24 -32
  279. data/reports/plugin_formatters/html/healthmap.rb +45 -54
  280. data/reports/plugin_formatters/html/http_dicattack.rb +24 -32
  281. data/reports/plugin_formatters/html/profiler.rb +17 -48
  282. data/reports/plugin_formatters/html/profiler/template.erb +6 -99
  283. data/reports/plugin_formatters/html/resolver.rb +63 -0
  284. data/reports/plugin_formatters/html/{metaformatters/timeout_notice.rb → timing_attacks.rb} +7 -19
  285. data/reports/plugin_formatters/html/{metaformatters/uniformity.rb → uniformity.rb} +5 -17
  286. data/reports/plugin_formatters/html/waf_detector.rb +24 -32
  287. data/reports/plugin_formatters/stdout/autologin.rb +30 -35
  288. data/reports/plugin_formatters/stdout/content_types.rb +41 -46
  289. data/reports/plugin_formatters/stdout/cookie_collector.rb +33 -38
  290. data/reports/plugin_formatters/stdout/discovery.rb +47 -0
  291. data/reports/plugin_formatters/stdout/form_dicattack.rb +27 -32
  292. data/reports/plugin_formatters/stdout/healthmap.rb +47 -51
  293. data/reports/plugin_formatters/stdout/http_dicattack.rb +27 -32
  294. data/reports/plugin_formatters/stdout/metamodules.rb +48 -55
  295. data/reports/plugin_formatters/stdout/profiler.rb +60 -65
  296. data/reports/plugin_formatters/stdout/resolver.rb +45 -0
  297. data/reports/plugin_formatters/stdout/{metaformatters/timeout_notice.rb → timing_attacks.rb} +6 -14
  298. data/reports/plugin_formatters/stdout/{metaformatters/uniformity.rb → uniformity.rb} +6 -14
  299. data/reports/plugin_formatters/stdout/waf_detector.rb +23 -28
  300. data/reports/plugin_formatters/xml/autologin.rb +36 -41
  301. data/reports/plugin_formatters/xml/content_types.rb +47 -52
  302. data/reports/plugin_formatters/xml/cookie_collector.rb +39 -44
  303. data/reports/plugin_formatters/xml/discovery.rb +54 -0
  304. data/reports/plugin_formatters/xml/form_dicattack.rb +22 -27
  305. data/reports/plugin_formatters/xml/healthmap.rb +53 -58
  306. data/reports/plugin_formatters/xml/http_dicattack.rb +22 -27
  307. data/reports/plugin_formatters/xml/profiler.rb +61 -77
  308. data/reports/plugin_formatters/xml/resolver.rb +53 -0
  309. data/reports/plugin_formatters/xml/{metaformatters/timeout_notice.rb → timing_attacks.rb} +3 -15
  310. data/reports/plugin_formatters/xml/{metaformatters/uniformity.rb → uniformity.rb} +4 -14
  311. data/reports/plugin_formatters/xml/waf_detector.rb +23 -28
  312. data/reports/stdout.rb +1 -1
  313. data/reports/txt.rb +2 -5
  314. data/reports/xml.rb +2 -5
  315. data/reports/xml/buffer.rb +6 -2
  316. data/reports/yaml.rb +49 -0
  317. metadata +419 -278
  318. data/bin/arachni_xmlrpc +0 -21
  319. data/bin/arachni_xmlrpcd +0 -82
  320. data/bin/arachni_xmlrpcd_monitor +0 -74
  321. data/getoptslong.rb +0 -242
  322. data/lib/anemone.rb +0 -2
  323. data/lib/framework.rb +0 -673
  324. data/lib/module/manager.rb +0 -111
  325. data/lib/options.rb +0 -547
  326. data/lib/rpc/xml/client/base.rb +0 -76
  327. data/lib/rpc/xml/client/instance.rb +0 -88
  328. data/lib/rpc/xml/server/base.rb +0 -112
  329. data/lib/rpc/xml/server/dispatcher.rb +0 -386
  330. data/lib/rpc/xml/server/framework.rb +0 -206
  331. data/lib/rpc/xml/server/instance.rb +0 -191
  332. data/lib/ruby/xmlrpc/server.rb +0 -27
  333. data/lib/ui/web/addons/autodeploy.rb +0 -172
  334. data/lib/ui/web/addons/autodeploy/views/index.erb +0 -124
  335. data/lib/ui/web/dispatcher_manager.rb +0 -165
  336. data/lib/ui/web/instance_manager.rb +0 -87
  337. data/lib/ui/web/output_stream.rb +0 -94
  338. data/lib/ui/web/server.rb +0 -925
  339. data/lib/ui/web/server/public/reports/placeholder +0 -1
  340. data/lib/ui/web/server/views/dispatchers.erb +0 -100
  341. data/lib/ui/web/server/views/dispatchers_edit.erb +0 -42
  342. data/lib/ui/web/server/views/error.erb +0 -1
  343. data/lib/ui/web/server/views/home.erb +0 -25
  344. data/metamodules/autothrottle.rb +0 -74
  345. data/plugins/metamodules.rb +0 -118
  346. data/profiles/comprehensive.afp +0 -74
  347. data/reports/plugin_formatters/html/metamodules.rb +0 -93
  348. data/reports/plugin_formatters/xml/metamodules.rb +0 -91
@@ -1,6 +1,6 @@
1
1
  =begin
2
2
  Arachni
3
- Copyright (c) 2010-2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
3
+ Copyright (c) 2010-2012 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
4
4
 
5
5
  This is free software; you can copy and distribute and modify
6
6
  this program under the term of the GPL v2.0 License
@@ -13,7 +13,7 @@ module Arachni
13
13
  #
14
14
  # Overrides the Options class adding support for direct options parsing.
15
15
  #
16
- # Not much to look at but it streamlines XML-RPC server option handling.
16
+ # Not much to look at but it streamlines RPC server option handling.
17
17
  #
18
18
  # @author: Tasos "Zapotek" Laskos
19
19
  # <tasos.laskos@gmail.com>
@@ -28,44 +28,15 @@ class Options
28
28
  begin
29
29
  send( "#{k.to_s}=", v )
30
30
  rescue Exception => e
31
- ap e
32
- ap e.backtrace
31
+ # ap e
32
+ # ap e.backtrace
33
33
  end
34
34
  }
35
35
  true
36
36
  end
37
37
 
38
- #
39
- # Resets all important options that can affect the scan
40
- # during framework reuse.
41
- #
42
- def reset
43
- # nil everything out
44
- self.instance_variables.each {
45
- |var|
46
-
47
- # do *NOT* nil out @dir, we'll loose our paths!
48
- next if var.to_s == '@dir'
49
-
50
- begin
51
- instance_variable_set( var.to_s, nil )
52
- rescue Exception
53
- end
54
- }
55
-
56
-
57
- @exclude = []
58
- @include = []
59
- @redundant = []
60
- @lsmod = []
61
- @exclude_cookies = []
62
-
63
- # set some defaults
64
- @redirect_limit = 20
65
-
66
- # relatively low but will give good performance without bottleneck
67
- # on low bandwidth conections
68
- @http_req_limit = 20
38
+ def datastore=( hash )
39
+ @datastore = hash
69
40
  end
70
41
 
71
42
  #
@@ -1,6 +1,6 @@
1
1
  =begin
2
2
  Arachni
3
- Copyright (c) 2010-2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
3
+ Copyright (c) 2010-2012 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
4
4
 
5
5
  This is free software; you can copy and distribute and modify
6
6
  this program under the term of the GPL v2.0 License
@@ -13,7 +13,7 @@ module Arachni
13
13
  module UI
14
14
 
15
15
  #
16
- # XML-RPC deamon Output module
16
+ # RPC deamon Output module
17
17
  #
18
18
  # It basically classifies and buffers all system messages until it's time to
19
19
  # flush the buffer and send them over the wire.
@@ -21,7 +21,7 @@ module UI
21
21
  # @author: Tasos "Zapotek" Laskos
22
22
  # <tasos.laskos@gmail.com>
23
23
  # <zapotek@segfault.gr>
24
- # @version: 0.1
24
+ # @version: 0.1.1
25
25
  #
26
26
  module Output
27
27
 
@@ -42,6 +42,8 @@ module Output
42
42
 
43
43
  @@reroute_to_file = false
44
44
 
45
+ @@buffer_cap = 30
46
+
45
47
  @@buffer ||= []
46
48
 
47
49
  #
@@ -70,9 +72,16 @@ module Output
70
72
  }
71
73
  else
72
74
  @@buffer << msg
75
+ if @@buffer_cap.is_a? Integer
76
+ @@buffer.slice!( (@@buffer.size - @@buffer_cap)..@@buffer.size )
77
+ end
73
78
  end
74
79
  end
75
80
 
81
+ def uncap_buffer!
82
+ @@buffer_cap = nil
83
+ end
84
+
76
85
  # Prints an error message
77
86
  #
78
87
  # It ignores all flags, error messages will be output under all
@@ -85,6 +94,21 @@ module Output
85
94
  buffer( :error => str )
86
95
  print_color( '[-]', 31, str, $stderr )
87
96
  end
97
+ def print_error_backtrace( e )
98
+ e.backtrace.each { |line| print_error( line ) }
99
+ end
100
+
101
+ #
102
+ # Same as print_error but the message won't be printed to stderr.
103
+ #
104
+ # Used mainly to draw attention to something that didn't behave as expected
105
+ # rather than display an actual error.
106
+ #
107
+ # @param [String] error string
108
+ #
109
+ def print_bad( str = '' )
110
+ buffer( :red => str )
111
+ end
88
112
 
89
113
  # Prints a status message
90
114
  #
@@ -293,6 +317,8 @@ module Output
293
317
  out.print "\033[1;#{color.to_s}m #{sign}\033[1;00m #{string}\n";
294
318
  end
295
319
 
320
+ extend self
321
+
296
322
  end
297
323
 
298
324
  end
@@ -1,6 +1,6 @@
1
1
  =begin
2
2
  Arachni
3
- Copyright (c) 2010-2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
3
+ Copyright (c) 2010-2012 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
4
4
 
5
5
  This is free software; you can copy and distribute and modify
6
6
  this program under the term of the GPL v2.0 License
@@ -13,13 +13,12 @@ module Arachni
13
13
  require Options.instance.dir['lib'] + 'plugin/manager'
14
14
 
15
15
  module RPC
16
- module XML
17
- module Server
16
+ class Server
18
17
  module Plugin
19
18
 
20
19
  #
21
20
  # We need to extend the original Manager and redeclare its inherited methods
22
- # which are required over XMLRPC.
21
+ # which are required over RPC.
23
22
  #
24
23
  # @author: Tasos "Zapotek" Laskos
25
24
  # <tasos.laskos@gmail.com>
@@ -39,9 +38,10 @@ class Manager < ::Arachni::Plugin::Manager
39
38
  end
40
39
 
41
40
  def load( plugins )
42
-
43
41
  @plugin_opts.merge!( plugins )
44
42
  super( plugins.keys )
43
+
44
+ @framework.opts.plugins = plugins
45
45
  end
46
46
 
47
47
  def create( name )
@@ -55,4 +55,3 @@ end
55
55
  end
56
56
  end
57
57
  end
58
- end
@@ -1,5 +1,4 @@
1
-
2
1
  opts = Arachni::Options.instance
3
2
  require opts.dir['lib'] + 'ruby/object'
3
+ require opts.dir['lib'] + 'ruby/array'
4
4
  require opts.dir['lib'] + 'ruby/string'
5
- require opts.dir['lib'] + 'ruby/xmlrpc/server'
@@ -0,0 +1,31 @@
1
+ =begin
2
+ Arachni
3
+ Copyright (c) 2010-2012 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
4
+
5
+ This is free software; you can copy and distribute and modify
6
+ this program under the term of the GPL v2.0 License
7
+ (See LICENSE file for details)
8
+
9
+ =end
10
+
11
+ class Array
12
+
13
+ def chunk( pieces = 2 )
14
+ return self if pieces <= 0
15
+
16
+ len = self.length;
17
+ mid = ( len / pieces )
18
+ chunks = []
19
+ start = 0
20
+
21
+ 1.upto( pieces ) do |i|
22
+ last = start + mid
23
+ last = last - 1 unless len % pieces >= i
24
+ chunks << self[ start..last ] || []
25
+ start = last + 1
26
+ end
27
+
28
+ return chunks
29
+ end
30
+
31
+ end
@@ -1,6 +1,6 @@
1
1
  =begin
2
2
  Arachni
3
- Copyright (c) 2010-2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
3
+ Copyright (c) 2010-2012 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
4
4
 
5
5
  This is free software; you can copy and distribute and modify
6
6
  this program under the term of the GPL v2.0 License
@@ -1,6 +1,6 @@
1
1
  =begin
2
2
  Arachni
3
- Copyright (c) 2010-2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
3
+ Copyright (c) 2010-2012 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
4
4
 
5
5
  This is free software; you can copy and distribute and modify
6
6
  this program under the term of the GPL v2.0 License
@@ -1,6 +1,6 @@
1
1
  =begin
2
2
  Arachni
3
- Copyright (c) 2010-2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
3
+ Copyright (c) 2010-2012 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
4
4
 
5
5
  This is free software; you can copy and distribute and modify
6
6
  this program under the term of the GPL v2.0 License
@@ -22,7 +22,7 @@ module Arachni
22
22
  # @author: Tasos "Zapotek" Laskos
23
23
  # <tasos.laskos@gmail.com>
24
24
  # <zapotek@segfault.gr>
25
- # @version: 0.2
25
+ # @version: 0.2.3
26
26
  #
27
27
  class Spider
28
28
 
@@ -36,18 +36,18 @@ class Spider
36
36
  attr_reader :opts
37
37
 
38
38
  #
39
- # Sitemap, array of links
39
+ # Discovered paths
40
40
  #
41
41
  # @return [Array]
42
42
  #
43
43
  attr_reader :sitemap
44
44
 
45
45
  #
46
- # Code block to be executed on each page
46
+ # URLs that caused redirects
47
47
  #
48
- # @return [Proc]
48
+ # @return [Array]
49
49
  #
50
- attr_reader :on_every_page_blocks
50
+ attr_reader :redirects
51
51
 
52
52
  #
53
53
  # Constructor <br/>
@@ -58,14 +58,32 @@ class Spider
58
58
  def initialize( opts )
59
59
  @opts = opts
60
60
 
61
- @sitemap = []
61
+ @sitemap = []
62
+ @redirects = []
62
63
  @on_every_page_blocks = []
63
64
 
65
+ @seed_url = @opts.url.to_s
66
+
67
+ @extend_paths = @opts.extend_paths || []
68
+ @restrict_paths = @opts.restrict_paths || []
69
+
70
+ @paths = [ @seed_url ]
71
+
72
+ if restricted_to_paths?
73
+ @paths |= @sitemap = @restrict_paths
74
+ else
75
+ @paths |= @extend_paths
76
+ end
77
+
64
78
  # if we have no 'include' patterns create one that will match
65
79
  # everything, like '.*'
66
80
  @opts.include =[ Regexp.new( '.*' ) ] if @opts.include.empty?
67
81
  end
68
82
 
83
+ def restricted_to_paths?
84
+ !@restrict_paths.empty?
85
+ end
86
+
69
87
  #
70
88
  # Runs the Spider and passes parsed page to the block
71
89
  #
@@ -73,87 +91,101 @@ class Spider
73
91
  #
74
92
  # @return [Arachni::Parser::Page]
75
93
  #
76
- def run( &block )
94
+ def run( parse = true, &block )
77
95
  return if @opts.link_count_limit == 0
78
96
 
79
- paths = []
80
- paths << @opts.url.to_s
81
-
82
97
  visited = []
83
98
 
84
- while( !paths.empty? )
85
- while( !paths.empty? && url = paths.pop )
86
- url = url_sanitize( url )
87
- next if skip?( url ) || !in_domain?( url )
99
+ opts = {
100
+ :timeout => nil,
101
+ :remove_id => true,
102
+ :follow_location => true,
103
+ :update_cookies => true
104
+ }
105
+
106
+ # we need a parser in order to have access to skip() in case
107
+ # there's a redirect that shouldn't be followed
108
+ seed_page = http.get( @seed_url, opts.merge( :async => false ) ).response
109
+
110
+ print_status( "[HTTP: #{seed_page.code}] " + seed_page.effective_url )
111
+
112
+ parser = Parser.new( @opts, seed_page )
113
+ parser.url = @seed_url
114
+ @paths = parser.paths | [@seed_url]
115
+
116
+ while( !@paths.empty? )
117
+ while( !@paths.empty? && url = parser.to_absolute( @paths.pop ) )
118
+ next if skip?( url )
88
119
 
89
120
  wait_if_paused
90
121
 
91
122
  visited << url
92
123
 
93
- opts = {
94
- :timeout => nil,
95
- :remove_id => true,
96
- :async => @opts.spider_first
97
- }
98
-
99
- Arachni::HTTP.instance.get( url, opts ).on_complete {
124
+ http.get( url, opts ).on_complete {
100
125
  |res|
101
126
 
102
- print_line
127
+ next if parser.skip?( res.effective_url )
128
+
103
129
  print_status( "[HTTP: #{res.code}] " + res.effective_url )
104
130
 
105
- page = Arachni::Parser.new( @opts, res ).run
106
- page.url = url_sanitize( res.effective_url )
131
+ if parse
132
+ page = Arachni::Parser::Page.from_http_response( res, @opts )
133
+ paths = page.paths
134
+ check_url = page.url
135
+ else
136
+ c_parser = Parser.new( @opts, res )
137
+ paths = c_parser.text? ? c_parser.paths : []
138
+ check_url = c_parser.url
139
+ end
140
+
141
+ if !restricted_to_paths?
142
+ @sitemap |= paths
107
143
 
108
- @sitemap |= page.paths.map { |path| url_sanitize( path ) }
109
- paths |= @sitemap - visited
144
+ if !res.headers_hash['Location'].empty?
145
+ @redirects << res.request.url
146
+ end
110
147
 
148
+ @paths |= @sitemap - visited
149
+ end
111
150
 
112
151
  # call the block...if we have one
113
152
  if block
114
153
  exception_jail{
115
- block.call( page.clone )
154
+ if !skip?( check_url )
155
+ block.call( parse ? page.clone : res )
156
+ else
157
+ print_info( 'Matched skip rule.' )
158
+ end
116
159
  }
117
160
  end
118
-
119
- # run blocks specified later
120
- @on_every_page_blocks.each {
121
- |block|
122
- block.call( page )
123
- }
124
-
125
161
  }
126
162
 
127
- Arachni::HTTP.instance.run if !@opts.spider_first
128
-
129
163
  # make sure we obey the link count limit and
130
164
  # return if we have exceeded it.
131
165
  if( @opts.link_count_limit &&
132
- @opts.link_count_limit <= visited.size )
133
- Arachni::HTTP.instance.run if @opts.spider_first
166
+ @opts.link_count_limit > 0 &&
167
+ visited.size >= @opts.link_count_limit )
168
+ http.run
134
169
  return @sitemap.uniq
135
170
  end
136
171
 
137
-
138
- end
139
-
140
- if @opts.spider_first
141
- Arachni::HTTP.instance.run
142
- else
143
- break
144
172
  end
145
173
 
174
+ http.run
146
175
  end
147
176
 
148
177
  return @sitemap.uniq
149
178
  end
150
179
 
180
+ def http
181
+ Arachni::HTTP.instance
182
+ end
183
+
151
184
  def skip?( url )
152
- @opts.exclude.each {
153
- |regexp|
154
- return true if regexp =~ url
155
- }
185
+ redundant?( url )
186
+ end
156
187
 
188
+ def redundant?( url )
157
189
  @opts.redundant.each_with_index {
158
190
  |redundant, i|
159
191
 
@@ -173,19 +205,10 @@ class Spider
173
205
  @opts.redundant[i]['count'] -= 1
174
206
  end
175
207
  }
176
-
177
-
178
- skip_cnt = 0
179
- @opts.include.each {
180
- |regexp|
181
- skip_cnt += 1 if !(regexp =~ url)
182
- }
183
-
184
- return false if skip_cnt > 1
185
-
186
208
  return false
187
209
  end
188
210
 
211
+
189
212
  def wait_if_paused
190
213
  while( paused? )
191
214
  ::IO::select( nil, nil, nil, 1 )
@@ -205,55 +228,5 @@ class Spider
205
228
  return @pause
206
229
  end
207
230
 
208
- #
209
- # Checks if the uri is in the same domain
210
- #
211
- # @param [URI] url
212
- #
213
- # @return [String]
214
- #
215
- def in_domain?( uri )
216
-
217
- uri_1 = URI( uri.to_s )
218
- uri_2 = URI( @opts.url.to_s )
219
-
220
- if( @opts.follow_subdomains )
221
- return extract_domain( uri_1 ) == extract_domain( uri_2 )
222
- end
223
-
224
- uri_1.host == uri_2.host
225
- end
226
-
227
- #
228
- # Extracts the domain from a URI object
229
- #
230
- # @param [URI] url
231
- #
232
- # @return [String]
233
- #
234
- def extract_domain( url )
235
-
236
- if !url.host then return false end
237
-
238
- splits = url.host.split( /\./ )
239
-
240
- if splits.length == 1 then return true end
241
-
242
- splits[-2] + "." + splits[-1]
243
- end
244
-
245
-
246
- #
247
- # Hook for further analysis of pages, statistics etc.
248
- #
249
- # @param [Proc] block code to be executed for every page
250
- #
251
- # @return [self]
252
- #
253
- def on_every_page( &block )
254
- @on_every_page_blocks.push( block )
255
- self
256
- end
257
-
258
231
  end
259
232
  end