arachni 0.2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ACKNOWLEDGMENTS.md +14 -0
- data/AUTHORS.md +6 -0
- data/CHANGELOG.md +162 -0
- data/CONTRIBUTORS.md +10 -0
- data/EXPLOITATION.md +429 -0
- data/HACKING.md +101 -0
- data/LICENSE.md +341 -0
- data/README.md +350 -0
- data/Rakefile +86 -0
- data/bin/arachni +22 -0
- data/bin/arachni_web +77 -0
- data/bin/arachni_xmlrpc +21 -0
- data/bin/arachni_xmlrpcd +82 -0
- data/bin/arachni_xmlrpcd_monitor +74 -0
- data/conf/README.webui.yaml.txt +44 -0
- data/conf/webui.yaml +11 -0
- data/external/metasploit/LICENSE +24 -0
- data/external/metasploit/modules/exploits/unix/webapp/arachni_exec.rb +142 -0
- data/external/metasploit/modules/exploits/unix/webapp/arachni_path_traversal.rb +113 -0
- data/external/metasploit/modules/exploits/unix/webapp/arachni_php_eval.rb +150 -0
- data/external/metasploit/modules/exploits/unix/webapp/arachni_php_include.rb +141 -0
- data/external/metasploit/modules/exploits/unix/webapp/arachni_sqlmap.rb +92 -0
- data/external/metasploit/plugins/arachni.rb +536 -0
- data/getoptslong.rb +241 -0
- data/lib/anemone.rb +2 -0
- data/lib/anemone/cookie_store.rb +35 -0
- data/lib/anemone/core.rb +371 -0
- data/lib/anemone/exceptions.rb +5 -0
- data/lib/anemone/http.rb +144 -0
- data/lib/anemone/page.rb +337 -0
- data/lib/anemone/page_store.rb +160 -0
- data/lib/anemone/storage.rb +34 -0
- data/lib/anemone/storage/base.rb +75 -0
- data/lib/anemone/storage/exceptions.rb +15 -0
- data/lib/anemone/storage/mongodb.rb +89 -0
- data/lib/anemone/storage/pstore.rb +50 -0
- data/lib/anemone/storage/redis.rb +90 -0
- data/lib/anemone/storage/tokyo_cabinet.rb +57 -0
- data/lib/anemone/tentacle.rb +40 -0
- data/lib/arachni.rb +16 -0
- data/lib/audit_store.rb +346 -0
- data/lib/component_manager.rb +293 -0
- data/lib/component_options.rb +395 -0
- data/lib/exceptions.rb +76 -0
- data/lib/framework.rb +637 -0
- data/lib/http.rb +809 -0
- data/lib/issue.rb +302 -0
- data/lib/module.rb +4 -0
- data/lib/module/auditor.rb +455 -0
- data/lib/module/base.rb +188 -0
- data/lib/module/element_db.rb +158 -0
- data/lib/module/key_filler.rb +87 -0
- data/lib/module/manager.rb +87 -0
- data/lib/module/output.rb +68 -0
- data/lib/module/trainer.rb +240 -0
- data/lib/module/utilities.rb +110 -0
- data/lib/options.rb +547 -0
- data/lib/parser.rb +2 -0
- data/lib/parser/auditable.rb +522 -0
- data/lib/parser/elements.rb +296 -0
- data/lib/parser/page.rb +149 -0
- data/lib/parser/parser.rb +717 -0
- data/lib/plugin.rb +4 -0
- data/lib/plugin/base.rb +110 -0
- data/lib/plugin/manager.rb +162 -0
- data/lib/report.rb +4 -0
- data/lib/report/base.rb +119 -0
- data/lib/report/manager.rb +92 -0
- data/lib/rpc/xml/client/base.rb +71 -0
- data/lib/rpc/xml/client/dispatcher.rb +49 -0
- data/lib/rpc/xml/client/instance.rb +88 -0
- data/lib/rpc/xml/server/base.rb +90 -0
- data/lib/rpc/xml/server/dispatcher.rb +357 -0
- data/lib/rpc/xml/server/framework.rb +206 -0
- data/lib/rpc/xml/server/instance.rb +191 -0
- data/lib/rpc/xml/server/module/manager.rb +46 -0
- data/lib/rpc/xml/server/options.rb +124 -0
- data/lib/rpc/xml/server/output.rb +299 -0
- data/lib/rpc/xml/server/plugin/manager.rb +58 -0
- data/lib/ruby.rb +5 -0
- data/lib/ruby/object.rb +32 -0
- data/lib/ruby/string.rb +74 -0
- data/lib/ruby/xmlrpc/server.rb +27 -0
- data/lib/spider.rb +200 -0
- data/lib/typhoeus/request.rb +91 -0
- data/lib/typhoeus/response.rb +34 -0
- data/lib/ui/cli/cli.rb +744 -0
- data/lib/ui/cli/output.rb +279 -0
- data/lib/ui/web/log.rb +82 -0
- data/lib/ui/web/output_stream.rb +94 -0
- data/lib/ui/web/report_manager.rb +222 -0
- data/lib/ui/web/server.rb +903 -0
- data/lib/ui/web/server/db/placeholder +0 -0
- data/lib/ui/web/server/public/banner.png +0 -0
- data/lib/ui/web/server/public/bodybg-small.png +0 -0
- data/lib/ui/web/server/public/bodybg.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/pbar-ani.gif +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/lib/ui/web/server/public/css/smoothness/jquery-ui-1.8.9.custom.css +573 -0
- data/lib/ui/web/server/public/favicon.ico +0 -0
- data/lib/ui/web/server/public/footer.jpg +0 -0
- data/lib/ui/web/server/public/icons/error.png +0 -0
- data/lib/ui/web/server/public/icons/info.png +0 -0
- data/lib/ui/web/server/public/icons/ok.png +0 -0
- data/lib/ui/web/server/public/icons/status.png +0 -0
- data/lib/ui/web/server/public/js/jquery-1.4.4.min.js +167 -0
- data/lib/ui/web/server/public/js/jquery-ui-1.8.9.custom.min.js +781 -0
- data/lib/ui/web/server/public/logo.png +0 -0
- data/lib/ui/web/server/public/nav-left.jpg +0 -0
- data/lib/ui/web/server/public/nav-right.jpg +0 -0
- data/lib/ui/web/server/public/nav-selected-left.jpg +0 -0
- data/lib/ui/web/server/public/nav-selected-right.jpg +0 -0
- data/lib/ui/web/server/public/reports/placeholder +1 -0
- data/lib/ui/web/server/public/sidebar-bottom.jpg +0 -0
- data/lib/ui/web/server/public/sidebar-h4.jpg +0 -0
- data/lib/ui/web/server/public/sidebar-top.jpg +0 -0
- data/lib/ui/web/server/public/spider.png +0 -0
- data/lib/ui/web/server/public/style.css +604 -0
- data/lib/ui/web/server/tmp/placeholder +0 -0
- data/lib/ui/web/server/views/dispatcher.erb +85 -0
- data/lib/ui/web/server/views/dispatcher_error.erb +14 -0
- data/lib/ui/web/server/views/error.erb +1 -0
- data/lib/ui/web/server/views/flash.erb +18 -0
- data/lib/ui/web/server/views/home.erb +14 -0
- data/lib/ui/web/server/views/instance.erb +213 -0
- data/lib/ui/web/server/views/layout.erb +95 -0
- data/lib/ui/web/server/views/log.erb +40 -0
- data/lib/ui/web/server/views/modules.erb +71 -0
- data/lib/ui/web/server/views/options.erb +23 -0
- data/lib/ui/web/server/views/output_results.erb +51 -0
- data/lib/ui/web/server/views/plugins.erb +42 -0
- data/lib/ui/web/server/views/report_formats.erb +30 -0
- data/lib/ui/web/server/views/reports.erb +55 -0
- data/lib/ui/web/server/views/settings.erb +120 -0
- data/lib/ui/web/server/views/welcome.erb +38 -0
- data/lib/ui/xmlrpc/dispatcher_monitor.rb +204 -0
- data/lib/ui/xmlrpc/xmlrpc.rb +843 -0
- data/logs/placeholder +0 -0
- data/metamodules/autothrottle.rb +74 -0
- data/metamodules/timeout_notice.rb +118 -0
- data/metamodules/uniformity.rb +98 -0
- data/modules/audit/code_injection.rb +136 -0
- data/modules/audit/code_injection_timing.rb +115 -0
- data/modules/audit/code_injection_timing/payloads.txt +4 -0
- data/modules/audit/csrf.rb +301 -0
- data/modules/audit/ldapi.rb +103 -0
- data/modules/audit/ldapi/errors.txt +26 -0
- data/modules/audit/os_cmd_injection.rb +103 -0
- data/modules/audit/os_cmd_injection/payloads.txt +2 -0
- data/modules/audit/os_cmd_injection_timing.rb +104 -0
- data/modules/audit/os_cmd_injection_timing/payloads.txt +3 -0
- data/modules/audit/path_traversal.rb +141 -0
- data/modules/audit/response_splitting.rb +105 -0
- data/modules/audit/rfi.rb +193 -0
- data/modules/audit/sqli.rb +120 -0
- data/modules/audit/sqli/regexp_ids.txt +90 -0
- data/modules/audit/sqli_blind_rdiff.rb +321 -0
- data/modules/audit/sqli_blind_timing.rb +103 -0
- data/modules/audit/sqli_blind_timing/payloads.txt +51 -0
- data/modules/audit/trainer.rb +89 -0
- data/modules/audit/unvalidated_redirect.rb +90 -0
- data/modules/audit/xpath.rb +104 -0
- data/modules/audit/xpath/errors.txt +26 -0
- data/modules/audit/xss.rb +99 -0
- data/modules/audit/xss_event.rb +134 -0
- data/modules/audit/xss_path.rb +125 -0
- data/modules/audit/xss_script_tag.rb +112 -0
- data/modules/audit/xss_tag.rb +112 -0
- data/modules/audit/xss_uri.rb +125 -0
- data/modules/recon/allowed_methods.rb +104 -0
- data/modules/recon/backdoors.rb +131 -0
- data/modules/recon/backdoors/filenames.txt +16 -0
- data/modules/recon/backup_files.rb +177 -0
- data/modules/recon/backup_files/extensions.txt +28 -0
- data/modules/recon/common_directories.rb +138 -0
- data/modules/recon/common_directories/directories.txt +265 -0
- data/modules/recon/common_files.rb +138 -0
- data/modules/recon/common_files/filenames.txt +17 -0
- data/modules/recon/directory_listing.rb +171 -0
- data/modules/recon/grep/captcha.rb +62 -0
- data/modules/recon/grep/credit_card.rb +85 -0
- data/modules/recon/grep/cvs_svn_users.rb +73 -0
- data/modules/recon/grep/emails.rb +59 -0
- data/modules/recon/grep/html_objects.rb +53 -0
- data/modules/recon/grep/private_ip.rb +54 -0
- data/modules/recon/grep/ssn.rb +53 -0
- data/modules/recon/htaccess_limit.rb +82 -0
- data/modules/recon/http_put.rb +95 -0
- data/modules/recon/interesting_responses.rb +118 -0
- data/modules/recon/unencrypted_password_forms.rb +119 -0
- data/modules/recon/webdav.rb +126 -0
- data/modules/recon/xst.rb +107 -0
- data/path_extractors/anchors.rb +35 -0
- data/path_extractors/forms.rb +35 -0
- data/path_extractors/frames.rb +38 -0
- data/path_extractors/generic.rb +39 -0
- data/path_extractors/links.rb +35 -0
- data/path_extractors/meta_refresh.rb +39 -0
- data/path_extractors/scripts.rb +37 -0
- data/path_extractors/sitemap.rb +31 -0
- data/plugins/autologin.rb +137 -0
- data/plugins/content_types.rb +90 -0
- data/plugins/cookie_collector.rb +99 -0
- data/plugins/form_dicattack.rb +185 -0
- data/plugins/healthmap.rb +94 -0
- data/plugins/http_dicattack.rb +133 -0
- data/plugins/metamodules.rb +118 -0
- data/plugins/proxy.rb +248 -0
- data/plugins/proxy/server.rb +66 -0
- data/plugins/waf_detector.rb +184 -0
- data/profiles/comprehensive.afp +74 -0
- data/profiles/full.afp +75 -0
- data/reports/afr.rb +59 -0
- data/reports/ap.rb +55 -0
- data/reports/html.rb +179 -0
- data/reports/html/default.erb +967 -0
- data/reports/metareport.rb +139 -0
- data/reports/metareport/arachni_metareport.rb +174 -0
- data/reports/plugin_formatters/html/content_types.rb +82 -0
- data/reports/plugin_formatters/html/cookie_collector.rb +66 -0
- data/reports/plugin_formatters/html/form_dicattack.rb +54 -0
- data/reports/plugin_formatters/html/healthmap.rb +76 -0
- data/reports/plugin_formatters/html/http_dicattack.rb +54 -0
- data/reports/plugin_formatters/html/metaformatters/timeout_notice.rb +65 -0
- data/reports/plugin_formatters/html/metaformatters/uniformity.rb +71 -0
- data/reports/plugin_formatters/html/metamodules.rb +93 -0
- data/reports/plugin_formatters/html/waf_detector.rb +54 -0
- data/reports/plugin_formatters/stdout/content_types.rb +73 -0
- data/reports/plugin_formatters/stdout/cookie_collector.rb +61 -0
- data/reports/plugin_formatters/stdout/form_dicattack.rb +52 -0
- data/reports/plugin_formatters/stdout/healthmap.rb +72 -0
- data/reports/plugin_formatters/stdout/http_dicattack.rb +53 -0
- data/reports/plugin_formatters/stdout/metaformatters/timeout_notice.rb +55 -0
- data/reports/plugin_formatters/stdout/metaformatters/uniformity.rb +68 -0
- data/reports/plugin_formatters/stdout/metamodules.rb +89 -0
- data/reports/plugin_formatters/stdout/waf_detector.rb +48 -0
- data/reports/plugin_formatters/xml/content_types.rb +91 -0
- data/reports/plugin_formatters/xml/cookie_collector.rb +70 -0
- data/reports/plugin_formatters/xml/form_dicattack.rb +57 -0
- data/reports/plugin_formatters/xml/healthmap.rb +82 -0
- data/reports/plugin_formatters/xml/http_dicattack.rb +57 -0
- data/reports/plugin_formatters/xml/metaformatters/timeout_notice.rb +67 -0
- data/reports/plugin_formatters/xml/metaformatters/uniformity.rb +82 -0
- data/reports/plugin_formatters/xml/metamodules.rb +91 -0
- data/reports/plugin_formatters/xml/waf_detector.rb +58 -0
- data/reports/stdout.rb +182 -0
- data/reports/txt.rb +77 -0
- data/reports/xml.rb +231 -0
- data/reports/xml/buffer.rb +98 -0
- metadata +516 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Arachni
|
|
3
|
+
Copyright (c) 2010-2011 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
|
+
module Arachni
|
|
12
|
+
|
|
13
|
+
module UI
|
|
14
|
+
|
|
15
|
+
#
|
|
16
|
+
# CLI Output module
|
|
17
|
+
#
|
|
18
|
+
# Provides a command line output interface to the framework.<br/>
|
|
19
|
+
# All UIs should provide an Arachni::UI::Output module with these methods.
|
|
20
|
+
#
|
|
21
|
+
# @author: Tasos "Zapotek" Laskos
|
|
22
|
+
# <tasos.laskos@gmail.com>
|
|
23
|
+
# <zapotek@segfault.gr>
|
|
24
|
+
# @version: 0.1
|
|
25
|
+
#
|
|
26
|
+
module Output
|
|
27
|
+
|
|
28
|
+
# verbosity flag
|
|
29
|
+
#
|
|
30
|
+
# if it's on verbose messages will be enabled
|
|
31
|
+
@@verbose = false
|
|
32
|
+
|
|
33
|
+
# debug flag
|
|
34
|
+
#
|
|
35
|
+
# if it's on debugging messages will be enabled
|
|
36
|
+
@@debug = false
|
|
37
|
+
|
|
38
|
+
# only_positives flag
|
|
39
|
+
#
|
|
40
|
+
# if it's on status messages will be disabled
|
|
41
|
+
@@only_positives = false
|
|
42
|
+
|
|
43
|
+
@@mute = false
|
|
44
|
+
|
|
45
|
+
# Prints an error message
|
|
46
|
+
#
|
|
47
|
+
# It ignores all flags, error messages will be output under all
|
|
48
|
+
# circumstances.
|
|
49
|
+
#
|
|
50
|
+
# @param [String] error string
|
|
51
|
+
# @return [void]
|
|
52
|
+
#
|
|
53
|
+
def print_error( str = '' )
|
|
54
|
+
print_color( '[-]', 31, str, $stderr )
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Prints a status message
|
|
58
|
+
#
|
|
59
|
+
# Obeys {@@only_positives}
|
|
60
|
+
#
|
|
61
|
+
# @see #only_positives?
|
|
62
|
+
# @see #only_positives!
|
|
63
|
+
#
|
|
64
|
+
# @param [String] status string
|
|
65
|
+
# @return [void]
|
|
66
|
+
#
|
|
67
|
+
def print_status( str = '' )
|
|
68
|
+
if @@only_positives then return end
|
|
69
|
+
print_color( '[*]', 34, str )
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Prints an info message
|
|
73
|
+
#
|
|
74
|
+
# Obeys {@@only_positives}
|
|
75
|
+
#
|
|
76
|
+
# @see #only_positives?
|
|
77
|
+
# @see #only_positives!
|
|
78
|
+
#
|
|
79
|
+
# @param [String] info string
|
|
80
|
+
# @return [void]
|
|
81
|
+
#
|
|
82
|
+
def print_info( str = '' )
|
|
83
|
+
if @@only_positives then return end
|
|
84
|
+
print_color( '[~]', 30, str )
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Prints a good message, something that went very very right,
|
|
88
|
+
# like the discovery of a vulnerability
|
|
89
|
+
#
|
|
90
|
+
# Disregards all flags.
|
|
91
|
+
#
|
|
92
|
+
# @param [String] ok string
|
|
93
|
+
# @return [void]
|
|
94
|
+
#
|
|
95
|
+
def print_ok( str = '' )
|
|
96
|
+
print_color( '[+]', 32, str )
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Prints a debugging message
|
|
100
|
+
#
|
|
101
|
+
# Obeys {@@debug}
|
|
102
|
+
#
|
|
103
|
+
# @see #debug?
|
|
104
|
+
# @see #debug!
|
|
105
|
+
#
|
|
106
|
+
# @param [String] debugging string
|
|
107
|
+
# @return [void]
|
|
108
|
+
#
|
|
109
|
+
def print_debug( str = '' )
|
|
110
|
+
if !@@debug then return end
|
|
111
|
+
print_color( '[!]', 36, str, $stderr )
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Pretty prints an object, used for debugging,
|
|
115
|
+
# needs some improvement but it'll do for now
|
|
116
|
+
#
|
|
117
|
+
# Obeys {@@debug}
|
|
118
|
+
#
|
|
119
|
+
# @see #debug?
|
|
120
|
+
# @see #debug!
|
|
121
|
+
#
|
|
122
|
+
# @param [Object]
|
|
123
|
+
# @return [void]
|
|
124
|
+
#
|
|
125
|
+
def print_debug_pp( obj = nil )
|
|
126
|
+
if !@@debug then return end
|
|
127
|
+
pp obj
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Prints the backtrace of an exception
|
|
131
|
+
#
|
|
132
|
+
# Obeys {@@debug}
|
|
133
|
+
#
|
|
134
|
+
# @see #debug?
|
|
135
|
+
# @see #debug!
|
|
136
|
+
#
|
|
137
|
+
# @param [Exception]
|
|
138
|
+
# @return [void]
|
|
139
|
+
#
|
|
140
|
+
def print_debug_backtrace( e = nil )
|
|
141
|
+
if !@@debug then return end
|
|
142
|
+
e.backtrace.each{ |line| print_debug( line ) }
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def print_error_backtrace( e = nil )
|
|
146
|
+
e.backtrace.each{ |line| print_error( line ) }
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
# Prints a verbose message
|
|
151
|
+
#
|
|
152
|
+
# Obeys {@@verbose}
|
|
153
|
+
#
|
|
154
|
+
# @see #verbose?
|
|
155
|
+
# @see #verbose!
|
|
156
|
+
#
|
|
157
|
+
# @param [String] verbose string
|
|
158
|
+
# @return [void]
|
|
159
|
+
#
|
|
160
|
+
def print_verbose( str = '' )
|
|
161
|
+
if !@@verbose then return end
|
|
162
|
+
print_color( '[v]', 37, str )
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Prints a line of message
|
|
166
|
+
#
|
|
167
|
+
# Obeys {@@only_positives}
|
|
168
|
+
#
|
|
169
|
+
# @see #only_positives?
|
|
170
|
+
# @see #only_positives!
|
|
171
|
+
#
|
|
172
|
+
# @param [String] string
|
|
173
|
+
# @return [void]
|
|
174
|
+
#
|
|
175
|
+
def print_line( str = '' )
|
|
176
|
+
if @@only_positives then return end
|
|
177
|
+
return if muted?
|
|
178
|
+
puts str
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Sets the {@@verbose} flag to true
|
|
182
|
+
#
|
|
183
|
+
# @see #verbose?
|
|
184
|
+
#
|
|
185
|
+
# @return [void]
|
|
186
|
+
#
|
|
187
|
+
def verbose!
|
|
188
|
+
@@verbose = true
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Returns the {@@verbose} flag
|
|
192
|
+
#
|
|
193
|
+
# @see #verbose!
|
|
194
|
+
#
|
|
195
|
+
# @return [Bool] @@verbose
|
|
196
|
+
#
|
|
197
|
+
def verbose?
|
|
198
|
+
@@verbose
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Sets the {@@debug} flag to true
|
|
202
|
+
#
|
|
203
|
+
# @see #debug?
|
|
204
|
+
#
|
|
205
|
+
# @return [void]
|
|
206
|
+
#
|
|
207
|
+
def debug!
|
|
208
|
+
@@debug = true
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Returns the {@@debug} flag
|
|
212
|
+
#
|
|
213
|
+
# @see #debug!
|
|
214
|
+
#
|
|
215
|
+
# @return [Bool] @@debug
|
|
216
|
+
#
|
|
217
|
+
def debug?
|
|
218
|
+
@@debug
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Sets the {@@only_positives} flag to true
|
|
222
|
+
#
|
|
223
|
+
# @see #only_positives?
|
|
224
|
+
#
|
|
225
|
+
# @return [void]
|
|
226
|
+
#
|
|
227
|
+
def only_positives!
|
|
228
|
+
@@only_positives = true
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Returns the {@@only_positives} flag
|
|
232
|
+
#
|
|
233
|
+
# @see #only_positives!
|
|
234
|
+
#
|
|
235
|
+
# @return [Bool] @@only_positives
|
|
236
|
+
#
|
|
237
|
+
def only_positives?
|
|
238
|
+
@@only_positives
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
def mute!
|
|
242
|
+
@@mute = true
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def unmute!
|
|
246
|
+
@@mute = false
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def muted?
|
|
251
|
+
@@mute
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
private
|
|
255
|
+
|
|
256
|
+
# Prints a message prefixed with a colored sign.
|
|
257
|
+
#
|
|
258
|
+
# Disregards all flags.
|
|
259
|
+
#
|
|
260
|
+
# @param [String] sign
|
|
261
|
+
# @param [Integer] shell color number
|
|
262
|
+
# @param [String] the string to output
|
|
263
|
+
#
|
|
264
|
+
# @return [void]
|
|
265
|
+
#
|
|
266
|
+
def print_color( sign, color, string, out = $stdout )
|
|
267
|
+
return if muted?
|
|
268
|
+
|
|
269
|
+
if out.tty?
|
|
270
|
+
out.print "\033[1;#{color.to_s}m #{sign}\033[1;00m #{string}\n";
|
|
271
|
+
else
|
|
272
|
+
out.print "#{sign} #{string}\n";
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
end
|
|
279
|
+
end
|
data/lib/ui/web/log.rb
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Arachni
|
|
3
|
+
Copyright (c) 2010-2011 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 'datamapper'
|
|
12
|
+
|
|
13
|
+
module Arachni
|
|
14
|
+
module UI
|
|
15
|
+
module Web
|
|
16
|
+
|
|
17
|
+
#
|
|
18
|
+
# A simple logger using DataMapper
|
|
19
|
+
#
|
|
20
|
+
# @author: Tasos "Zapotek" Laskos
|
|
21
|
+
# <tasos.laskos@gmail.com>
|
|
22
|
+
# <zapotek@segfault.gr>
|
|
23
|
+
# @version: 0.1
|
|
24
|
+
#
|
|
25
|
+
class Log
|
|
26
|
+
|
|
27
|
+
class Entry
|
|
28
|
+
include DataMapper::Resource
|
|
29
|
+
|
|
30
|
+
property :id, Serial
|
|
31
|
+
property :action, String
|
|
32
|
+
property :object, String
|
|
33
|
+
property :client_addr, String
|
|
34
|
+
property :client_host, String
|
|
35
|
+
property :owner, String
|
|
36
|
+
property :datestamp, DateTime
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def initialize( opts, settings )
|
|
41
|
+
|
|
42
|
+
@opts = opts
|
|
43
|
+
@settings = settings
|
|
44
|
+
|
|
45
|
+
DataMapper::setup( :default, "sqlite3://#{@settings.db}/log.db" )
|
|
46
|
+
DataMapper.finalize
|
|
47
|
+
|
|
48
|
+
Entry.auto_upgrade!
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def entry
|
|
52
|
+
Entry
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def method_missing( sym, *args, &block )
|
|
56
|
+
|
|
57
|
+
owner, action = sym.to_s.split( '_', 2 )
|
|
58
|
+
|
|
59
|
+
if args && args[1]
|
|
60
|
+
object = args[1]
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
if env = args[0]
|
|
64
|
+
addr = env['REMOTE_ADDR']
|
|
65
|
+
host = env['REMOTE_HOST']
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
Entry.create(
|
|
69
|
+
:action => action,
|
|
70
|
+
:owner => owner,
|
|
71
|
+
:object => object,
|
|
72
|
+
:client_addr => addr,
|
|
73
|
+
:client_host => host,
|
|
74
|
+
:datestamp => Time.now
|
|
75
|
+
)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Arachni
|
|
3
|
+
Copyright (c) 2010-2011 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
|
+
module Arachni
|
|
12
|
+
module UI
|
|
13
|
+
module Web
|
|
14
|
+
|
|
15
|
+
#
|
|
16
|
+
# Lame hack to make XMLRPC output appear stream-ish to Sinatra
|
|
17
|
+
# in order to send it back to the browser.
|
|
18
|
+
#
|
|
19
|
+
class OutputStream
|
|
20
|
+
|
|
21
|
+
#
|
|
22
|
+
#
|
|
23
|
+
# @param [Arachni::RPC::XML::Client::Instance] instance
|
|
24
|
+
# @param [Integer] lines number of lines to output between refreshes
|
|
25
|
+
#
|
|
26
|
+
def initialize( instance, lines, &block )
|
|
27
|
+
|
|
28
|
+
@lines = lines
|
|
29
|
+
@instance = instance
|
|
30
|
+
@buffer = []
|
|
31
|
+
|
|
32
|
+
@icon_whitelist = {}
|
|
33
|
+
[ 'status', 'ok', 'error', 'info' ].each {
|
|
34
|
+
|icon|
|
|
35
|
+
@icon_whitelist[icon] = "<img src='/icons/#{icon}.png' />"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
#
|
|
41
|
+
# @param [Array<Hash>] output
|
|
42
|
+
#
|
|
43
|
+
def <<( output )
|
|
44
|
+
@buffer << output.reverse
|
|
45
|
+
@buffer.flatten!
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def data
|
|
49
|
+
data = ''
|
|
50
|
+
each {
|
|
51
|
+
|line|
|
|
52
|
+
data << line
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
data
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
#
|
|
59
|
+
# Sinatra (or Rack, not sure) expects the output to respond to "each" so we oblige.
|
|
60
|
+
#
|
|
61
|
+
def each
|
|
62
|
+
|
|
63
|
+
self << @instance.service.output
|
|
64
|
+
|
|
65
|
+
@@last_output ||= ''
|
|
66
|
+
cnt = 0
|
|
67
|
+
|
|
68
|
+
if @buffer.empty?
|
|
69
|
+
yield @@last_output
|
|
70
|
+
else
|
|
71
|
+
@@last_output = ''
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
while( ( out = @buffer.pop ) && ( ( cnt += 1 ) < @lines ) )
|
|
75
|
+
|
|
76
|
+
type = out.keys[0]
|
|
77
|
+
msg = out.values[0]
|
|
78
|
+
|
|
79
|
+
next if out.values[0].empty?
|
|
80
|
+
|
|
81
|
+
icon = @icon_whitelist[type] || ''
|
|
82
|
+
str = icon + CGI.escapeHTML( " #{out.values[0]}" ) + "<br/>"
|
|
83
|
+
@@last_output << str
|
|
84
|
+
yield str
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
self << @instance.service.output
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|