arachni 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/ACKNOWLEDGMENTS.md +1 -1
- data/CHANGELOG.md +146 -0
- data/CONTRIBUTORS.md +1 -0
- data/HACKING.md +3 -3
- data/README.md +81 -49
- data/Rakefile +11 -14
- data/bin/arachni +4 -8
- data/bin/arachni_rpc +17 -0
- data/bin/arachni_rpcd +18 -0
- data/bin/arachni_rpcd_monitor +18 -0
- data/bin/arachni_web +25 -48
- data/bin/arachni_web_autostart +3 -3
- data/conf/README.webui.yaml.txt +7 -21
- data/external/metasploit/plugins/arachni.rb +0 -7
- data/extras/modules/recon/raft_dirs.rb +108 -0
- data/extras/modules/recon/raft_dirs/raft-large-directories.txt +62290 -0
- data/extras/modules/recon/raft_files.rb +110 -0
- data/extras/modules/recon/raft_files/raft-large-files.txt +37037 -0
- data/extras/modules/recon/svn_digger_dirs.rb +108 -0
- data/extras/modules/recon/svn_digger_dirs/Licence.txt +674 -0
- data/extras/modules/recon/svn_digger_dirs/ReadMe-Arachni.txt +4 -0
- data/extras/modules/recon/svn_digger_dirs/ReadMe.txt +6 -0
- data/extras/modules/recon/svn_digger_dirs/all-dirs.txt +5960 -0
- data/extras/modules/recon/svn_digger_files.rb +114 -0
- data/extras/modules/recon/svn_digger_files/Licence.txt +674 -0
- data/extras/modules/recon/svn_digger_files/ReadMe-Arachni.txt +4 -0
- data/extras/modules/recon/svn_digger_files/ReadMe.txt +6 -0
- data/extras/modules/recon/svn_digger_files/all-extensionless.txt +25419 -0
- data/extras/modules/recon/svn_digger_files/all.txt +43135 -0
- data/lib/arachni.rb +2 -7
- data/lib/{audit_store.rb → arachni/audit_store.rb} +68 -60
- data/lib/{component_manager.rb → arachni/component_manager.rb} +8 -8
- data/lib/{component_options.rb → arachni/component_options.rb} +34 -4
- data/lib/{crypto → arachni/crypto}/rsa_aes_cbc.rb +1 -2
- data/lib/arachni/database.rb +4 -0
- data/lib/arachni/database/base.rb +125 -0
- data/lib/arachni/database/hash.rb +384 -0
- data/lib/arachni/database/queue.rb +93 -0
- data/lib/{exceptions.rb → arachni/exceptions.rb} +1 -1
- data/lib/arachni/framework.rb +899 -0
- data/lib/{http.rb → arachni/http.rb} +63 -166
- data/lib/{issue.rb → arachni/issue.rb} +46 -17
- data/lib/{mixins → arachni/mixins}/observable.rb +1 -1
- data/lib/arachni/mixins/progress_bar.rb +81 -0
- data/lib/arachni/mixins/terminal.rb +106 -0
- data/lib/{module.rb → arachni/module.rb} +0 -0
- data/lib/{module → arachni/module}/auditor.rb +250 -86
- data/lib/{module → arachni/module}/base.rb +8 -18
- data/lib/{module → arachni/module}/element_db.rb +10 -2
- data/lib/{module → arachni/module}/key_filler.rb +1 -1
- data/lib/arachni/module/manager.rb +145 -0
- data/lib/{module → arachni/module}/output.rb +6 -1
- data/lib/{module → arachni/module}/trainer.rb +48 -52
- data/lib/{module → arachni/module}/utilities.rb +66 -15
- data/lib/{nokogiri → arachni/nokogiri}/xml/node.rb +0 -0
- data/lib/arachni/options.rb +986 -0
- data/lib/{parser.rb → arachni/parser.rb} +0 -0
- data/lib/{parser → arachni/parser}/auditable.rb +111 -32
- data/lib/{parser → arachni/parser}/elements.rb +28 -20
- data/lib/{parser → arachni/parser}/page.rb +20 -3
- data/lib/{parser → arachni/parser}/parser.rb +100 -63
- data/lib/{plugin.rb → arachni/plugin.rb} +0 -0
- data/lib/{plugin → arachni/plugin}/base.rb +43 -6
- data/lib/{plugin → arachni/plugin}/manager.rb +40 -13
- data/lib/{report.rb → arachni/report.rb} +0 -0
- data/lib/{report → arachni/report}/base.rb +43 -2
- data/lib/{report → arachni/report}/manager.rb +7 -18
- data/lib/arachni/rpc/client/base.rb +42 -0
- data/lib/{rpc/xml → arachni/rpc}/client/dispatcher.rb +12 -13
- data/lib/arachni/rpc/client/instance.rb +62 -0
- data/lib/arachni/rpc/server/base.rb +51 -0
- data/lib/arachni/rpc/server/dispatcher.rb +438 -0
- data/lib/arachni/rpc/server/framework.rb +1163 -0
- data/lib/arachni/rpc/server/instance.rb +184 -0
- data/lib/{rpc/xml → arachni/rpc}/server/module/manager.rb +8 -5
- data/lib/arachni/rpc/server/node.rb +267 -0
- data/lib/{rpc/xml → arachni/rpc}/server/options.rb +6 -35
- data/lib/{rpc/xml → arachni/rpc}/server/output.rb +29 -3
- data/lib/{rpc/xml → arachni/rpc}/server/plugin/manager.rb +5 -6
- data/lib/{ruby.rb → arachni/ruby.rb} +1 -2
- data/lib/arachni/ruby/array.rb +31 -0
- data/lib/{ruby → arachni/ruby}/object.rb +1 -1
- data/lib/{ruby → arachni/ruby}/string.rb +1 -1
- data/lib/{spider.rb → arachni/spider.rb} +83 -110
- data/lib/arachni/typhoeus/hydra.rb +7 -0
- data/lib/{typhoeus → arachni/typhoeus}/request.rb +11 -9
- data/lib/{typhoeus → arachni/typhoeus}/response.rb +4 -0
- data/lib/{ui → arachni/ui}/cli/cli.rb +154 -84
- data/lib/{ui → arachni/ui}/cli/output.rb +57 -19
- data/lib/{ui/xmlrpc → arachni/ui/rpc}/dispatcher_monitor.rb +11 -10
- data/lib/{ui/xmlrpc/xmlrpc.rb → arachni/ui/rpc/rpc.rb} +102 -158
- data/lib/{ui → arachni/ui}/web/addon_manager.rb +23 -3
- data/lib/arachni/ui/web/addons/autodeploy.rb +207 -0
- data/lib/{ui → arachni/ui}/web/addons/autodeploy/lib/manager.rb +142 -35
- data/lib/arachni/ui/web/addons/autodeploy/views/index.erb +291 -0
- data/lib/{ui → arachni/ui}/web/addons/sample.rb +1 -1
- data/lib/{ui → arachni/ui}/web/addons/sample/views/index.erb +0 -0
- data/lib/{ui → arachni/ui}/web/addons/scheduler.rb +30 -22
- data/lib/{ui → arachni/ui}/web/addons/scheduler/views/index.erb +56 -22
- data/lib/{ui → arachni/ui}/web/addons/scheduler/views/options.erb +0 -0
- data/lib/arachni/ui/web/dispatcher_manager.rb +274 -0
- data/lib/arachni/ui/web/instance_manager.rb +69 -0
- data/lib/{ui → arachni/ui}/web/log.rb +1 -1
- data/lib/arachni/ui/web/output_stream.rb +54 -0
- data/lib/{ui → arachni/ui}/web/report_manager.rb +48 -54
- data/lib/{ui → arachni/ui}/web/scheduler.rb +42 -47
- data/lib/arachni/ui/web/server.rb +1197 -0
- data/lib/{ui → arachni/ui}/web/server/db/placeholder +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/banner.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/bodybg-small.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/bodybg.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/pbar-ani.gif +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/css/smoothness/jquery-ui-1.8.9.custom.css +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/favicon.ico +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/footer.jpg +0 -0
- data/lib/{ui/web/server/public/icons/error.png → arachni/ui/web/server/public/icons/bad.png} +0 -0
- data/lib/arachni/ui/web/server/public/icons/error.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/icons/info.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/icons/ok.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/icons/status.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/js/jquery-1.4.4.min.js +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/js/jquery-ui-1.8.9.custom.min.js +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/js/jquery-ui-timepicker.js +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/logo.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/nav-left.jpg +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/nav-right.jpg +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/nav-selected-left.jpg +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/nav-selected-right.jpg +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/plugins/sample/style.css +0 -0
- data/lib/{ui/web/server/tmp → arachni/ui/web/server/public/reports}/placeholder +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/sidebar-bottom.jpg +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/sidebar-h4.jpg +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/sidebar-top.jpg +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/spider.png +0 -0
- data/lib/{ui → arachni/ui}/web/server/public/style.css +3 -2
- data/lib/arachni/ui/web/server/tmp/placeholder +0 -0
- data/lib/{ui → arachni/ui}/web/server/views/addon.erb +0 -0
- data/lib/{ui → arachni/ui}/web/server/views/addons.erb +0 -0
- data/lib/{ui → arachni/ui}/web/server/views/dispatcher_error.erb +0 -0
- data/lib/arachni/ui/web/server/views/dispatchers.erb +175 -0
- data/lib/arachni/ui/web/server/views/dispatchers_edit.erb +71 -0
- data/lib/arachni/ui/web/server/views/error.erb +22 -0
- data/lib/{ui → arachni/ui}/web/server/views/flash.erb +2 -2
- data/lib/arachni/ui/web/server/views/home.erb +60 -0
- data/lib/{ui → arachni/ui}/web/server/views/instance.erb +55 -75
- data/lib/arachni/ui/web/server/views/js/home.erb +32 -0
- data/lib/{ui → arachni/ui}/web/server/views/layout.erb +2 -2
- data/lib/{ui → arachni/ui}/web/server/views/log.erb +0 -0
- data/lib/arachni/ui/web/server/views/module.erb +30 -0
- data/lib/{ui → arachni/ui}/web/server/views/modules.erb +2 -22
- data/lib/{ui → arachni/ui}/web/server/views/options.erb +0 -0
- data/lib/{ui → arachni/ui}/web/server/views/output_results.erb +4 -4
- data/lib/{ui → arachni/ui}/web/server/views/plugins.erb +23 -12
- data/lib/{ui → arachni/ui}/web/server/views/report_formats.erb +1 -1
- data/lib/{ui → arachni/ui}/web/server/views/reports.erb +1 -1
- data/lib/{ui → arachni/ui}/web/server/views/settings.erb +59 -16
- data/lib/{ui → arachni/ui}/web/server/views/welcome.erb +3 -1
- data/lib/{ui → arachni/ui}/web/utilities.rb +8 -3
- data/lib/arachni/version.rb +16 -0
- data/modules/audit/code_injection.rb +11 -20
- data/modules/audit/code_injection_timing.rb +2 -6
- data/modules/audit/csrf.rb +8 -16
- data/modules/audit/ldapi.rb +5 -11
- data/modules/audit/os_cmd_injection.rb +5 -9
- data/modules/audit/os_cmd_injection_timing.rb +4 -8
- data/modules/audit/path_traversal.rb +7 -13
- data/modules/audit/response_splitting.rb +8 -21
- data/modules/audit/rfi.rb +6 -46
- data/modules/audit/sqli.rb +5 -11
- data/modules/audit/sqli/regexp_ids.txt +0 -6
- data/modules/audit/sqli_blind_rdiff.rb +5 -10
- data/modules/audit/sqli_blind_timing.rb +4 -9
- data/modules/audit/trainer.rb +6 -12
- data/modules/audit/unvalidated_redirect.rb +6 -17
- data/modules/audit/xpath.rb +5 -12
- data/modules/audit/xss.rb +37 -23
- data/modules/audit/xss_event.rb +5 -10
- data/modules/audit/xss_path.rb +47 -41
- data/modules/audit/xss_script_tag.rb +5 -10
- data/modules/audit/xss_tag.rb +5 -10
- data/modules/audit/xss_uri.rb +17 -89
- data/modules/recon/allowed_methods.rb +6 -15
- data/modules/recon/backdoors.rb +12 -52
- data/modules/recon/backup_files.rb +25 -88
- data/modules/recon/common_directories.rb +8 -54
- data/modules/recon/common_files.rb +7 -58
- data/modules/recon/directory_listing.rb +6 -15
- data/modules/recon/grep/captcha.rb +1 -1
- data/modules/recon/grep/credit_card.rb +62 -27
- data/modules/recon/grep/cvs_svn_users.rb +1 -1
- data/modules/recon/grep/emails.rb +1 -1
- data/modules/recon/grep/html_objects.rb +1 -1
- data/modules/recon/grep/private_ip.rb +1 -1
- data/modules/recon/grep/ssn.rb +9 -9
- data/modules/recon/htaccess_limit.rb +6 -14
- data/modules/recon/http_put.rb +7 -15
- data/modules/recon/interesting_responses.rb +7 -13
- data/modules/recon/mixed_resource.rb +100 -0
- data/modules/recon/unencrypted_password_forms.rb +8 -20
- data/modules/recon/webdav.rb +6 -16
- data/modules/recon/xst.rb +7 -13
- data/path_extractors/anchors.rb +1 -1
- data/path_extractors/forms.rb +1 -1
- data/path_extractors/frames.rb +1 -1
- data/path_extractors/generic.rb +47 -3
- data/path_extractors/links.rb +1 -1
- data/path_extractors/meta_refresh.rb +1 -1
- data/path_extractors/scripts.rb +3 -4
- data/path_extractors/sitemap.rb +1 -1
- data/plugins/autologin.rb +9 -18
- data/plugins/beep_notify.rb +51 -0
- data/plugins/cookie_collector.rb +12 -12
- data/plugins/defaults/autothrottle.rb +86 -0
- data/plugins/{content_types.rb → defaults/content_types.rb} +25 -19
- data/plugins/{healthmap.rb → defaults/healthmap.rb} +30 -18
- data/plugins/defaults/metamodules/remedies/discovery.rb +164 -0
- data/plugins/defaults/metamodules/remedies/manual_verification.rb +65 -0
- data/{metamodules/timeout_notice.rb → plugins/defaults/metamodules/remedies/timing_attacks.rb} +26 -22
- data/{metamodules → plugins/defaults/metamodules}/uniformity.rb +15 -14
- data/plugins/{profiler.rb → defaults/profiler.rb} +19 -30
- data/plugins/defaults/resolver.rb +55 -0
- data/plugins/email_notify.rb +108 -0
- data/plugins/form_dicattack.rb +8 -16
- data/plugins/http_dicattack.rb +4 -12
- data/plugins/libnotify.rb +86 -0
- data/plugins/proxy.rb +8 -17
- data/plugins/proxy/server.rb +3 -3
- data/plugins/rescan.rb +60 -0
- data/plugins/waf_detector.rb +5 -16
- data/profiles/full.afp +3 -30
- data/reports/afr.rb +2 -5
- data/reports/ap.rb +3 -1
- data/reports/html.rb +210 -68
- data/reports/html/default.erb +72 -1014
- data/reports/html/default/configuration.erb +126 -0
- data/reports/html/default/css/jquery-ui.css +570 -0
- data/reports/html/default/css/jquery.jqplot.min.css +1 -0
- data/reports/html/default/css/main.css +391 -0
- data/reports/html/default/issue.erb +189 -0
- data/reports/html/default/issues.erb +65 -0
- data/reports/html/default/js/charts.js +146 -0
- data/reports/html/default/js/helpers.js +95 -0
- data/reports/html/default/js/init.js +73 -0
- data/reports/html/default/js/lib/jqplot.barRenderer.min.js +57 -0
- data/reports/html/default/js/lib/jqplot.categoryAxisRenderer.min.js +57 -0
- data/reports/html/default/js/lib/jqplot.cursor.min.js +57 -0
- data/reports/html/default/js/lib/jqplot.pieRenderer.min.js +57 -0
- data/reports/html/default/js/lib/jqplot.pointLabels.min.js +57 -0
- data/reports/html/default/js/lib/jquery-ui.min.js +404 -0
- data/reports/html/default/js/lib/jquery.jqplot.min.js +57 -0
- data/reports/html/default/js/lib/jquery.min.js +167 -0
- data/reports/html/default/plugins.erb +22 -0
- data/reports/html/default/search.erb +8 -0
- data/reports/html/default/sitemap.erb +15 -0
- data/reports/html/default/summary.erb +68 -0
- data/reports/html/default/summary_issue.erb +19 -0
- data/reports/json.rb +51 -0
- data/reports/marshal.rb +49 -0
- data/reports/metareport.rb +4 -6
- data/reports/metareport/arachni_metareport.rb +1 -1
- data/reports/plugin_formatters/html/autologin.rb +30 -41
- data/reports/plugin_formatters/html/content_types.rb +1 -10
- data/reports/plugin_formatters/html/cookie_collector.rb +36 -44
- data/reports/plugin_formatters/html/discovery.rb +50 -0
- data/reports/plugin_formatters/html/form_dicattack.rb +24 -32
- data/reports/plugin_formatters/html/healthmap.rb +45 -54
- data/reports/plugin_formatters/html/http_dicattack.rb +24 -32
- data/reports/plugin_formatters/html/profiler.rb +17 -48
- data/reports/plugin_formatters/html/profiler/template.erb +6 -99
- data/reports/plugin_formatters/html/resolver.rb +63 -0
- data/reports/plugin_formatters/html/{metaformatters/timeout_notice.rb → timing_attacks.rb} +7 -19
- data/reports/plugin_formatters/html/{metaformatters/uniformity.rb → uniformity.rb} +5 -17
- data/reports/plugin_formatters/html/waf_detector.rb +24 -32
- data/reports/plugin_formatters/stdout/autologin.rb +30 -35
- data/reports/plugin_formatters/stdout/content_types.rb +41 -46
- data/reports/plugin_formatters/stdout/cookie_collector.rb +33 -38
- data/reports/plugin_formatters/stdout/discovery.rb +47 -0
- data/reports/plugin_formatters/stdout/form_dicattack.rb +27 -32
- data/reports/plugin_formatters/stdout/healthmap.rb +47 -51
- data/reports/plugin_formatters/stdout/http_dicattack.rb +27 -32
- data/reports/plugin_formatters/stdout/metamodules.rb +48 -55
- data/reports/plugin_formatters/stdout/profiler.rb +60 -65
- data/reports/plugin_formatters/stdout/resolver.rb +45 -0
- data/reports/plugin_formatters/stdout/{metaformatters/timeout_notice.rb → timing_attacks.rb} +6 -14
- data/reports/plugin_formatters/stdout/{metaformatters/uniformity.rb → uniformity.rb} +6 -14
- data/reports/plugin_formatters/stdout/waf_detector.rb +23 -28
- data/reports/plugin_formatters/xml/autologin.rb +36 -41
- data/reports/plugin_formatters/xml/content_types.rb +47 -52
- data/reports/plugin_formatters/xml/cookie_collector.rb +39 -44
- data/reports/plugin_formatters/xml/discovery.rb +54 -0
- data/reports/plugin_formatters/xml/form_dicattack.rb +22 -27
- data/reports/plugin_formatters/xml/healthmap.rb +53 -58
- data/reports/plugin_formatters/xml/http_dicattack.rb +22 -27
- data/reports/plugin_formatters/xml/profiler.rb +61 -77
- data/reports/plugin_formatters/xml/resolver.rb +53 -0
- data/reports/plugin_formatters/xml/{metaformatters/timeout_notice.rb → timing_attacks.rb} +3 -15
- data/reports/plugin_formatters/xml/{metaformatters/uniformity.rb → uniformity.rb} +4 -14
- data/reports/plugin_formatters/xml/waf_detector.rb +23 -28
- data/reports/stdout.rb +1 -1
- data/reports/txt.rb +2 -5
- data/reports/xml.rb +2 -5
- data/reports/xml/buffer.rb +6 -2
- data/reports/yaml.rb +49 -0
- metadata +419 -278
- data/bin/arachni_xmlrpc +0 -21
- data/bin/arachni_xmlrpcd +0 -82
- data/bin/arachni_xmlrpcd_monitor +0 -74
- data/getoptslong.rb +0 -242
- data/lib/anemone.rb +0 -2
- data/lib/framework.rb +0 -673
- data/lib/module/manager.rb +0 -111
- data/lib/options.rb +0 -547
- data/lib/rpc/xml/client/base.rb +0 -76
- data/lib/rpc/xml/client/instance.rb +0 -88
- data/lib/rpc/xml/server/base.rb +0 -112
- data/lib/rpc/xml/server/dispatcher.rb +0 -386
- data/lib/rpc/xml/server/framework.rb +0 -206
- data/lib/rpc/xml/server/instance.rb +0 -191
- data/lib/ruby/xmlrpc/server.rb +0 -27
- data/lib/ui/web/addons/autodeploy.rb +0 -172
- data/lib/ui/web/addons/autodeploy/views/index.erb +0 -124
- data/lib/ui/web/dispatcher_manager.rb +0 -165
- data/lib/ui/web/instance_manager.rb +0 -87
- data/lib/ui/web/output_stream.rb +0 -94
- data/lib/ui/web/server.rb +0 -925
- data/lib/ui/web/server/public/reports/placeholder +0 -1
- data/lib/ui/web/server/views/dispatchers.erb +0 -100
- data/lib/ui/web/server/views/dispatchers_edit.erb +0 -42
- data/lib/ui/web/server/views/error.erb +0 -1
- data/lib/ui/web/server/views/home.erb +0 -25
- data/metamodules/autothrottle.rb +0 -74
- data/plugins/metamodules.rb +0 -118
- data/profiles/comprehensive.afp +0 -74
- data/reports/plugin_formatters/html/metamodules.rb +0 -93
- data/reports/plugin_formatters/xml/metamodules.rb +0 -91
@@ -1,6 +1,6 @@
|
|
1
1
|
=begin
|
2
2
|
Arachni
|
3
|
-
Copyright (c) 2010-
|
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
|
@@ -0,0 +1,899 @@
|
|
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
|
+
require 'ap'
|
12
|
+
require 'pp'
|
13
|
+
require 'rubygems'
|
14
|
+
|
15
|
+
require File.expand_path( File.dirname( __FILE__ ) ) + '/options'
|
16
|
+
opts = Arachni::Options.instance
|
17
|
+
|
18
|
+
require opts.dir['lib'] + 'version'
|
19
|
+
require opts.dir['lib'] + 'ruby'
|
20
|
+
require opts.dir['lib'] + 'exceptions'
|
21
|
+
require opts.dir['lib'] + 'spider'
|
22
|
+
require opts.dir['lib'] + 'parser'
|
23
|
+
require opts.dir['lib'] + 'issue'
|
24
|
+
require opts.dir['lib'] + 'module'
|
25
|
+
require opts.dir['lib'] + 'plugin'
|
26
|
+
require opts.dir['lib'] + 'audit_store'
|
27
|
+
require opts.dir['lib'] + 'http'
|
28
|
+
require opts.dir['lib'] + 'report'
|
29
|
+
require opts.dir['lib'] + 'database'
|
30
|
+
require opts.dir['lib'] + 'component_manager'
|
31
|
+
require opts.dir['mixins'] + 'progress_bar'
|
32
|
+
|
33
|
+
|
34
|
+
module Arachni
|
35
|
+
|
36
|
+
#
|
37
|
+
# The Framework class ties together all the components.
|
38
|
+
#
|
39
|
+
# It should be wrapped by a UI class.
|
40
|
+
#
|
41
|
+
# It's the brains of the operation, it bosses the rest of the classes around.
|
42
|
+
#
|
43
|
+
# It runs the audit, loads modules and reports and runs them according to
|
44
|
+
# user options.
|
45
|
+
#
|
46
|
+
# @author: Tasos "Zapotek" Laskos
|
47
|
+
# <tasos.laskos@gmail.com>
|
48
|
+
# <zapotek@segfault.gr>
|
49
|
+
# @version: 0.2.5
|
50
|
+
#
|
51
|
+
class Framework
|
52
|
+
|
53
|
+
#
|
54
|
+
# include the output interface but try to use it as little as possible
|
55
|
+
#
|
56
|
+
# the UI classes should take care of communicating with the user
|
57
|
+
#
|
58
|
+
include Arachni::UI::Output
|
59
|
+
|
60
|
+
include Arachni::Module::Utilities
|
61
|
+
include Arachni::Mixins::Observable
|
62
|
+
|
63
|
+
# the version of *this* class
|
64
|
+
REVISION = '0.2.5'
|
65
|
+
|
66
|
+
#
|
67
|
+
# Instance options
|
68
|
+
#
|
69
|
+
# @return [Options]
|
70
|
+
#
|
71
|
+
attr_reader :opts
|
72
|
+
|
73
|
+
#
|
74
|
+
# @return [Arachni::Report::Manager] report manager
|
75
|
+
#
|
76
|
+
attr_reader :reports
|
77
|
+
|
78
|
+
#
|
79
|
+
# @return [Arachni::Module::Manager] module manager
|
80
|
+
#
|
81
|
+
attr_reader :modules
|
82
|
+
|
83
|
+
#
|
84
|
+
# @return [Arachni::Plugin::Manager] plugin manager
|
85
|
+
#
|
86
|
+
attr_reader :plugins
|
87
|
+
|
88
|
+
#
|
89
|
+
# @return [Arachni::Spider] spider
|
90
|
+
#
|
91
|
+
attr_reader :spider
|
92
|
+
|
93
|
+
#
|
94
|
+
# URLs of all discovered pages
|
95
|
+
#
|
96
|
+
# @return [Array]
|
97
|
+
#
|
98
|
+
attr_reader :sitemap
|
99
|
+
|
100
|
+
#
|
101
|
+
# Array of URLs that have been audited
|
102
|
+
#
|
103
|
+
# @return [Array]
|
104
|
+
#
|
105
|
+
attr_reader :auditmap
|
106
|
+
|
107
|
+
#
|
108
|
+
# Total number of pages added to their audit queue
|
109
|
+
#
|
110
|
+
# @return [Integer]
|
111
|
+
#
|
112
|
+
attr_reader :page_queue_total_size
|
113
|
+
|
114
|
+
#
|
115
|
+
# Current amount of pages in the audit queue
|
116
|
+
#
|
117
|
+
# @return [Integer]
|
118
|
+
#
|
119
|
+
attr_reader :page_queue_size
|
120
|
+
|
121
|
+
#
|
122
|
+
# Total number of urls added to their audit queue
|
123
|
+
#
|
124
|
+
# @return [Integer]
|
125
|
+
#
|
126
|
+
attr_reader :url_queue_total_size
|
127
|
+
|
128
|
+
#
|
129
|
+
# Current amount of urls in the audit queue
|
130
|
+
#
|
131
|
+
# @return [Integer]
|
132
|
+
#
|
133
|
+
attr_reader :url_queue_size
|
134
|
+
|
135
|
+
|
136
|
+
#
|
137
|
+
# Initializes system components.
|
138
|
+
#
|
139
|
+
# @param [Options] opts
|
140
|
+
#
|
141
|
+
def initialize( opts )
|
142
|
+
|
143
|
+
Encoding.default_external = "BINARY"
|
144
|
+
Encoding.default_internal = "BINARY"
|
145
|
+
|
146
|
+
@opts = opts
|
147
|
+
|
148
|
+
@modules = Arachni::Module::Manager.new( @opts )
|
149
|
+
@reports = Arachni::Report::Manager.new( @opts )
|
150
|
+
@plugins = Arachni::Plugin::Manager.new( self )
|
151
|
+
|
152
|
+
# will store full-fledged pages generated by the Trainer since these
|
153
|
+
# may not be be accessible simply by their URL
|
154
|
+
# @page_queue = ::Arachni::Database::Queue.new
|
155
|
+
@page_queue = Queue.new
|
156
|
+
@page_queue_total_size = 0
|
157
|
+
|
158
|
+
# will hold paths found by the spider in order to be converted to pages
|
159
|
+
# and ultimately audited by the modules
|
160
|
+
@url_queue = Queue.new
|
161
|
+
@url_queue_total_size = 0
|
162
|
+
|
163
|
+
prepare_cookie_jar( )
|
164
|
+
prepare_user_agent( )
|
165
|
+
|
166
|
+
# deep clone the redundancy rules to preserve their counter
|
167
|
+
# for the reports
|
168
|
+
@orig_redundant = @opts.redundant.deep_clone
|
169
|
+
|
170
|
+
@running = false
|
171
|
+
@paused = []
|
172
|
+
|
173
|
+
@plugin_store = {}
|
174
|
+
@store = nil
|
175
|
+
|
176
|
+
@auditmap = []
|
177
|
+
@sitemap = []
|
178
|
+
|
179
|
+
@current_url = ''
|
180
|
+
end
|
181
|
+
|
182
|
+
#
|
183
|
+
# @return [Arachni::HTTP] HTTP instance
|
184
|
+
#
|
185
|
+
def http
|
186
|
+
Arachni::HTTP.instance
|
187
|
+
end
|
188
|
+
|
189
|
+
#
|
190
|
+
# Prepares the framework for the audit.
|
191
|
+
#
|
192
|
+
# Sets the status to 'running', starts the clock and runs the plugins.
|
193
|
+
#
|
194
|
+
# Must be called just before calling {#audit}.
|
195
|
+
#
|
196
|
+
def prepare
|
197
|
+
@running = true
|
198
|
+
@opts.start_datetime = Time.now
|
199
|
+
|
200
|
+
# run all plugins
|
201
|
+
@plugins.run
|
202
|
+
end
|
203
|
+
|
204
|
+
#
|
205
|
+
# Runs the system
|
206
|
+
#
|
207
|
+
# It parses the instance options, {#prepare}, runs the {#audit} and {#clean_up!}.
|
208
|
+
#
|
209
|
+
# @param [Block] &block a block to call after the audit has finished
|
210
|
+
# but before running the reports
|
211
|
+
#
|
212
|
+
def run( &block )
|
213
|
+
prepare
|
214
|
+
|
215
|
+
# catch exceptions so that if something breaks down or the user opted to
|
216
|
+
# exit the reports will still run with whatever results
|
217
|
+
# Arachni managed to gather
|
218
|
+
begin
|
219
|
+
# start the audit
|
220
|
+
exception_jail{ audit( ) }
|
221
|
+
rescue Exception => e
|
222
|
+
# ap e
|
223
|
+
# ap e.backtrace
|
224
|
+
end
|
225
|
+
|
226
|
+
clean_up!
|
227
|
+
begin
|
228
|
+
block.call if block
|
229
|
+
rescue Exception
|
230
|
+
end
|
231
|
+
|
232
|
+
# run reports
|
233
|
+
if( @opts.reports && !@opts.reports.empty? )
|
234
|
+
exception_jail{ @reports.run( audit_store( ) ) }
|
235
|
+
end
|
236
|
+
|
237
|
+
return true
|
238
|
+
end
|
239
|
+
|
240
|
+
#
|
241
|
+
# Returns the following framework stats:
|
242
|
+
#
|
243
|
+
# * :requests -- HTTP request count
|
244
|
+
# * :responses -- HTTP response count
|
245
|
+
# * :time_out_count -- Amount of timed-out requests
|
246
|
+
# * :time -- Amount of running time
|
247
|
+
# * :avg -- Average requests per second
|
248
|
+
# * :sitemap_size -- Number of discovered pages
|
249
|
+
# * :auditmap_size -- Number of audited pages
|
250
|
+
# * :progress -- Progress percentage
|
251
|
+
# * :curr_res_time -- Average response time for the current burst of requests
|
252
|
+
# * :curr_res_cnt -- Amount of responses for the current burst
|
253
|
+
# * :curr_avg -- Average requests per second for the current burst
|
254
|
+
# * :average_res_time -- Average response time
|
255
|
+
# * :max_concurrency -- Current maximum concurrency of HTTP requests
|
256
|
+
# * :current_page -- URL of the currently audited page
|
257
|
+
# * :eta -- Estimated time of arrival i.e. estimated remaining time
|
258
|
+
#
|
259
|
+
# @param [Bool] refresh_time updates the running time of the audit
|
260
|
+
# (usefully when you want stats while paused without messing with the clocks)
|
261
|
+
#
|
262
|
+
# @param [Bool] override_refresh
|
263
|
+
#
|
264
|
+
# @return [Hash]
|
265
|
+
#
|
266
|
+
def stats( refresh_time = false, override_refresh = false )
|
267
|
+
req_cnt = http.request_count
|
268
|
+
res_cnt = http.response_count
|
269
|
+
|
270
|
+
@opts.start_datetime = Time.now if !@opts.start_datetime
|
271
|
+
|
272
|
+
sitemap_sz = @url_queue_total_size + @page_queue_total_size
|
273
|
+
auditmap_sz = @auditmap.size
|
274
|
+
|
275
|
+
if( !refresh_time || auditmap_sz == sitemap_sz ) && !override_refresh
|
276
|
+
@opts.delta_time ||= Time.now - @opts.start_datetime
|
277
|
+
else
|
278
|
+
@opts.delta_time = Time.now - @opts.start_datetime
|
279
|
+
end
|
280
|
+
|
281
|
+
curr_avg = 0
|
282
|
+
if http.curr_res_cnt > 0 && http.curr_res_time > 0
|
283
|
+
curr_avg = (http.curr_res_cnt / http.curr_res_time).to_i
|
284
|
+
end
|
285
|
+
|
286
|
+
avg = 0
|
287
|
+
if res_cnt > 0
|
288
|
+
avg = ( res_cnt / @opts.delta_time ).to_i
|
289
|
+
end
|
290
|
+
|
291
|
+
# we need to remove URLs that lead to redirects from the sitemap
|
292
|
+
# when calculating the progress %.
|
293
|
+
#
|
294
|
+
# this is because even though these URLs are valid webapp paths
|
295
|
+
# they are not actual pages and thus can't be audited;
|
296
|
+
# so the sitemap and auditmap will never match and the progress will
|
297
|
+
# never get to 100% which may confuse users.
|
298
|
+
#
|
299
|
+
if @spider
|
300
|
+
redir_sz = @spider.redirects.size
|
301
|
+
else
|
302
|
+
redir_sz = 0
|
303
|
+
end
|
304
|
+
|
305
|
+
#
|
306
|
+
# There are 2 audit phases:
|
307
|
+
# * regular analysis attacks
|
308
|
+
# * timing attacks
|
309
|
+
#
|
310
|
+
# When calculating the progress % we have to take both into account,
|
311
|
+
# however each is calculated using different criteria.
|
312
|
+
#
|
313
|
+
# Progress of regular attacks is calculated as:
|
314
|
+
# amount of audited pages / amount of all discovered pages
|
315
|
+
#
|
316
|
+
# However, the progress of the timing attacks is calculated as:
|
317
|
+
# amount of called timeout blocks / amount of total blocks
|
318
|
+
#
|
319
|
+
# The timing attack modules are run with the regular ones however
|
320
|
+
# their procedures are piled up into an array of Procs
|
321
|
+
# which are called after the regular attacks.
|
322
|
+
#
|
323
|
+
# So when we reach the point of needing to include their progress in
|
324
|
+
# the overall progress percentage we'll be working with accurate
|
325
|
+
# data regarding the total blocks, etc.
|
326
|
+
#
|
327
|
+
|
328
|
+
#
|
329
|
+
# If we have timing attacks then each phase must account for half
|
330
|
+
# of the progress.
|
331
|
+
#
|
332
|
+
# This is not very granular but it's good enough for now...
|
333
|
+
#
|
334
|
+
if Arachni::Module::Auditor.timeout_loaded_modules.size > 0
|
335
|
+
multi = 50
|
336
|
+
else
|
337
|
+
multi = 100
|
338
|
+
end
|
339
|
+
|
340
|
+
progress = (Float( auditmap_sz ) /
|
341
|
+
( sitemap_sz - redir_sz ) ) * multi
|
342
|
+
|
343
|
+
if Arachni::Module::Auditor.running_timeout_attacks?
|
344
|
+
|
345
|
+
called_blocks = Arachni::Module::Auditor.timeout_audit_operations_cnt -
|
346
|
+
Arachni::Module::Auditor.current_timeout_audit_operations_cnt
|
347
|
+
|
348
|
+
progress += ( Float( called_blocks ) /
|
349
|
+
Arachni::Module::Auditor.timeout_audit_operations_cnt ) * multi
|
350
|
+
end
|
351
|
+
|
352
|
+
begin
|
353
|
+
progress = Float( sprintf( "%.2f", progress ) )
|
354
|
+
rescue
|
355
|
+
progress = 0.0
|
356
|
+
end
|
357
|
+
|
358
|
+
# sometimes progress may slightly exceed 100%
|
359
|
+
# which can cause a few strange stuff to happen
|
360
|
+
progress = 100.0 if progress > 100.0
|
361
|
+
|
362
|
+
return {
|
363
|
+
:requests => req_cnt,
|
364
|
+
:responses => res_cnt,
|
365
|
+
:time_out_count => http.time_out_count,
|
366
|
+
:time => audit_store.delta_time,
|
367
|
+
:avg => avg,
|
368
|
+
:sitemap_size => @sitemap.size,
|
369
|
+
:auditmap_size => auditmap_sz,
|
370
|
+
:progress => progress,
|
371
|
+
:curr_res_time => http.curr_res_time,
|
372
|
+
:curr_res_cnt => http.curr_res_cnt,
|
373
|
+
:curr_avg => curr_avg,
|
374
|
+
:average_res_time => http.average_res_time,
|
375
|
+
:max_concurrency => http.max_concurrency,
|
376
|
+
:current_page => @current_url,
|
377
|
+
:eta => ::Arachni::Mixins::ProgressBar.eta( progress, @opts.start_datetime )
|
378
|
+
}
|
379
|
+
end
|
380
|
+
|
381
|
+
#
|
382
|
+
# Pushes a page to the page audit queue and updates {#page_queue_total_size}
|
383
|
+
#
|
384
|
+
def push_to_page_queue( page )
|
385
|
+
@page_queue << page
|
386
|
+
@page_queue_total_size += 1
|
387
|
+
end
|
388
|
+
|
389
|
+
#
|
390
|
+
# Pushes a URL to the URL audit queue and updates {#url_queue_total_size}
|
391
|
+
#
|
392
|
+
def push_to_url_queue( url )
|
393
|
+
@url_queue << url
|
394
|
+
@url_queue_total_size += 1
|
395
|
+
end
|
396
|
+
|
397
|
+
#
|
398
|
+
# Performs the audit
|
399
|
+
#
|
400
|
+
# Runs the spider, pushes each page or url to their respective audit queue,
|
401
|
+
# calls {#audit_queue}, runs the timeout attacks ({Arachni::Module::Auditor.timeout_audit_run}) and finally re-runs
|
402
|
+
# {#audit_queue} in case the timing attacks uncovered a new page.
|
403
|
+
#
|
404
|
+
def audit
|
405
|
+
wait_if_paused
|
406
|
+
|
407
|
+
@spider = Arachni::Spider.new( @opts )
|
408
|
+
|
409
|
+
# if we're restricted to a given list of paths there's no reason to run the spider
|
410
|
+
if @opts.restrict_paths && !@opts.restrict_paths.empty?
|
411
|
+
@sitemap = @opts.restrict_paths
|
412
|
+
@sitemap.each {
|
413
|
+
|url|
|
414
|
+
push_to_url_queue( url_sanitize( url ) )
|
415
|
+
}
|
416
|
+
else
|
417
|
+
# initiates the crawl
|
418
|
+
@spider.run( false ) {
|
419
|
+
|response|
|
420
|
+
@sitemap |= @spider.sitemap
|
421
|
+
push_to_url_queue( url_sanitize( response.effective_url ) )
|
422
|
+
}
|
423
|
+
end
|
424
|
+
|
425
|
+
audit_queue
|
426
|
+
|
427
|
+
exception_jail {
|
428
|
+
if !Arachni::Module::Auditor.timeout_audit_blocks.empty?
|
429
|
+
print_line
|
430
|
+
print_status( 'Running timing attacks.' )
|
431
|
+
print_info( '---------------------------------------' )
|
432
|
+
Arachni::Module::Auditor.on_timing_attacks {
|
433
|
+
|res, elem|
|
434
|
+
@current_url = elem.action if !elem.action.empty?
|
435
|
+
}
|
436
|
+
Arachni::Module::Auditor.timeout_audit_run
|
437
|
+
end
|
438
|
+
|
439
|
+
audit_queue
|
440
|
+
}
|
441
|
+
|
442
|
+
end
|
443
|
+
|
444
|
+
#
|
445
|
+
# Audits the URL and Page queues
|
446
|
+
#
|
447
|
+
def audit_queue
|
448
|
+
|
449
|
+
# goes through the URLs discovered by the spider, repeats the request
|
450
|
+
# and parses the responses into page objects
|
451
|
+
#
|
452
|
+
# yes...repeating the request is wasteful but we can't store the
|
453
|
+
# responses of the spider to consume them here because there's no way
|
454
|
+
# of knowing how big the site will be.
|
455
|
+
#
|
456
|
+
while( !@url_queue.empty? && url = @url_queue.pop )
|
457
|
+
|
458
|
+
http.get( url, :remove_id => true ).on_complete {
|
459
|
+
|res|
|
460
|
+
|
461
|
+
page = Arachni::Parser::Page.from_http_response( res, @opts )
|
462
|
+
|
463
|
+
# audit the page
|
464
|
+
exception_jail{ run_mods( page ) }
|
465
|
+
|
466
|
+
# don't let the page queue build up,
|
467
|
+
# consume it as soon as possible because the pages are stored
|
468
|
+
# in the FS and thus take up precious system resources
|
469
|
+
audit_page_queue
|
470
|
+
}
|
471
|
+
|
472
|
+
harvest_http_responses if !@opts.http_harvest_last
|
473
|
+
end
|
474
|
+
|
475
|
+
harvest_http_responses if( @opts.http_harvest_last )
|
476
|
+
|
477
|
+
audit_page_queue
|
478
|
+
|
479
|
+
harvest_http_responses if( @opts.http_harvest_last )
|
480
|
+
end
|
481
|
+
|
482
|
+
#
|
483
|
+
# Audits the page queue
|
484
|
+
#
|
485
|
+
def audit_page_queue
|
486
|
+
# this will run until no new elements appear for the given page
|
487
|
+
while( !@page_queue.empty? && page = @page_queue.pop )
|
488
|
+
|
489
|
+
# audit the page
|
490
|
+
exception_jail{ run_mods( page ) }
|
491
|
+
harvest_http_responses if !@opts.http_harvest_last
|
492
|
+
end
|
493
|
+
end
|
494
|
+
|
495
|
+
|
496
|
+
#
|
497
|
+
# Returns the results of the audit as an {AuditStore} instance
|
498
|
+
#
|
499
|
+
# @see AuditStore
|
500
|
+
#
|
501
|
+
# @return [AuditStore]
|
502
|
+
#
|
503
|
+
def audit_store( fresh = true )
|
504
|
+
|
505
|
+
# restore the original redundancy rules and their counters
|
506
|
+
@opts.redundant = @orig_redundant
|
507
|
+
opts = @opts.to_h
|
508
|
+
opts['mods'] = @modules.keys
|
509
|
+
|
510
|
+
if( !fresh && @store )
|
511
|
+
return @store
|
512
|
+
else
|
513
|
+
return @store = AuditStore.new( {
|
514
|
+
:version => version( ),
|
515
|
+
:revision => REVISION,
|
516
|
+
:options => opts,
|
517
|
+
:sitemap => audit_store_sitemap || [],
|
518
|
+
:issues => @modules.results( ).deep_clone,
|
519
|
+
:plugins => @plugin_store
|
520
|
+
})
|
521
|
+
end
|
522
|
+
end
|
523
|
+
alias :auditstore :audit_store
|
524
|
+
|
525
|
+
#
|
526
|
+
# Special sitemap for the auditstore.
|
527
|
+
#
|
528
|
+
# Used only under special circumstances, will usually return the {#sitemap}
|
529
|
+
# but can be overridden by the {::Arachni::RPC::Framework}.
|
530
|
+
#
|
531
|
+
# @return [Array]
|
532
|
+
#
|
533
|
+
def audit_store_sitemap
|
534
|
+
@override_sitemap && !@override_sitemap.empty? ? @override_sitemap : @sitemap
|
535
|
+
end
|
536
|
+
|
537
|
+
#
|
538
|
+
# Adds an object to the plugin store.
|
539
|
+
#
|
540
|
+
# Should only be called once, if an entry for a plugin already exists
|
541
|
+
# it will just return.
|
542
|
+
#
|
543
|
+
# @param [String] plugin plugin/owner name
|
544
|
+
# @param [Object] obj object to store
|
545
|
+
#
|
546
|
+
def plugin_store( plugin, obj )
|
547
|
+
name = ''
|
548
|
+
@plugins.each_pair {
|
549
|
+
|k, v|
|
550
|
+
|
551
|
+
if plugin.class.name == v.name
|
552
|
+
name = k
|
553
|
+
break
|
554
|
+
end
|
555
|
+
}
|
556
|
+
|
557
|
+
return if @plugin_store[name]
|
558
|
+
|
559
|
+
@plugin_store[name] = {
|
560
|
+
:results => obj
|
561
|
+
}.merge( plugin.class.info )
|
562
|
+
end
|
563
|
+
|
564
|
+
#
|
565
|
+
# Returns an array of hashes with information
|
566
|
+
# about all available modules
|
567
|
+
#
|
568
|
+
# @return [Array<Hash>]
|
569
|
+
#
|
570
|
+
def lsmod
|
571
|
+
@modules.available.map {
|
572
|
+
|name|
|
573
|
+
|
574
|
+
path = @modules.name_to_path( name )
|
575
|
+
next if !lsmod_match?( path )
|
576
|
+
|
577
|
+
@modules[name].info.merge(
|
578
|
+
:mod_name => name,
|
579
|
+
:author => [@modules[name].info[:author]].flatten.map { |a| a.strip },
|
580
|
+
:path => path.strip
|
581
|
+
)
|
582
|
+
}.compact
|
583
|
+
ensure
|
584
|
+
@modules.clear
|
585
|
+
end
|
586
|
+
|
587
|
+
#
|
588
|
+
# Returns an array of hashes with information
|
589
|
+
# about all available reports
|
590
|
+
#
|
591
|
+
# @return [Array<Hash>]
|
592
|
+
#
|
593
|
+
def lsrep
|
594
|
+
@reports.available.map {
|
595
|
+
|report|
|
596
|
+
|
597
|
+
path = @reports.name_to_path( report )
|
598
|
+
next if !lsrep_match?( path )
|
599
|
+
|
600
|
+
@reports[report].info.merge(
|
601
|
+
:rep_name => report,
|
602
|
+
:path => path,
|
603
|
+
:author => [@reports[report].info[:author]].flatten.map { |a| a.strip }
|
604
|
+
)
|
605
|
+
}.compact
|
606
|
+
ensure
|
607
|
+
@reports.clear
|
608
|
+
end
|
609
|
+
|
610
|
+
#
|
611
|
+
# Returns an array of hashes with information
|
612
|
+
# about all available reports
|
613
|
+
#
|
614
|
+
# @return [Array<Hash>]
|
615
|
+
#
|
616
|
+
def lsplug
|
617
|
+
@plugins.available.map {
|
618
|
+
|plugin|
|
619
|
+
|
620
|
+
path = @plugins.name_to_path( plugin )
|
621
|
+
next if !lsplug_match?( path )
|
622
|
+
|
623
|
+
@plugins[plugin].info.merge(
|
624
|
+
:plug_name => plugin,
|
625
|
+
:path => path,
|
626
|
+
:author => [@plugins[plugin].info[:author]].flatten.map { |a| a.strip }
|
627
|
+
)
|
628
|
+
}.compact
|
629
|
+
ensure
|
630
|
+
@plugins.clear
|
631
|
+
end
|
632
|
+
|
633
|
+
#
|
634
|
+
# @return [Bool] true if the framework is running
|
635
|
+
#
|
636
|
+
def running?
|
637
|
+
@running
|
638
|
+
end
|
639
|
+
|
640
|
+
#
|
641
|
+
# @return [Bool] true if the framework is paused or in the process of
|
642
|
+
#
|
643
|
+
def paused?
|
644
|
+
!@paused.empty?
|
645
|
+
end
|
646
|
+
|
647
|
+
#
|
648
|
+
# @return [True] pauses the framework on a best effort basis,
|
649
|
+
# might take a while to take effect
|
650
|
+
#
|
651
|
+
def pause!
|
652
|
+
@spider.pause! if @spider
|
653
|
+
@paused << caller
|
654
|
+
return true
|
655
|
+
end
|
656
|
+
|
657
|
+
#
|
658
|
+
# @return [True] resumes the scan/audit
|
659
|
+
#
|
660
|
+
def resume!
|
661
|
+
@paused.delete( caller )
|
662
|
+
@spider.resume! if @spider
|
663
|
+
return true
|
664
|
+
end
|
665
|
+
|
666
|
+
#
|
667
|
+
# Returns the version of the framework
|
668
|
+
#
|
669
|
+
# @return [String]
|
670
|
+
#
|
671
|
+
def version
|
672
|
+
Arachni::VERSION
|
673
|
+
end
|
674
|
+
|
675
|
+
#
|
676
|
+
# Returns the revision of the {Framework} (this) class
|
677
|
+
#
|
678
|
+
# @return [String]
|
679
|
+
#
|
680
|
+
def revision
|
681
|
+
REVISION
|
682
|
+
end
|
683
|
+
|
684
|
+
#
|
685
|
+
# Cleans up the framework; should be called after running the audit or
|
686
|
+
# after canceling a running scan.
|
687
|
+
#
|
688
|
+
# It stops the clock, waits for the plugins to finish up, register
|
689
|
+
# their results and also refreshes the auditstore.
|
690
|
+
#
|
691
|
+
# It also runs {#audit_queue} in case any new pages have been added by the plugins.
|
692
|
+
#
|
693
|
+
# @param [Bool] skip_audit_queue skips running {#audit_queue},
|
694
|
+
# set to true if you don't want any delays.
|
695
|
+
#
|
696
|
+
# @return [True]
|
697
|
+
#
|
698
|
+
def clean_up!( skip_audit_queue = false )
|
699
|
+
@opts.finish_datetime = Time.now
|
700
|
+
@opts.delta_time = @opts.finish_datetime - @opts.start_datetime
|
701
|
+
|
702
|
+
# make sure this is disabled or it'll break report output
|
703
|
+
@@only_positives = false
|
704
|
+
|
705
|
+
@running = false
|
706
|
+
|
707
|
+
# wait for the plugins to finish
|
708
|
+
@plugins.block!
|
709
|
+
|
710
|
+
# a plug-in may have updated the page queue, rock it!
|
711
|
+
audit_queue if !skip_audit_queue
|
712
|
+
|
713
|
+
# refresh the audit store
|
714
|
+
audit_store( true )
|
715
|
+
|
716
|
+
return true
|
717
|
+
end
|
718
|
+
|
719
|
+
private
|
720
|
+
|
721
|
+
def caller
|
722
|
+
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ ::Kernel.caller[1]
|
723
|
+
return Regexp.last_match[1]
|
724
|
+
end
|
725
|
+
end
|
726
|
+
|
727
|
+
def wait_if_paused
|
728
|
+
while( paused? )
|
729
|
+
::IO::select( nil, nil, nil, 1 )
|
730
|
+
end
|
731
|
+
end
|
732
|
+
|
733
|
+
|
734
|
+
#
|
735
|
+
# Prepares the user agent to be used throughout the system.
|
736
|
+
#
|
737
|
+
def prepare_user_agent
|
738
|
+
if( !@opts.user_agent )
|
739
|
+
@opts.user_agent = 'Arachni/' + version( )
|
740
|
+
end
|
741
|
+
|
742
|
+
if( @opts.authed_by )
|
743
|
+
authed_by = " (Scan authorized by: #{@opts.authed_by})"
|
744
|
+
@opts.user_agent += authed_by
|
745
|
+
end
|
746
|
+
|
747
|
+
end
|
748
|
+
|
749
|
+
def prepare_cookie_jar( )
|
750
|
+
return if !@opts.cookie_jar || !@opts.cookie_jar.is_a?( String )
|
751
|
+
|
752
|
+
# make sure that the provided cookie-jar file exists
|
753
|
+
if !File.exist?( @opts.cookie_jar )
|
754
|
+
raise( Arachni::Exceptions::NoCookieJar,
|
755
|
+
'Cookie-jar \'' + @opts.cookie_jar + '\' doesn\'t exist.' )
|
756
|
+
end
|
757
|
+
|
758
|
+
end
|
759
|
+
|
760
|
+
|
761
|
+
#
|
762
|
+
# Takes care of page audit and module execution
|
763
|
+
#
|
764
|
+
# It will audit one page at a time as discovered by the spider <br/>
|
765
|
+
# and recursively check for new elements that may have <br/>
|
766
|
+
# appeared during the audit.
|
767
|
+
#
|
768
|
+
# When no new elements appear the recursion will stop and a new page<br/>
|
769
|
+
# will be accepted.
|
770
|
+
#
|
771
|
+
# @see Page
|
772
|
+
#
|
773
|
+
# @param [Page] page
|
774
|
+
#
|
775
|
+
def run_mods( page )
|
776
|
+
return if !page
|
777
|
+
|
778
|
+
print_line
|
779
|
+
print_status( "Auditing: [HTTP: #{page.code}] " + page.url )
|
780
|
+
|
781
|
+
|
782
|
+
call_on_run_mods( page.deep_clone )
|
783
|
+
|
784
|
+
@current_url = page.url.to_s
|
785
|
+
|
786
|
+
@modules.values.each {
|
787
|
+
|mod|
|
788
|
+
wait_if_paused
|
789
|
+
run_mod( mod, page.deep_clone )
|
790
|
+
}
|
791
|
+
|
792
|
+
@auditmap << page.url
|
793
|
+
@sitemap |= @auditmap
|
794
|
+
@sitemap.uniq!
|
795
|
+
|
796
|
+
|
797
|
+
if( !@opts.http_harvest_last )
|
798
|
+
harvest_http_responses( )
|
799
|
+
end
|
800
|
+
|
801
|
+
end
|
802
|
+
|
803
|
+
def harvest_http_responses
|
804
|
+
|
805
|
+
print_status( 'Harvesting HTTP responses...' )
|
806
|
+
print_info( 'Depending on server responsiveness and network' +
|
807
|
+
' conditions this may take a while.' )
|
808
|
+
|
809
|
+
# grab updated pages
|
810
|
+
http.trainer.flush_pages.each {
|
811
|
+
|page|
|
812
|
+
push_to_page_queue( page )
|
813
|
+
}
|
814
|
+
|
815
|
+
# run all the queued HTTP requests and harvest the responses
|
816
|
+
http.run
|
817
|
+
|
818
|
+
http.trainer.flush_pages.each {
|
819
|
+
|page|
|
820
|
+
push_to_page_queue( page )
|
821
|
+
}
|
822
|
+
end
|
823
|
+
|
824
|
+
#
|
825
|
+
# Passes a page to the module and runs it.<br/>
|
826
|
+
# It also handles any exceptions thrown by the module at runtime.
|
827
|
+
#
|
828
|
+
# @see Page
|
829
|
+
#
|
830
|
+
# @param [Class] mod the module to run
|
831
|
+
# @param [Page] page
|
832
|
+
#
|
833
|
+
def run_mod( mod, page )
|
834
|
+
return if !run_mod?( mod, page )
|
835
|
+
|
836
|
+
begin
|
837
|
+
@modules.run_one( mod, page, self )
|
838
|
+
rescue SystemExit
|
839
|
+
raise
|
840
|
+
rescue Exception => e
|
841
|
+
print_error( 'Error in ' + mod.to_s + ': ' + e.to_s )
|
842
|
+
print_error_backtrace( e )
|
843
|
+
end
|
844
|
+
end
|
845
|
+
|
846
|
+
#
|
847
|
+
# Determines whether or not to run the module against the given page
|
848
|
+
# depending on which elements exist in the page, which elements the module
|
849
|
+
# is configured to audit and user options.
|
850
|
+
#
|
851
|
+
# @param [Class] mod the module to run
|
852
|
+
# @param [Page] page
|
853
|
+
#
|
854
|
+
# @return [Bool]
|
855
|
+
#
|
856
|
+
def run_mod?( mod, page )
|
857
|
+
return true if( !mod.info[:elements] || mod.info[:elements].empty? )
|
858
|
+
|
859
|
+
elems = {
|
860
|
+
Issue::Element::LINK => page.links && page.links.size > 0 && @opts.audit_links,
|
861
|
+
Issue::Element::FORM => page.forms && page.forms.size > 0 && @opts.audit_forms,
|
862
|
+
Issue::Element::COOKIE => page.cookies && page.cookies.size > 0 && @opts.audit_cookies,
|
863
|
+
Issue::Element::HEADER => page.headers && page.headers.size > 0 && @opts.audit_headers,
|
864
|
+
Issue::Element::BODY => true,
|
865
|
+
Issue::Element::PATH => true,
|
866
|
+
Issue::Element::SERVER => true,
|
867
|
+
}
|
868
|
+
|
869
|
+
elems.each_pair {
|
870
|
+
|elem, expr|
|
871
|
+
return true if mod.info[:elements].include?( elem ) && expr
|
872
|
+
}
|
873
|
+
|
874
|
+
return false
|
875
|
+
end
|
876
|
+
|
877
|
+
def lsrep_match?( path )
|
878
|
+
regexp_array_match( @opts.lsrep, path )
|
879
|
+
end
|
880
|
+
|
881
|
+
def lsmod_match?( path )
|
882
|
+
regexp_array_match( @opts.lsmod, path )
|
883
|
+
end
|
884
|
+
|
885
|
+
def lsplug_match?( path )
|
886
|
+
regexp_array_match( @opts.lsplug, path )
|
887
|
+
end
|
888
|
+
|
889
|
+
def regexp_array_match( regexps, str )
|
890
|
+
cnt = 0
|
891
|
+
regexps.each {
|
892
|
+
|filter|
|
893
|
+
cnt += 1 if str =~ filter
|
894
|
+
}
|
895
|
+
return true if cnt == regexps.size
|
896
|
+
end
|
897
|
+
|
898
|
+
end
|
899
|
+
end
|