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.
Files changed (262) hide show
  1. data/ACKNOWLEDGMENTS.md +14 -0
  2. data/AUTHORS.md +6 -0
  3. data/CHANGELOG.md +162 -0
  4. data/CONTRIBUTORS.md +10 -0
  5. data/EXPLOITATION.md +429 -0
  6. data/HACKING.md +101 -0
  7. data/LICENSE.md +341 -0
  8. data/README.md +350 -0
  9. data/Rakefile +86 -0
  10. data/bin/arachni +22 -0
  11. data/bin/arachni_web +77 -0
  12. data/bin/arachni_xmlrpc +21 -0
  13. data/bin/arachni_xmlrpcd +82 -0
  14. data/bin/arachni_xmlrpcd_monitor +74 -0
  15. data/conf/README.webui.yaml.txt +44 -0
  16. data/conf/webui.yaml +11 -0
  17. data/external/metasploit/LICENSE +24 -0
  18. data/external/metasploit/modules/exploits/unix/webapp/arachni_exec.rb +142 -0
  19. data/external/metasploit/modules/exploits/unix/webapp/arachni_path_traversal.rb +113 -0
  20. data/external/metasploit/modules/exploits/unix/webapp/arachni_php_eval.rb +150 -0
  21. data/external/metasploit/modules/exploits/unix/webapp/arachni_php_include.rb +141 -0
  22. data/external/metasploit/modules/exploits/unix/webapp/arachni_sqlmap.rb +92 -0
  23. data/external/metasploit/plugins/arachni.rb +536 -0
  24. data/getoptslong.rb +241 -0
  25. data/lib/anemone.rb +2 -0
  26. data/lib/anemone/cookie_store.rb +35 -0
  27. data/lib/anemone/core.rb +371 -0
  28. data/lib/anemone/exceptions.rb +5 -0
  29. data/lib/anemone/http.rb +144 -0
  30. data/lib/anemone/page.rb +337 -0
  31. data/lib/anemone/page_store.rb +160 -0
  32. data/lib/anemone/storage.rb +34 -0
  33. data/lib/anemone/storage/base.rb +75 -0
  34. data/lib/anemone/storage/exceptions.rb +15 -0
  35. data/lib/anemone/storage/mongodb.rb +89 -0
  36. data/lib/anemone/storage/pstore.rb +50 -0
  37. data/lib/anemone/storage/redis.rb +90 -0
  38. data/lib/anemone/storage/tokyo_cabinet.rb +57 -0
  39. data/lib/anemone/tentacle.rb +40 -0
  40. data/lib/arachni.rb +16 -0
  41. data/lib/audit_store.rb +346 -0
  42. data/lib/component_manager.rb +293 -0
  43. data/lib/component_options.rb +395 -0
  44. data/lib/exceptions.rb +76 -0
  45. data/lib/framework.rb +637 -0
  46. data/lib/http.rb +809 -0
  47. data/lib/issue.rb +302 -0
  48. data/lib/module.rb +4 -0
  49. data/lib/module/auditor.rb +455 -0
  50. data/lib/module/base.rb +188 -0
  51. data/lib/module/element_db.rb +158 -0
  52. data/lib/module/key_filler.rb +87 -0
  53. data/lib/module/manager.rb +87 -0
  54. data/lib/module/output.rb +68 -0
  55. data/lib/module/trainer.rb +240 -0
  56. data/lib/module/utilities.rb +110 -0
  57. data/lib/options.rb +547 -0
  58. data/lib/parser.rb +2 -0
  59. data/lib/parser/auditable.rb +522 -0
  60. data/lib/parser/elements.rb +296 -0
  61. data/lib/parser/page.rb +149 -0
  62. data/lib/parser/parser.rb +717 -0
  63. data/lib/plugin.rb +4 -0
  64. data/lib/plugin/base.rb +110 -0
  65. data/lib/plugin/manager.rb +162 -0
  66. data/lib/report.rb +4 -0
  67. data/lib/report/base.rb +119 -0
  68. data/lib/report/manager.rb +92 -0
  69. data/lib/rpc/xml/client/base.rb +71 -0
  70. data/lib/rpc/xml/client/dispatcher.rb +49 -0
  71. data/lib/rpc/xml/client/instance.rb +88 -0
  72. data/lib/rpc/xml/server/base.rb +90 -0
  73. data/lib/rpc/xml/server/dispatcher.rb +357 -0
  74. data/lib/rpc/xml/server/framework.rb +206 -0
  75. data/lib/rpc/xml/server/instance.rb +191 -0
  76. data/lib/rpc/xml/server/module/manager.rb +46 -0
  77. data/lib/rpc/xml/server/options.rb +124 -0
  78. data/lib/rpc/xml/server/output.rb +299 -0
  79. data/lib/rpc/xml/server/plugin/manager.rb +58 -0
  80. data/lib/ruby.rb +5 -0
  81. data/lib/ruby/object.rb +32 -0
  82. data/lib/ruby/string.rb +74 -0
  83. data/lib/ruby/xmlrpc/server.rb +27 -0
  84. data/lib/spider.rb +200 -0
  85. data/lib/typhoeus/request.rb +91 -0
  86. data/lib/typhoeus/response.rb +34 -0
  87. data/lib/ui/cli/cli.rb +744 -0
  88. data/lib/ui/cli/output.rb +279 -0
  89. data/lib/ui/web/log.rb +82 -0
  90. data/lib/ui/web/output_stream.rb +94 -0
  91. data/lib/ui/web/report_manager.rb +222 -0
  92. data/lib/ui/web/server.rb +903 -0
  93. data/lib/ui/web/server/db/placeholder +0 -0
  94. data/lib/ui/web/server/public/banner.png +0 -0
  95. data/lib/ui/web/server/public/bodybg-small.png +0 -0
  96. data/lib/ui/web/server/public/bodybg.png +0 -0
  97. data/lib/ui/web/server/public/css/smoothness/images/pbar-ani.gif +0 -0
  98. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  99. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  100. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  101. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  102. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  103. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  104. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  105. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  106. data/lib/ui/web/server/public/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  107. data/lib/ui/web/server/public/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  108. data/lib/ui/web/server/public/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  109. data/lib/ui/web/server/public/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  110. data/lib/ui/web/server/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  111. data/lib/ui/web/server/public/css/smoothness/jquery-ui-1.8.9.custom.css +573 -0
  112. data/lib/ui/web/server/public/favicon.ico +0 -0
  113. data/lib/ui/web/server/public/footer.jpg +0 -0
  114. data/lib/ui/web/server/public/icons/error.png +0 -0
  115. data/lib/ui/web/server/public/icons/info.png +0 -0
  116. data/lib/ui/web/server/public/icons/ok.png +0 -0
  117. data/lib/ui/web/server/public/icons/status.png +0 -0
  118. data/lib/ui/web/server/public/js/jquery-1.4.4.min.js +167 -0
  119. data/lib/ui/web/server/public/js/jquery-ui-1.8.9.custom.min.js +781 -0
  120. data/lib/ui/web/server/public/logo.png +0 -0
  121. data/lib/ui/web/server/public/nav-left.jpg +0 -0
  122. data/lib/ui/web/server/public/nav-right.jpg +0 -0
  123. data/lib/ui/web/server/public/nav-selected-left.jpg +0 -0
  124. data/lib/ui/web/server/public/nav-selected-right.jpg +0 -0
  125. data/lib/ui/web/server/public/reports/placeholder +1 -0
  126. data/lib/ui/web/server/public/sidebar-bottom.jpg +0 -0
  127. data/lib/ui/web/server/public/sidebar-h4.jpg +0 -0
  128. data/lib/ui/web/server/public/sidebar-top.jpg +0 -0
  129. data/lib/ui/web/server/public/spider.png +0 -0
  130. data/lib/ui/web/server/public/style.css +604 -0
  131. data/lib/ui/web/server/tmp/placeholder +0 -0
  132. data/lib/ui/web/server/views/dispatcher.erb +85 -0
  133. data/lib/ui/web/server/views/dispatcher_error.erb +14 -0
  134. data/lib/ui/web/server/views/error.erb +1 -0
  135. data/lib/ui/web/server/views/flash.erb +18 -0
  136. data/lib/ui/web/server/views/home.erb +14 -0
  137. data/lib/ui/web/server/views/instance.erb +213 -0
  138. data/lib/ui/web/server/views/layout.erb +95 -0
  139. data/lib/ui/web/server/views/log.erb +40 -0
  140. data/lib/ui/web/server/views/modules.erb +71 -0
  141. data/lib/ui/web/server/views/options.erb +23 -0
  142. data/lib/ui/web/server/views/output_results.erb +51 -0
  143. data/lib/ui/web/server/views/plugins.erb +42 -0
  144. data/lib/ui/web/server/views/report_formats.erb +30 -0
  145. data/lib/ui/web/server/views/reports.erb +55 -0
  146. data/lib/ui/web/server/views/settings.erb +120 -0
  147. data/lib/ui/web/server/views/welcome.erb +38 -0
  148. data/lib/ui/xmlrpc/dispatcher_monitor.rb +204 -0
  149. data/lib/ui/xmlrpc/xmlrpc.rb +843 -0
  150. data/logs/placeholder +0 -0
  151. data/metamodules/autothrottle.rb +74 -0
  152. data/metamodules/timeout_notice.rb +118 -0
  153. data/metamodules/uniformity.rb +98 -0
  154. data/modules/audit/code_injection.rb +136 -0
  155. data/modules/audit/code_injection_timing.rb +115 -0
  156. data/modules/audit/code_injection_timing/payloads.txt +4 -0
  157. data/modules/audit/csrf.rb +301 -0
  158. data/modules/audit/ldapi.rb +103 -0
  159. data/modules/audit/ldapi/errors.txt +26 -0
  160. data/modules/audit/os_cmd_injection.rb +103 -0
  161. data/modules/audit/os_cmd_injection/payloads.txt +2 -0
  162. data/modules/audit/os_cmd_injection_timing.rb +104 -0
  163. data/modules/audit/os_cmd_injection_timing/payloads.txt +3 -0
  164. data/modules/audit/path_traversal.rb +141 -0
  165. data/modules/audit/response_splitting.rb +105 -0
  166. data/modules/audit/rfi.rb +193 -0
  167. data/modules/audit/sqli.rb +120 -0
  168. data/modules/audit/sqli/regexp_ids.txt +90 -0
  169. data/modules/audit/sqli_blind_rdiff.rb +321 -0
  170. data/modules/audit/sqli_blind_timing.rb +103 -0
  171. data/modules/audit/sqli_blind_timing/payloads.txt +51 -0
  172. data/modules/audit/trainer.rb +89 -0
  173. data/modules/audit/unvalidated_redirect.rb +90 -0
  174. data/modules/audit/xpath.rb +104 -0
  175. data/modules/audit/xpath/errors.txt +26 -0
  176. data/modules/audit/xss.rb +99 -0
  177. data/modules/audit/xss_event.rb +134 -0
  178. data/modules/audit/xss_path.rb +125 -0
  179. data/modules/audit/xss_script_tag.rb +112 -0
  180. data/modules/audit/xss_tag.rb +112 -0
  181. data/modules/audit/xss_uri.rb +125 -0
  182. data/modules/recon/allowed_methods.rb +104 -0
  183. data/modules/recon/backdoors.rb +131 -0
  184. data/modules/recon/backdoors/filenames.txt +16 -0
  185. data/modules/recon/backup_files.rb +177 -0
  186. data/modules/recon/backup_files/extensions.txt +28 -0
  187. data/modules/recon/common_directories.rb +138 -0
  188. data/modules/recon/common_directories/directories.txt +265 -0
  189. data/modules/recon/common_files.rb +138 -0
  190. data/modules/recon/common_files/filenames.txt +17 -0
  191. data/modules/recon/directory_listing.rb +171 -0
  192. data/modules/recon/grep/captcha.rb +62 -0
  193. data/modules/recon/grep/credit_card.rb +85 -0
  194. data/modules/recon/grep/cvs_svn_users.rb +73 -0
  195. data/modules/recon/grep/emails.rb +59 -0
  196. data/modules/recon/grep/html_objects.rb +53 -0
  197. data/modules/recon/grep/private_ip.rb +54 -0
  198. data/modules/recon/grep/ssn.rb +53 -0
  199. data/modules/recon/htaccess_limit.rb +82 -0
  200. data/modules/recon/http_put.rb +95 -0
  201. data/modules/recon/interesting_responses.rb +118 -0
  202. data/modules/recon/unencrypted_password_forms.rb +119 -0
  203. data/modules/recon/webdav.rb +126 -0
  204. data/modules/recon/xst.rb +107 -0
  205. data/path_extractors/anchors.rb +35 -0
  206. data/path_extractors/forms.rb +35 -0
  207. data/path_extractors/frames.rb +38 -0
  208. data/path_extractors/generic.rb +39 -0
  209. data/path_extractors/links.rb +35 -0
  210. data/path_extractors/meta_refresh.rb +39 -0
  211. data/path_extractors/scripts.rb +37 -0
  212. data/path_extractors/sitemap.rb +31 -0
  213. data/plugins/autologin.rb +137 -0
  214. data/plugins/content_types.rb +90 -0
  215. data/plugins/cookie_collector.rb +99 -0
  216. data/plugins/form_dicattack.rb +185 -0
  217. data/plugins/healthmap.rb +94 -0
  218. data/plugins/http_dicattack.rb +133 -0
  219. data/plugins/metamodules.rb +118 -0
  220. data/plugins/proxy.rb +248 -0
  221. data/plugins/proxy/server.rb +66 -0
  222. data/plugins/waf_detector.rb +184 -0
  223. data/profiles/comprehensive.afp +74 -0
  224. data/profiles/full.afp +75 -0
  225. data/reports/afr.rb +59 -0
  226. data/reports/ap.rb +55 -0
  227. data/reports/html.rb +179 -0
  228. data/reports/html/default.erb +967 -0
  229. data/reports/metareport.rb +139 -0
  230. data/reports/metareport/arachni_metareport.rb +174 -0
  231. data/reports/plugin_formatters/html/content_types.rb +82 -0
  232. data/reports/plugin_formatters/html/cookie_collector.rb +66 -0
  233. data/reports/plugin_formatters/html/form_dicattack.rb +54 -0
  234. data/reports/plugin_formatters/html/healthmap.rb +76 -0
  235. data/reports/plugin_formatters/html/http_dicattack.rb +54 -0
  236. data/reports/plugin_formatters/html/metaformatters/timeout_notice.rb +65 -0
  237. data/reports/plugin_formatters/html/metaformatters/uniformity.rb +71 -0
  238. data/reports/plugin_formatters/html/metamodules.rb +93 -0
  239. data/reports/plugin_formatters/html/waf_detector.rb +54 -0
  240. data/reports/plugin_formatters/stdout/content_types.rb +73 -0
  241. data/reports/plugin_formatters/stdout/cookie_collector.rb +61 -0
  242. data/reports/plugin_formatters/stdout/form_dicattack.rb +52 -0
  243. data/reports/plugin_formatters/stdout/healthmap.rb +72 -0
  244. data/reports/plugin_formatters/stdout/http_dicattack.rb +53 -0
  245. data/reports/plugin_formatters/stdout/metaformatters/timeout_notice.rb +55 -0
  246. data/reports/plugin_formatters/stdout/metaformatters/uniformity.rb +68 -0
  247. data/reports/plugin_formatters/stdout/metamodules.rb +89 -0
  248. data/reports/plugin_formatters/stdout/waf_detector.rb +48 -0
  249. data/reports/plugin_formatters/xml/content_types.rb +91 -0
  250. data/reports/plugin_formatters/xml/cookie_collector.rb +70 -0
  251. data/reports/plugin_formatters/xml/form_dicattack.rb +57 -0
  252. data/reports/plugin_formatters/xml/healthmap.rb +82 -0
  253. data/reports/plugin_formatters/xml/http_dicattack.rb +57 -0
  254. data/reports/plugin_formatters/xml/metaformatters/timeout_notice.rb +67 -0
  255. data/reports/plugin_formatters/xml/metaformatters/uniformity.rb +82 -0
  256. data/reports/plugin_formatters/xml/metamodules.rb +91 -0
  257. data/reports/plugin_formatters/xml/waf_detector.rb +58 -0
  258. data/reports/stdout.rb +182 -0
  259. data/reports/txt.rb +77 -0
  260. data/reports/xml.rb +231 -0
  261. data/reports/xml/buffer.rb +98 -0
  262. metadata +516 -0
