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
|
@@ -8,6 +8,9 @@
|
|
8
8
|
|
9
9
|
=end
|
10
10
|
|
11
|
+
require 'digest/sha1'
|
12
|
+
require 'cgi'
|
13
|
+
|
11
14
|
module Arachni
|
12
15
|
module Module
|
13
16
|
|
@@ -20,20 +23,36 @@ module Module
|
|
20
23
|
# @author: Tasos "Zapotek" Laskos
|
21
24
|
# <tasos.laskos@gmail.com>
|
22
25
|
# <zapotek@segfault.gr>
|
23
|
-
# @version: 0.1.
|
26
|
+
# @version: 0.1.3
|
24
27
|
#
|
25
28
|
module Utilities
|
26
29
|
|
30
|
+
def uri_parser
|
31
|
+
@@uri_parser ||= URI::Parser.new
|
32
|
+
end
|
33
|
+
|
34
|
+
def uri_parse( url )
|
35
|
+
uri_parser.parse( url )
|
36
|
+
end
|
37
|
+
|
38
|
+
def uri_encode( *args )
|
39
|
+
uri_parser.escape( *args )
|
40
|
+
end
|
41
|
+
|
42
|
+
def uri_decode( *args )
|
43
|
+
uri_parser.unescape( *args )
|
44
|
+
end
|
45
|
+
|
27
46
|
#
|
28
47
|
# Decodes URLs to reverse multiple encodes and removes NULL characters
|
29
48
|
#
|
30
49
|
def url_sanitize( url )
|
31
50
|
|
32
|
-
while( url =~
|
33
|
-
url = (
|
51
|
+
while( url =~ /%[a-fA-F0-9]{2}/ )
|
52
|
+
url = ( uri_decode( url ).to_s.unpack( 'A*' )[0] )
|
34
53
|
end
|
35
54
|
|
36
|
-
return
|
55
|
+
return uri_encode( CGI.unescapeHTML( url ) )
|
37
56
|
end
|
38
57
|
|
39
58
|
#
|
@@ -45,7 +64,7 @@ module Utilities
|
|
45
64
|
#
|
46
65
|
def get_path( url )
|
47
66
|
|
48
|
-
uri =
|
67
|
+
uri = uri_parser.parse( uri_encode( url ) )
|
49
68
|
path = uri.path
|
50
69
|
|
51
70
|
if !File.extname( path ).empty?
|
@@ -61,15 +80,35 @@ module Utilities
|
|
61
80
|
end
|
62
81
|
|
63
82
|
def normalize_url( url )
|
83
|
+
|
84
|
+
# make sure we're working with the pure form of the URL
|
85
|
+
url = url_sanitize( url )
|
86
|
+
|
64
87
|
begin
|
65
|
-
|
66
|
-
rescue
|
88
|
+
normalized = uri_encode( uri_decode( url.to_s ) ).to_s.gsub( '[', '%5B' ).gsub( ']', '%5D' )
|
89
|
+
rescue Exception => e
|
90
|
+
# ap e
|
91
|
+
# ap e.backtrace
|
67
92
|
begin
|
68
|
-
|
69
|
-
rescue
|
70
|
-
|
93
|
+
normalized = uri_encode( uri_decode( url.to_s ) ).to_s
|
94
|
+
rescue Exception => e
|
95
|
+
# ap e
|
96
|
+
# ap e.backtrace
|
97
|
+
normalized = url
|
71
98
|
end
|
72
99
|
end
|
100
|
+
|
101
|
+
#
|
102
|
+
# prevent this: http://example.com#fragment
|
103
|
+
# from becoming this: http://example.com%23fragment
|
104
|
+
#
|
105
|
+
begin
|
106
|
+
normalized.gsub!( '%23', '#' )
|
107
|
+
rescue
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
return normalized
|
73
112
|
end
|
74
113
|
|
75
114
|
#
|
@@ -99,18 +138,30 @@ module Utilities
|
|
99
138
|
|
100
139
|
end
|
101
140
|
|
141
|
+
def hash_keys_to_str( hash )
|
142
|
+
nh = {}
|
143
|
+
hash.each_pair {
|
144
|
+
|k, v|
|
145
|
+
nh[k.to_s] = v
|
146
|
+
nh[k.to_s] = hash_keys_to_str( v ) if v.is_a? Hash
|
147
|
+
}
|
148
|
+
|
149
|
+
return nh
|
150
|
+
end
|
151
|
+
|
102
152
|
#
|
103
153
|
# Wraps the "block" in exception handling code and runs it.
|
104
154
|
#
|
105
155
|
# @param [Block]
|
106
156
|
#
|
107
|
-
def exception_jail( &block )
|
157
|
+
def exception_jail( raise_exception = true, &block )
|
108
158
|
begin
|
109
159
|
block.call
|
110
160
|
rescue Exception => e
|
111
|
-
|
112
|
-
|
113
|
-
|
161
|
+
err_name = !e.to_s.empty? ? e.to_s : e.class.name
|
162
|
+
print_error( err_name )
|
163
|
+
print_error_backtrace( e )
|
164
|
+
raise e if raise_exception
|
114
165
|
end
|
115
166
|
end
|
116
167
|
|
File without changes
|
@@ -0,0 +1,986 @@
|
|
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 'yaml'
|
12
|
+
YAML::ENGINE.yamler = 'syck'
|
13
|
+
|
14
|
+
require 'singleton'
|
15
|
+
require 'getoptlong'
|
16
|
+
|
17
|
+
module Arachni
|
18
|
+
|
19
|
+
#
|
20
|
+
# Options class.
|
21
|
+
#
|
22
|
+
# Implements the Singleton pattern and formally defines
|
23
|
+
# all of Arachni's runtime options.
|
24
|
+
#
|
25
|
+
# @author: Tasos "Zapotek" Laskos
|
26
|
+
# <tasos.laskos@gmail.com>
|
27
|
+
# <zapotek@segfault.gr>
|
28
|
+
# @version: 0.2
|
29
|
+
#
|
30
|
+
class Options
|
31
|
+
|
32
|
+
include Singleton
|
33
|
+
|
34
|
+
#
|
35
|
+
# The extension of the profile files.
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
PROFILE_EXT = '.afp'
|
40
|
+
|
41
|
+
#
|
42
|
+
# General purpose datastore.
|
43
|
+
#
|
44
|
+
# Since this class is a Singleton and is passed
|
45
|
+
# to pretty much everything it's a good candidate for message passing
|
46
|
+
# or obscure options that the user doesn't need to know.
|
47
|
+
#
|
48
|
+
# @return [Hash]
|
49
|
+
#
|
50
|
+
attr_reader :datastore
|
51
|
+
|
52
|
+
attr_accessor :grid_mode
|
53
|
+
|
54
|
+
#
|
55
|
+
# @return [String] the URL of a neighbouring Dispatcher
|
56
|
+
#
|
57
|
+
attr_accessor :neighbour
|
58
|
+
|
59
|
+
#
|
60
|
+
# @return [Float] cost of using the Dispatcher
|
61
|
+
#
|
62
|
+
attr_accessor :cost
|
63
|
+
|
64
|
+
#
|
65
|
+
# @return [String] a string identifying this bandwidth pipe
|
66
|
+
#
|
67
|
+
attr_accessor :pipe_id
|
68
|
+
|
69
|
+
#
|
70
|
+
# @return [Float] Dispatcher weight
|
71
|
+
#
|
72
|
+
attr_accessor :weight
|
73
|
+
|
74
|
+
#
|
75
|
+
# @return [String] Dispatcher nickname
|
76
|
+
#
|
77
|
+
attr_accessor :nickname
|
78
|
+
|
79
|
+
#
|
80
|
+
# Holds absolute paths for the directory structure of the framework
|
81
|
+
#
|
82
|
+
# @return [Hash]
|
83
|
+
#
|
84
|
+
attr_accessor :dir
|
85
|
+
|
86
|
+
#
|
87
|
+
# The URL to audit
|
88
|
+
#
|
89
|
+
# @return [String,URI]
|
90
|
+
#
|
91
|
+
attr_reader :url
|
92
|
+
|
93
|
+
#
|
94
|
+
# Show help?
|
95
|
+
#
|
96
|
+
# @return [Bool]
|
97
|
+
#
|
98
|
+
attr_accessor :help
|
99
|
+
|
100
|
+
#
|
101
|
+
# Output only positive results during the audit?
|
102
|
+
#
|
103
|
+
# @return [Bool]
|
104
|
+
#
|
105
|
+
attr_accessor :only_positives
|
106
|
+
|
107
|
+
#
|
108
|
+
# Be verbose?
|
109
|
+
#
|
110
|
+
# @return [Bool]
|
111
|
+
#
|
112
|
+
attr_accessor :arachni_verbose
|
113
|
+
|
114
|
+
#
|
115
|
+
# Output debugging messages?
|
116
|
+
#
|
117
|
+
# @return [Bool]
|
118
|
+
#
|
119
|
+
attr_accessor :debug
|
120
|
+
|
121
|
+
#
|
122
|
+
# Filters for redundant links
|
123
|
+
#
|
124
|
+
# @return [Array]
|
125
|
+
#
|
126
|
+
attr_accessor :redundant
|
127
|
+
|
128
|
+
#
|
129
|
+
# Should the crawler obery robots.txt files?
|
130
|
+
#
|
131
|
+
# @return [Bool]
|
132
|
+
#
|
133
|
+
attr_accessor :obey_robots_txt
|
134
|
+
|
135
|
+
#
|
136
|
+
# How deep to go in the site structure?<br/>
|
137
|
+
# If nil, depth_limit = inf
|
138
|
+
#
|
139
|
+
# @return [Integer]
|
140
|
+
#
|
141
|
+
attr_accessor :depth_limit
|
142
|
+
|
143
|
+
#
|
144
|
+
# How many links to follow?
|
145
|
+
# If -1, link_count_limit = inf
|
146
|
+
#
|
147
|
+
# @return [Integer]
|
148
|
+
#
|
149
|
+
attr_accessor :link_count_limit
|
150
|
+
|
151
|
+
#
|
152
|
+
# How many redirects to follow?
|
153
|
+
# If -1, redirect_limit = inf
|
154
|
+
#
|
155
|
+
# @return [Integer]
|
156
|
+
#
|
157
|
+
attr_accessor :redirect_limit
|
158
|
+
|
159
|
+
#
|
160
|
+
# List modules, based on regexps, and exit?
|
161
|
+
#
|
162
|
+
# @return [Array<Regexp>]
|
163
|
+
#
|
164
|
+
attr_accessor :lsmod
|
165
|
+
|
166
|
+
#
|
167
|
+
# List reports and exit?
|
168
|
+
#
|
169
|
+
# @return [Bool]
|
170
|
+
#
|
171
|
+
attr_accessor :lsrep
|
172
|
+
|
173
|
+
#
|
174
|
+
# How many concurrent HTTP requests?
|
175
|
+
#
|
176
|
+
# @return [Integer]
|
177
|
+
#
|
178
|
+
attr_accessor :http_req_limit
|
179
|
+
|
180
|
+
#
|
181
|
+
# Should Arachni audit links?
|
182
|
+
#
|
183
|
+
# @return [Bool]
|
184
|
+
#
|
185
|
+
attr_accessor :audit_links
|
186
|
+
|
187
|
+
#
|
188
|
+
# Should Arachni audit forms?
|
189
|
+
#
|
190
|
+
# @return [Bool]
|
191
|
+
#
|
192
|
+
attr_accessor :audit_forms
|
193
|
+
|
194
|
+
#
|
195
|
+
# Should Arachni audit cookies?
|
196
|
+
#
|
197
|
+
# @return [Bool]
|
198
|
+
#
|
199
|
+
attr_accessor :audit_cookies
|
200
|
+
|
201
|
+
#
|
202
|
+
# Should Arachni audit HTTP headers?
|
203
|
+
#
|
204
|
+
# @return [Bool]
|
205
|
+
#
|
206
|
+
attr_accessor :audit_headers
|
207
|
+
|
208
|
+
#
|
209
|
+
# Array of modules to load
|
210
|
+
#
|
211
|
+
# @return [Array]
|
212
|
+
#
|
213
|
+
attr_accessor :mods
|
214
|
+
|
215
|
+
#
|
216
|
+
# Array of reports to load
|
217
|
+
#
|
218
|
+
# @return [Array]
|
219
|
+
#
|
220
|
+
attr_accessor :reports
|
221
|
+
|
222
|
+
#
|
223
|
+
# Location of an Arachni Framework Report (.afr) file to load
|
224
|
+
#
|
225
|
+
# @return [String]
|
226
|
+
#
|
227
|
+
attr_accessor :repload
|
228
|
+
|
229
|
+
#
|
230
|
+
# Where to save the Arachni Framework Profile (.afp) file
|
231
|
+
#
|
232
|
+
# @return [String]
|
233
|
+
#
|
234
|
+
attr_accessor :save_profile
|
235
|
+
|
236
|
+
#
|
237
|
+
# Location of Arachni Framework Profile (.afp) files to load
|
238
|
+
#
|
239
|
+
# @return [Array]
|
240
|
+
#
|
241
|
+
attr_accessor :load_profile
|
242
|
+
|
243
|
+
|
244
|
+
attr_accessor :show_profile
|
245
|
+
|
246
|
+
#
|
247
|
+
# The person that authorized the scan<br/>
|
248
|
+
# It will be added to the HTTP "user-agent" and "from" headers.
|
249
|
+
#
|
250
|
+
# @return [String]
|
251
|
+
#
|
252
|
+
attr_accessor :authed_by
|
253
|
+
|
254
|
+
#
|
255
|
+
# The address of the proxy server
|
256
|
+
#
|
257
|
+
# @return [String]
|
258
|
+
#
|
259
|
+
attr_accessor :proxy_addr
|
260
|
+
|
261
|
+
#
|
262
|
+
# The port to connect on the proxy server
|
263
|
+
#
|
264
|
+
# @return [String]
|
265
|
+
#
|
266
|
+
attr_accessor :proxy_port
|
267
|
+
|
268
|
+
#
|
269
|
+
# The proxy password
|
270
|
+
#
|
271
|
+
# @return [String]
|
272
|
+
#
|
273
|
+
attr_accessor :proxy_pass
|
274
|
+
|
275
|
+
#
|
276
|
+
# The proxy user
|
277
|
+
#
|
278
|
+
# @return [String]
|
279
|
+
#
|
280
|
+
attr_accessor :proxy_user
|
281
|
+
|
282
|
+
#
|
283
|
+
# The proxy type
|
284
|
+
#
|
285
|
+
# @return [String] [http, socks]
|
286
|
+
#
|
287
|
+
attr_accessor :proxy_type
|
288
|
+
|
289
|
+
#
|
290
|
+
# To be populated by the framework
|
291
|
+
#
|
292
|
+
# Parsed cookiejar cookies
|
293
|
+
#
|
294
|
+
# @return [Hash] name=>value pairs
|
295
|
+
#
|
296
|
+
attr_accessor :cookies
|
297
|
+
|
298
|
+
#
|
299
|
+
# Location of the cookiejar
|
300
|
+
#
|
301
|
+
# @return [String]
|
302
|
+
#
|
303
|
+
attr_accessor :cookie_jar
|
304
|
+
|
305
|
+
#
|
306
|
+
# The HTTP user-agent to use
|
307
|
+
#
|
308
|
+
# @return [String]
|
309
|
+
#
|
310
|
+
attr_accessor :user_agent
|
311
|
+
|
312
|
+
#
|
313
|
+
# Exclude filters <br/>
|
314
|
+
# URL matching any of these patterns won't be followed
|
315
|
+
#
|
316
|
+
# @return [Array]
|
317
|
+
#
|
318
|
+
attr_accessor :exclude
|
319
|
+
|
320
|
+
#
|
321
|
+
# Cookies to exclude from audit<br/>
|
322
|
+
#
|
323
|
+
# @return [Array]
|
324
|
+
#
|
325
|
+
attr_accessor :exclude_cookies
|
326
|
+
|
327
|
+
#
|
328
|
+
# Include filters <br/>
|
329
|
+
# Only URLs that match any of these patterns will be followed
|
330
|
+
#
|
331
|
+
# @return [Array]
|
332
|
+
#
|
333
|
+
attr_accessor :include
|
334
|
+
|
335
|
+
#
|
336
|
+
# Should the crawler follow subdomains?
|
337
|
+
#
|
338
|
+
# @return [Bool]
|
339
|
+
#
|
340
|
+
attr_accessor :follow_subdomains
|
341
|
+
|
342
|
+
#
|
343
|
+
# Harvest the HTTP responses for the whole site at the end or
|
344
|
+
# for each page?
|
345
|
+
#
|
346
|
+
# @return [Bool]
|
347
|
+
#
|
348
|
+
attr_accessor :http_harvest_last
|
349
|
+
|
350
|
+
# to be populated by the framework
|
351
|
+
attr_accessor :start_datetime
|
352
|
+
# to be populated by the framework
|
353
|
+
attr_accessor :finish_datetime
|
354
|
+
# to be populated by the framework
|
355
|
+
attr_accessor :delta_time
|
356
|
+
|
357
|
+
attr_accessor :lsplug
|
358
|
+
attr_accessor :plugins
|
359
|
+
|
360
|
+
attr_accessor :rpc_port
|
361
|
+
attr_accessor :rpc_address
|
362
|
+
|
363
|
+
attr_accessor :rpc_instance_port_range
|
364
|
+
|
365
|
+
attr_accessor :ssl
|
366
|
+
attr_accessor :ssl_pkey
|
367
|
+
attr_accessor :ssl_cert
|
368
|
+
attr_accessor :ssl_ca
|
369
|
+
|
370
|
+
attr_accessor :node_ssl_pkey
|
371
|
+
attr_accessor :node_ssl_cert
|
372
|
+
|
373
|
+
attr_accessor :server
|
374
|
+
|
375
|
+
attr_accessor :reroute_to_logfile
|
376
|
+
attr_accessor :pool_size
|
377
|
+
|
378
|
+
attr_accessor :webui_username
|
379
|
+
attr_accessor :webui_password
|
380
|
+
|
381
|
+
attr_accessor :custom_headers
|
382
|
+
|
383
|
+
attr_accessor :restrict_paths
|
384
|
+
attr_accessor :restrict_paths_filepath
|
385
|
+
|
386
|
+
attr_accessor :extend_paths
|
387
|
+
attr_accessor :extend_paths_filepath
|
388
|
+
|
389
|
+
attr_accessor :min_pages_per_instance
|
390
|
+
attr_accessor :max_slaves
|
391
|
+
|
392
|
+
|
393
|
+
def initialize
|
394
|
+
reset!
|
395
|
+
end
|
396
|
+
|
397
|
+
def reset!
|
398
|
+
# nil everything out
|
399
|
+
self.instance_variables.each {
|
400
|
+
|var|
|
401
|
+
instance_variable_set( var.to_s, nil )
|
402
|
+
}
|
403
|
+
|
404
|
+
@dir = {}
|
405
|
+
@dir['root'] = root_path
|
406
|
+
@dir['gfx'] = @dir['root'] + 'gfx/'
|
407
|
+
@dir['conf'] = @dir['root'] + 'conf/'
|
408
|
+
@dir['logs'] = @dir['root'] + 'logs/'
|
409
|
+
@dir['data'] = @dir['root'] + 'data/'
|
410
|
+
@dir['modules'] = @dir['root'] + 'modules/'
|
411
|
+
@dir['reports'] = @dir['root'] + 'reports/'
|
412
|
+
@dir['plugins'] = @dir['root'] + 'plugins/'
|
413
|
+
@dir['path_extractors'] = @dir['root'] + 'path_extractors/'
|
414
|
+
@dir['lib'] = @dir['root'] + 'lib/arachni/'
|
415
|
+
@dir['mixins'] = @dir['lib'] + 'mixins/'
|
416
|
+
@dir['arachni'] = @dir['lib'][0...-1]
|
417
|
+
|
418
|
+
# we must add default values for everything because that can serve
|
419
|
+
# both as a default configuration and as an inexpensive way to declare
|
420
|
+
# their data types for later verification
|
421
|
+
|
422
|
+
@datastore = {}
|
423
|
+
@redundant = []
|
424
|
+
|
425
|
+
@obey_robots_txt = false
|
426
|
+
|
427
|
+
@depth_limit = -1
|
428
|
+
@link_count_limit = -1
|
429
|
+
@redirect_limit = 20
|
430
|
+
|
431
|
+
@lsmod = []
|
432
|
+
@lsrep = []
|
433
|
+
|
434
|
+
@http_req_limit = 20
|
435
|
+
|
436
|
+
@mods = []
|
437
|
+
|
438
|
+
@reports = {}
|
439
|
+
|
440
|
+
@exclude = []
|
441
|
+
@exclude_cookies = []
|
442
|
+
|
443
|
+
@include = []
|
444
|
+
|
445
|
+
@lsplug = []
|
446
|
+
@plugins = {}
|
447
|
+
|
448
|
+
@rpc_instance_port_range = [1025, 65535]
|
449
|
+
|
450
|
+
@exclude_cookies = []
|
451
|
+
@load_profile = []
|
452
|
+
@restrict_paths = []
|
453
|
+
@extend_paths = []
|
454
|
+
@custom_headers = {}
|
455
|
+
|
456
|
+
@min_pages_per_instance = 30
|
457
|
+
@max_slaves = 10
|
458
|
+
end
|
459
|
+
|
460
|
+
def parse!
|
461
|
+
|
462
|
+
# Construct getops struct
|
463
|
+
opts = GetoptLong.new(
|
464
|
+
[ '--help', '-h', GetoptLong::NO_ARGUMENT ],
|
465
|
+
[ '--verbosity', '-v', GetoptLong::NO_ARGUMENT ],
|
466
|
+
[ '--only-positives', '-k', GetoptLong::NO_ARGUMENT ],
|
467
|
+
[ '--lsmod', GetoptLong::OPTIONAL_ARGUMENT ],
|
468
|
+
[ '--lsrep', GetoptLong::OPTIONAL_ARGUMENT ],
|
469
|
+
[ '--audit-links', '-g', GetoptLong::NO_ARGUMENT ],
|
470
|
+
[ '--audit-forms', '-p', GetoptLong::NO_ARGUMENT ],
|
471
|
+
[ '--audit-cookies', '-c', GetoptLong::NO_ARGUMENT ],
|
472
|
+
[ '--audit-cookie-jar', GetoptLong::NO_ARGUMENT ],
|
473
|
+
[ '--audit-headers', GetoptLong::NO_ARGUMENT ],
|
474
|
+
[ '--spider-first', GetoptLong::NO_ARGUMENT ],
|
475
|
+
[ '--obey-robots-txt', '-o', GetoptLong::NO_ARGUMENT ],
|
476
|
+
[ '--redundant', GetoptLong::REQUIRED_ARGUMENT ],
|
477
|
+
[ '--depth', '-d', GetoptLong::REQUIRED_ARGUMENT ],
|
478
|
+
[ '--redirect-limit', '-q', GetoptLong::REQUIRED_ARGUMENT ],
|
479
|
+
[ '--link-count', '-u', GetoptLong::REQUIRED_ARGUMENT ],
|
480
|
+
[ '--mods', '-m', GetoptLong::REQUIRED_ARGUMENT ],
|
481
|
+
[ '--report', GetoptLong::REQUIRED_ARGUMENT ],
|
482
|
+
[ '--repload', GetoptLong::REQUIRED_ARGUMENT ],
|
483
|
+
[ '--authed-by', GetoptLong::REQUIRED_ARGUMENT ],
|
484
|
+
[ '--load-profile', GetoptLong::REQUIRED_ARGUMENT ],
|
485
|
+
[ '--save-profile', GetoptLong::REQUIRED_ARGUMENT ],
|
486
|
+
[ '--show-profile', GetoptLong::NO_ARGUMENT ],
|
487
|
+
[ '--proxy', '-z', GetoptLong::REQUIRED_ARGUMENT ],
|
488
|
+
[ '--proxy-auth', '-x', GetoptLong::REQUIRED_ARGUMENT ],
|
489
|
+
[ '--proxy-type', '-y', GetoptLong::REQUIRED_ARGUMENT ],
|
490
|
+
[ '--cookie-jar', '-j', GetoptLong::REQUIRED_ARGUMENT ],
|
491
|
+
[ '--user-agent', '-b', GetoptLong::REQUIRED_ARGUMENT ],
|
492
|
+
[ '--exclude', '-e', GetoptLong::REQUIRED_ARGUMENT ],
|
493
|
+
[ '--include', '-i', GetoptLong::REQUIRED_ARGUMENT ],
|
494
|
+
[ '--exclude-cookie', GetoptLong::REQUIRED_ARGUMENT ],
|
495
|
+
[ '--http-req-limit', GetoptLong::REQUIRED_ARGUMENT ],
|
496
|
+
[ '--follow-subdomains', '-f', GetoptLong::NO_ARGUMENT ],
|
497
|
+
[ '--http-harvest-last', '-s', GetoptLong::NO_ARGUMENT ],
|
498
|
+
[ '--debug', '-w', GetoptLong::NO_ARGUMENT ],
|
499
|
+
[ '--server', GetoptLong::REQUIRED_ARGUMENT ],
|
500
|
+
[ '--plugin', GetoptLong::OPTIONAL_ARGUMENT ],
|
501
|
+
[ '--lsplug', GetoptLong::OPTIONAL_ARGUMENT ],
|
502
|
+
[ '--ssl', GetoptLong::NO_ARGUMENT ],
|
503
|
+
[ '--ssl-pkey', GetoptLong::REQUIRED_ARGUMENT ],
|
504
|
+
[ '--ssl-cert', GetoptLong::REQUIRED_ARGUMENT ],
|
505
|
+
[ '--node-ssl-pkey', GetoptLong::REQUIRED_ARGUMENT ],
|
506
|
+
[ '--node-ssl-cert', GetoptLong::REQUIRED_ARGUMENT ],
|
507
|
+
[ '--ssl-ca', GetoptLong::REQUIRED_ARGUMENT ],
|
508
|
+
[ '--address', GetoptLong::REQUIRED_ARGUMENT ],
|
509
|
+
[ '--reroute-to-logfile', GetoptLong::NO_ARGUMENT ],
|
510
|
+
[ '--pool-size', GetoptLong::REQUIRED_ARGUMENT ],
|
511
|
+
[ '--neighbour', GetoptLong::REQUIRED_ARGUMENT ],
|
512
|
+
[ '--weight', GetoptLong::REQUIRED_ARGUMENT ],
|
513
|
+
[ '--cost', GetoptLong::REQUIRED_ARGUMENT ],
|
514
|
+
[ '--pipe-id', GetoptLong::REQUIRED_ARGUMENT ],
|
515
|
+
[ '--nickname', GetoptLong::REQUIRED_ARGUMENT ],
|
516
|
+
[ '--username', GetoptLong::REQUIRED_ARGUMENT ],
|
517
|
+
[ '--password', GetoptLong::REQUIRED_ARGUMENT ],
|
518
|
+
[ '--port', GetoptLong::REQUIRED_ARGUMENT ],
|
519
|
+
[ '--host', GetoptLong::REQUIRED_ARGUMENT ],
|
520
|
+
[ '--custom-header', GetoptLong::REQUIRED_ARGUMENT ],
|
521
|
+
[ '--restrict-paths', GetoptLong::REQUIRED_ARGUMENT ],
|
522
|
+
[ '--extend-paths', GetoptLong::REQUIRED_ARGUMENT ],
|
523
|
+
[ '--port-range', GetoptLong::REQUIRED_ARGUMENT ]
|
524
|
+
)
|
525
|
+
|
526
|
+
opts.quiet = true
|
527
|
+
|
528
|
+
begin
|
529
|
+
opts.each {
|
530
|
+
|opt, arg|
|
531
|
+
|
532
|
+
case opt
|
533
|
+
|
534
|
+
when '--help'
|
535
|
+
@help = true
|
536
|
+
|
537
|
+
when '--only-positives'
|
538
|
+
@only_positives = true
|
539
|
+
|
540
|
+
when '--verbosity'
|
541
|
+
@arachni_verbose = true
|
542
|
+
|
543
|
+
when '--debug'
|
544
|
+
@debug = true
|
545
|
+
|
546
|
+
when '--plugin'
|
547
|
+
plugin, opt_str = arg.split( ':', 2 )
|
548
|
+
|
549
|
+
opts = {}
|
550
|
+
if( opt_str )
|
551
|
+
opt_arr = opt_str.split( ',' )
|
552
|
+
opt_arr.each {
|
553
|
+
|c_opt|
|
554
|
+
name, val = c_opt.split( '=', 2 )
|
555
|
+
opts[name] = val
|
556
|
+
}
|
557
|
+
end
|
558
|
+
|
559
|
+
@plugins[plugin] = opts
|
560
|
+
|
561
|
+
when '--redundant'
|
562
|
+
@redundant << {
|
563
|
+
'regexp' => Regexp.new( arg.to_s.split( /:/ )[0] ),
|
564
|
+
'count' => Integer( arg.to_s.split( /:/ )[1] ),
|
565
|
+
}
|
566
|
+
|
567
|
+
when '--port-range'
|
568
|
+
first, last = arg.to_s.split( '-' )
|
569
|
+
@rpc_instance_port_range = [ Integer( first ), Integer( last ) ]
|
570
|
+
|
571
|
+
when '--custom-header'
|
572
|
+
header, val = arg.to_s.split( /=/, 2 )
|
573
|
+
@custom_headers[header] = val
|
574
|
+
|
575
|
+
when '--restrict-paths'
|
576
|
+
@restrict_paths |= paths_from_file( arg )
|
577
|
+
@restrict_paths_filepath = arg
|
578
|
+
|
579
|
+
when '--extend-paths'
|
580
|
+
@extend_paths |= paths_from_file( arg )
|
581
|
+
@extend_paths_filepath = arg
|
582
|
+
|
583
|
+
when '--obey_robots_txt'
|
584
|
+
@obey_robots_txt = true
|
585
|
+
|
586
|
+
when '--depth'
|
587
|
+
@depth_limit = arg.to_i
|
588
|
+
|
589
|
+
when '--link-count'
|
590
|
+
@link_count_limit = arg.to_i
|
591
|
+
|
592
|
+
when '--redirect-limit'
|
593
|
+
@redirect_limit = arg.to_i
|
594
|
+
|
595
|
+
when '--lsmod'
|
596
|
+
@lsmod << Regexp.new( arg.to_s )
|
597
|
+
|
598
|
+
when '--lsplug'
|
599
|
+
@lsplug << Regexp.new( arg.to_s )
|
600
|
+
|
601
|
+
when '--lsrep'
|
602
|
+
@lsrep << Regexp.new( arg.to_s )
|
603
|
+
|
604
|
+
when '--http-req-limit'
|
605
|
+
@http_req_limit = arg.to_i
|
606
|
+
|
607
|
+
when '--audit-links'
|
608
|
+
@audit_links = true
|
609
|
+
|
610
|
+
when '--audit-forms'
|
611
|
+
@audit_forms = true
|
612
|
+
|
613
|
+
when '--audit-cookies'
|
614
|
+
@audit_cookies = true
|
615
|
+
|
616
|
+
when '--audit-cookie-jar'
|
617
|
+
@audit_cookie_jar = true
|
618
|
+
|
619
|
+
when '--audit-headers'
|
620
|
+
@audit_headers = true
|
621
|
+
|
622
|
+
when '--mods'
|
623
|
+
@mods = arg.to_s.split( /,/ )
|
624
|
+
|
625
|
+
when '--report'
|
626
|
+
report, opt_str = arg.split( ':' )
|
627
|
+
|
628
|
+
opts = {}
|
629
|
+
if( opt_str )
|
630
|
+
opt_arr = opt_str.split( ',' )
|
631
|
+
opt_arr.each {
|
632
|
+
|c_opt|
|
633
|
+
name, val = c_opt.split( '=' )
|
634
|
+
opts[name] = val
|
635
|
+
}
|
636
|
+
end
|
637
|
+
|
638
|
+
@reports[report] = opts
|
639
|
+
|
640
|
+
when '--repload'
|
641
|
+
@repload = arg
|
642
|
+
|
643
|
+
when '--save-profile'
|
644
|
+
@save_profile = arg
|
645
|
+
|
646
|
+
when '--load-profile'
|
647
|
+
@load_profile << arg
|
648
|
+
|
649
|
+
when '--show-profile'
|
650
|
+
@show_profile = true
|
651
|
+
|
652
|
+
when '--authed-by'
|
653
|
+
@authed_by = arg
|
654
|
+
|
655
|
+
when '--proxy'
|
656
|
+
@proxy_addr, @proxy_port =
|
657
|
+
arg.to_s.split( /:/ )
|
658
|
+
|
659
|
+
when '--proxy-auth'
|
660
|
+
@proxy_user, @proxy_pass =
|
661
|
+
arg.to_s.split( /:/ )
|
662
|
+
|
663
|
+
when '--proxy-type'
|
664
|
+
@proxy_type = arg.to_s
|
665
|
+
|
666
|
+
when '--cookie-jar'
|
667
|
+
@cookie_jar = arg.to_s
|
668
|
+
|
669
|
+
when '--user-agent'
|
670
|
+
@user_agent = arg.to_s
|
671
|
+
|
672
|
+
when '--exclude'
|
673
|
+
@exclude << Regexp.new( arg )
|
674
|
+
|
675
|
+
when '--include'
|
676
|
+
@include << Regexp.new( arg )
|
677
|
+
|
678
|
+
when '--exclude-cookie'
|
679
|
+
@exclude_cookies << arg
|
680
|
+
|
681
|
+
when '--follow-subdomains'
|
682
|
+
@follow_subdomains = true
|
683
|
+
|
684
|
+
when '--http-harvest-last'
|
685
|
+
@http_harvest_last = true
|
686
|
+
|
687
|
+
when '--ssl'
|
688
|
+
@ssl = true
|
689
|
+
|
690
|
+
when '--ssl-pkey'
|
691
|
+
@ssl_pkey = arg.to_s
|
692
|
+
|
693
|
+
when '--ssl-cert'
|
694
|
+
@ssl_cert = arg.to_s
|
695
|
+
|
696
|
+
when '--ssl-ca'
|
697
|
+
@ssl_ca = arg.to_s
|
698
|
+
|
699
|
+
when '--server'
|
700
|
+
@server = arg.to_s
|
701
|
+
|
702
|
+
when '--reroute-to-logfile'
|
703
|
+
@reroute_to_logfile = true
|
704
|
+
|
705
|
+
when '--port'
|
706
|
+
@rpc_port = arg.to_i
|
707
|
+
|
708
|
+
when '--address'
|
709
|
+
@rpc_address = arg.to_s
|
710
|
+
|
711
|
+
when '--pool-size'
|
712
|
+
@pool_size = arg.to_i
|
713
|
+
|
714
|
+
when '--neighbour'
|
715
|
+
@neighbour = arg.to_s
|
716
|
+
|
717
|
+
when '--cost'
|
718
|
+
@cost = arg.to_s
|
719
|
+
|
720
|
+
when '--weight'
|
721
|
+
@weight = arg.to_s
|
722
|
+
|
723
|
+
when '--pipe-id'
|
724
|
+
@pipe_id = arg.to_s
|
725
|
+
|
726
|
+
when '--nickname'
|
727
|
+
@nickname = arg.to_s
|
728
|
+
|
729
|
+
when '--host'
|
730
|
+
@server = arg.to_s
|
731
|
+
|
732
|
+
when '--username'
|
733
|
+
@webui_username = arg.to_s
|
734
|
+
|
735
|
+
when '--password'
|
736
|
+
@webui_password = arg.to_s
|
737
|
+
|
738
|
+
end
|
739
|
+
}
|
740
|
+
rescue Exception => e
|
741
|
+
puts e.inspect
|
742
|
+
exit
|
743
|
+
end
|
744
|
+
|
745
|
+
self.url = ARGV.shift
|
746
|
+
end
|
747
|
+
|
748
|
+
def root_path
|
749
|
+
File.dirname( File.dirname( File.dirname( File.expand_path( File.expand_path( __FILE__ ) ) ) ) ) + '/'
|
750
|
+
end
|
751
|
+
|
752
|
+
#
|
753
|
+
# Saves 'self' to file
|
754
|
+
#
|
755
|
+
# @param [String] file
|
756
|
+
#
|
757
|
+
def save( file )
|
758
|
+
|
759
|
+
dir = @dir.clone
|
760
|
+
load_profile = @load_profile.clone if @load_profile
|
761
|
+
save_profile = @save_profile.clone if @save_profile
|
762
|
+
authed_by = @authed_by.clone if @authed_by
|
763
|
+
|
764
|
+
restrict_paths = @restrict_paths.clone if @restrict_paths
|
765
|
+
extend_paths = @extend_paths.clone if @extend_paths
|
766
|
+
|
767
|
+
@dir = nil
|
768
|
+
@load_profile = nil
|
769
|
+
@save_profile = nil
|
770
|
+
@authed_by = nil
|
771
|
+
@restrict_paths = nil
|
772
|
+
@extend_paths = nil
|
773
|
+
|
774
|
+
|
775
|
+
begin
|
776
|
+
f = File.open( file, 'w' )
|
777
|
+
YAML.dump( self, f )
|
778
|
+
rescue
|
779
|
+
return
|
780
|
+
ensure
|
781
|
+
f.close
|
782
|
+
|
783
|
+
@dir = dir
|
784
|
+
@load_profile = load_profile
|
785
|
+
@save_profile = save_profile
|
786
|
+
@authed_by = authed_by
|
787
|
+
|
788
|
+
@restrict_paths = restrict_paths
|
789
|
+
@extend_paths = extend_paths
|
790
|
+
end
|
791
|
+
|
792
|
+
return f.path
|
793
|
+
end
|
794
|
+
|
795
|
+
def load( filename )
|
796
|
+
opts = YAML::load( IO.read( filename ) )
|
797
|
+
|
798
|
+
if opts.restrict_paths_filepath
|
799
|
+
opts.restrict_paths = paths_from_file( opts.restrict_paths_filepath )
|
800
|
+
end
|
801
|
+
|
802
|
+
if opts.extend_paths_filepath
|
803
|
+
opts.extend_paths = paths_from_file( opts.extend_paths_filepath )
|
804
|
+
end
|
805
|
+
|
806
|
+
return opts
|
807
|
+
end
|
808
|
+
|
809
|
+
def url=( str )
|
810
|
+
return if !str
|
811
|
+
|
812
|
+
require 'uri'
|
813
|
+
require @dir['lib'] + 'exceptions'
|
814
|
+
require @dir['lib'] + 'module/utilities'
|
815
|
+
|
816
|
+
begin
|
817
|
+
@url = URI( Arachni::Module::Utilities.normalize_url( str.to_s ) )
|
818
|
+
rescue Exception => e
|
819
|
+
# ap e
|
820
|
+
# ap e.backtrace
|
821
|
+
raise( Arachni::Exceptions::InvalidURL, "Invalid URL argument." )
|
822
|
+
end
|
823
|
+
|
824
|
+
return str
|
825
|
+
end
|
826
|
+
|
827
|
+
def restrict_paths=( urls )
|
828
|
+
@restrict_paths = [urls].flatten
|
829
|
+
end
|
830
|
+
|
831
|
+
#
|
832
|
+
# Converts the Options object to hash
|
833
|
+
#
|
834
|
+
# @return [Hash]
|
835
|
+
#
|
836
|
+
def to_h
|
837
|
+
hash = Hash.new
|
838
|
+
self.instance_variables.each {
|
839
|
+
|var|
|
840
|
+
hash[normalize_name( var )] = self.instance_variable_get( var )
|
841
|
+
}
|
842
|
+
hash
|
843
|
+
end
|
844
|
+
|
845
|
+
#
|
846
|
+
# Merges self with the object in 'options'
|
847
|
+
#
|
848
|
+
# @param [Options]
|
849
|
+
#
|
850
|
+
def merge!( options )
|
851
|
+
options.to_h.each_pair {
|
852
|
+
|k, v|
|
853
|
+
|
854
|
+
next if ( v.is_a?( Array ) || v.is_a?( Hash ) ) && v.empty?
|
855
|
+
send( "#{k}=", v ) if v
|
856
|
+
}
|
857
|
+
end
|
858
|
+
|
859
|
+
def to_args
|
860
|
+
|
861
|
+
cli_args = ''
|
862
|
+
|
863
|
+
self.to_h.keys.each {
|
864
|
+
|key|
|
865
|
+
|
866
|
+
arg = self.to_arg( key )
|
867
|
+
|
868
|
+
cli_args += " #{arg.to_s}" if arg
|
869
|
+
}
|
870
|
+
|
871
|
+
return cli_args += " #{self.url}"
|
872
|
+
end
|
873
|
+
|
874
|
+
def to_arg( key )
|
875
|
+
|
876
|
+
do_not_parse = [
|
877
|
+
'show_profile',
|
878
|
+
'url',
|
879
|
+
'dir',
|
880
|
+
]
|
881
|
+
|
882
|
+
var = self.instance_variable_get( "@#{key}" )
|
883
|
+
|
884
|
+
return if !var
|
885
|
+
return if ( var.is_a?( Array ) || var.is_a?( Hash ) ) && var.empty?
|
886
|
+
return if do_not_parse.include?( key )
|
887
|
+
return if key == 'include' && var == [/.*/]
|
888
|
+
return if key == 'reports' && var.keys == ['stdout']
|
889
|
+
|
890
|
+
key = 'exclude_cookie' if key == 'exclude_cookies'
|
891
|
+
key = 'report' if key == 'reports'
|
892
|
+
|
893
|
+
key = key.gsub( '_', '-' )
|
894
|
+
|
895
|
+
arg = ''
|
896
|
+
|
897
|
+
case key
|
898
|
+
|
899
|
+
when 'mods'
|
900
|
+
var = var.join( ',' )
|
901
|
+
|
902
|
+
when 'restrict-paths'
|
903
|
+
var = @restrict_paths_filepath
|
904
|
+
|
905
|
+
when 'extend-paths'
|
906
|
+
var = @extend_paths_filepath
|
907
|
+
|
908
|
+
when 'rpc-instance-port-range'
|
909
|
+
var = var.join( '-' )
|
910
|
+
|
911
|
+
when 'arachni-verbose'
|
912
|
+
key = 'verbosity'
|
913
|
+
|
914
|
+
when 'redundant'
|
915
|
+
var.each {
|
916
|
+
|rule|
|
917
|
+
arg += " --#{key}=#{rule['regexp'].source}:#{rule['count']}"
|
918
|
+
}
|
919
|
+
return arg
|
920
|
+
|
921
|
+
when 'plugins','report'
|
922
|
+
arg = ''
|
923
|
+
var.each {
|
924
|
+
|opt, val|
|
925
|
+
arg += " --#{key.chomp( 's' )}=#{opt}"
|
926
|
+
arg += ':' if !val.empty?
|
927
|
+
|
928
|
+
val.each {
|
929
|
+
|k, v|
|
930
|
+
arg += "#{k}=#{v},"
|
931
|
+
}
|
932
|
+
|
933
|
+
arg.chomp!( ',' )
|
934
|
+
}
|
935
|
+
return arg
|
936
|
+
|
937
|
+
when 'proxy-port'
|
938
|
+
return
|
939
|
+
|
940
|
+
when 'proxy-addr'
|
941
|
+
return "--proxy=#{self.proxy_addr}:#{self.proxy_port}"
|
942
|
+
|
943
|
+
|
944
|
+
end
|
945
|
+
|
946
|
+
if( var.is_a?( TrueClass ) )
|
947
|
+
arg = "--#{key}"
|
948
|
+
end
|
949
|
+
|
950
|
+
if( var.is_a?( String ) || var.is_a?( Fixnum ) )
|
951
|
+
arg = "--#{key}=#{var.to_s}"
|
952
|
+
end
|
953
|
+
|
954
|
+
if( var.is_a?( Array ) )
|
955
|
+
|
956
|
+
var.each {
|
957
|
+
|i|
|
958
|
+
|
959
|
+
i = i.source if i.is_a?( Regexp )
|
960
|
+
|
961
|
+
arg += " --#{key}=#{i}"
|
962
|
+
}
|
963
|
+
|
964
|
+
end
|
965
|
+
|
966
|
+
return arg
|
967
|
+
end
|
968
|
+
|
969
|
+
def paths_from_file( file )
|
970
|
+
IO.read( file ).lines.map {
|
971
|
+
|path|
|
972
|
+
path.gsub!( "\n", '' )
|
973
|
+
path.gsub!( "\r", '' )
|
974
|
+
path
|
975
|
+
}
|
976
|
+
end
|
977
|
+
|
978
|
+
private
|
979
|
+
|
980
|
+
def normalize_name( name )
|
981
|
+
name.to_s.gsub( '@', '' )
|
982
|
+
end
|
983
|
+
|
984
|
+
|
985
|
+
end
|
986
|
+
end
|