@@ -0,0 +1,299 @@
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
+ # XML-RPC deamon Output module
17
+ #
18
+ # It basically classifies and buffers all system messages until it's time to
19
+ # flush the buffer and send them over the wire.
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
+ @@reroute_to_file = false
44
+
45
+ @@buffer ||= []
46
+
47
+ #
48
+ # Empties the output buffer and returns all messages.
49
+ #
50
+ # Messages are classified by their type.
51
+ #
52
+ # @return [Array<Hash>]
53
+ #
54
+ def flush_buffer
55
+ buf = @@buffer.dup
56
+ @@buffer.clear
57
+ return buf
58
+ end
59
+
60
+ def buffer( msg )
61
+ if file = @@reroute_to_file
62
+ File.open( file, 'a+' ) {
63
+ |f|
64
+
65
+ type = msg.keys[0]
66
+ str = msg.values[0]
67
+ next if str.empty?
68
+
69
+ f.write( "[#{Time.now.asctime}] [#{type}] #{str}\n" )
70
+ }
71
+ else
72
+ @@buffer << msg
73
+ end
74
+ end
75
+
76
+ # Prints an error message
77
+ #
78
+ # It ignores all flags, error messages will be output under all
79
+ # circumstances.
80
+ #
81
+ # @param [String] error string
82
+ # @return [void]
83
+ #
84
+ def print_error( str = '' )
85
+ buffer( :error => str )
86
+ print_color( '[-]', 31, str, $stderr )
87
+ end
88
+
89
+ # Prints a status message
90
+ #
91
+ # Obeys {@@only_positives}
92
+ #
93
+ # @see #only_positives?
94
+ # @see #only_positives!
95
+ #
96
+ # @param [String] status string
97
+ # @return [void]
98
+ #
99
+ def print_status( str = '' )
100
+ if @@only_positives then return end
101
+ buffer( :status => str )
102
+ end
103
+
104
+ # Prints an info message
105
+ #
106
+ # Obeys {@@only_positives}
107
+ #
108
+ # @see #only_positives?
109
+ # @see #only_positives!
110
+ #
111
+ # @param [String] info string
112
+ # @return [void]
113
+ #
114
+ def print_info( str = '' )
115
+ if @@only_positives then return end
116
+ buffer( :info => str )
117
+ end
118
+
119
+ # Prints a good message, something that went very very right,
120
+ # like the discovery of a vulnerability
121
+ #
122
+ # Disregards all flags.
123
+ #
124
+ # @param [String] ok string
125
+ # @return [void]
126
+ #
127
+ def print_ok( str = '' )
128
+ buffer( :ok => str )
129
+ end
130
+
131
+ # Prints a debugging message
132
+ #
133
+ # Obeys {@@debug}
134
+ #
135
+ # @see #debug?
136
+ # @see #debug!
137
+ #
138
+ # @param [String] debugging string
139
+ # @return [void]
140
+ #
141
+ def print_debug( str = '' )
142
+ if !@@debug then return end
143
+
144
+ if reroute_to_file?
145
+ buffer( :debug => str )
146
+ else
147
+ print_color( '[!]', 36, str, $stderr )
148
+ end
149
+ end
150
+
151
+ # Pretty prints an object, used for debugging,
152
+ # needs some improvement but it'll do for now
153
+ #
154
+ # Obeys {@@debug}
155
+ #
156
+ # @see #debug?
157
+ # @see #debug!
158
+ #
159
+ # @param [Object]
160
+ # @return [void]
161
+ #
162
+ def print_debug_pp( obj = nil )
163
+ if !@@debug then return end
164
+ pp obj
165
+ end
166
+
167
+ # Prints the backtrace of an exception
168
+ #
169
+ # Obeys {@@debug}
170
+ #
171
+ # @see #debug?
172
+ # @see #debug!
173
+ #
174
+ # @param [Exception]
175
+ # @return [void]
176
+ #
177
+ def print_debug_backtrace( e = nil )
178
+ if !@@debug then return end
179
+ e.backtrace.each{ |line| print_debug( line ) }
180
+ end
181
+
182
+ # Prints a verbose message
183
+ #
184
+ # Obeys {@@verbose}
185
+ #
186
+ # @see #verbose?
187
+ # @see #verbose!
188
+ #
189
+ # @param [String] verbose string
190
+ # @return [void]
191
+ #
192
+ def print_verbose( str = '' )
193
+ if !@@verbose then return end
194
+ buffer( :verbose => str )
195
+ end
196
+
197
+ # Prints a line of message
198
+ #
199
+ # Obeys {@@only_positives}
200
+ #
201
+ # @see #only_positives?
202
+ # @see #only_positives!
203
+ #
204
+ # @param [String] string
205
+ # @return [void]
206
+ #
207
+ def print_line( str = '' )
208
+ if @@only_positives then return end
209
+ buffer( :line => str )
210
+ end
211
+
212
+ # Sets the {@@verbose} flag to true
213
+ #
214
+ # @see #verbose?
215
+ #
216
+ # @return [void]
217
+ #
218
+ def verbose!
219
+ @@verbose = true
220
+ end
221
+
222
+ # Returns the {@@verbose} flag
223
+ #
224
+ # @see #verbose!
225
+ #
226
+ # @return [Bool] @@verbose
227
+ #
228
+ def verbose?
229
+ @@verbose
230
+ end
231
+
232
+ # Sets the {@@debug} flag to true
233
+ #
234
+ # @see #debug?
235
+ #
236
+ # @return [void]
237
+ #
238
+ def debug!
239
+ @@debug = true
240
+ end
241
+
242
+ # Returns the {@@debug} flag
243
+ #
244
+ # @see #debug!
245
+ #
246
+ # @return [Bool] @@debug
247
+ #
248
+ def debug?
249
+ @@debug
250
+ end
251
+
252
+ # Sets the {@@only_positives} flag to true
253
+ #
254
+ # @see #only_positives?
255
+ #
256
+ # @return [void]
257
+ #
258
+ def only_positives!
259
+ @@only_positives = true
260
+ end
261
+
262
+ # Returns the {@@only_positives} flag
263
+ #
264
+ # @see #only_positives!
265
+ #
266
+ # @return [Bool] @@only_positives
267
+ #
268
+ def only_positives?
269
+ @@only_positives
270
+ end
271
+
272
+ def reroute_to_file( file )
273
+ @@reroute_to_file = file
274
+ end
275
+
276
+ def reroute_to_file?
277
+ @@reroute_to_file
278
+ end
279
+
280
+ private
281
+
282
+ # Prints a message prefixed with a colored sign.
283
+ #
284
+ # Disregards all flags.
285
+ #
286
+ # @param [String] sign
287
+ # @param [Integer] shell color number
288
+ # @param [String] the string to output
289
+ #
290
+ # @return [void]
291
+ #
292
+ def print_color( sign, color, string, out = $stdout )
293
+ out.print "\033[1;#{color.to_s}m #{sign}\033[1;00m #{string}\n";
294
+ end
295
+
296
+ end
297
+
298
+ end
299
+ end
@@ -0,0 +1,58 @@
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
+ require Options.instance.dir['lib'] + 'plugin/manager'
14
+
15
+ module RPC
16
+ module XML
17
+ module Server
18
+ module Plugin
19
+
20
+ #
21
+ # We need to extend the original Manager and redeclare its inherited methods
22
+ # which are required over XMLRPC.
23
+ #
24
+ # @author: Tasos "Zapotek" Laskos
25
+ # <tasos.laskos@gmail.com>
26
+ # <zapotek@segfault.gr>
27
+ # @version: 0.1.1
28
+ #
29
+ class Manager < ::Arachni::Plugin::Manager
30
+
31
+ # make these inherited methods visible again
32
+ private :available
33
+ public :available
34
+
35
+ def initialize( framework )
36
+ super( framework )
37
+
38
+ @plugin_opts = {}
39
+ end
40
+
41
+ def load( plugins )
42
+
43
+ @plugin_opts.merge!( plugins )
44
+ super( plugins.keys )
45
+ end
46
+
47
+ def create( name )
48
+ self[name].new( @framework, prep_opts( name, self[name], @plugin_opts[name] ) )
49
+ end
50
+
51
+
52
+ end
53
+
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,5 @@
1
+
2
+ opts = Arachni::Options.instance
3
+ require opts.dir['lib'] + 'ruby/object'
4
+ require opts.dir['lib'] + 'ruby/string'
5
+ require opts.dir['lib'] + 'ruby/xmlrpc/server'
@@ -0,0 +1,32 @@
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
+ #
12
+ # Overloads the {Object} class providing a deep_clone() method
13
+ #
14
+ # @author: Tasos "Zapotek" Laskos
15
+ # <tasos.laskos@gmail.com>
16
+ # <zapotek@segfault.gr>
17
+ # @version: 0.1
18
+ #
19
+ class Object
20
+
21
+ #
22
+ # Deep-clones self using a Marshal dump-load.
23
+ #
24
+ def deep_clone
25
+ begin
26
+ return Marshal.load( Marshal.dump( self ) )
27
+ rescue Exception
28
+ return self
29
+ end
30
+ end
31
+
32
+ end
@@ -0,0 +1,74 @@
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
+ #
12
+ # Overloads the {String} class.
13
+ #
14
+ # @author: Tasos "Zapotek" Laskos
15
+ # <tasos.laskos@gmail.com>
16
+ # <zapotek@segfault.gr>
17
+ # @version: 0.1
18
+ #
19
+ class String
20
+
21
+ #
22
+ # Gets the reverse diff between self and str on a word level.
23
+ #
24
+ #
25
+ # self = <<END
26
+ # This is the first test.
27
+ # Not really sure what else to put here...
28
+ # END
29
+ #
30
+ # str = <<END
31
+ # This is the second test.
32
+ # Not really sure what else to put here...
33
+ # Boo-Yah!
34
+ # END
35
+ #
36
+ # self.rdiff( str )
37
+ # # => "This is the test.\nNot really sure what else to put here...\n"
38
+ #
39
+ #
40
+ # @param [String] str
41
+ #
42
+ # @return [String]
43
+ #
44
+ def rdiff( str )
45
+
46
+ return self if self == str
47
+
48
+ # get the words of the first text in an array
49
+ words1 = self.split( /\b/ )
50
+
51
+ # get the words of the second text in an array
52
+ words2 = str.split( /\b/ )
53
+
54
+ # get all the words that are different between the 2 arrays
55
+ # math style!
56
+ changes = words1 - words2
57
+ changes << words2 - words1
58
+ changes.flatten!
59
+
60
+ # get what hasn't changed (the rdiff, so to speak) as a string
61
+ return ( words1 - changes ).join( '' )
62
+
63
+ end
64
+
65
+ def substring?( string )
66
+ begin
67
+ match = match( Regexp.new( Regexp.escape( string ) ) )
68
+ match && !match.to_s.empty?
69
+ rescue
70
+ return nil
71
+ end
72
+ end
73
+
74
+ end