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,188 @@
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 'set'
12
+ require Arachni::Options.instance.dir['lib'] + 'module/output'
13
+ require Arachni::Options.instance.dir['lib'] + 'module/utilities'
14
+ require Arachni::Options.instance.dir['lib'] + 'module/trainer'
15
+ require Arachni::Options.instance.dir['lib'] + 'module/auditor'
16
+
17
+ module Arachni
18
+ module Module
19
+
20
+
21
+ #
22
+ # Arachni's base module class<br/>
23
+ # To be extended by Arachni::Modules.
24
+ #
25
+ # Defines basic structure and provides utilities to modules.
26
+ #
27
+ # @author: Tasos "Zapotek" Laskos
28
+ # <tasos.laskos@gmail.com>
29
+ # <zapotek@segfault.gr>
30
+ # @version: 0.2
31
+ # @abstract
32
+ #
33
+ class Base
34
+
35
+ # get output module
36
+ include Output
37
+
38
+ include Auditor
39
+
40
+ #
41
+ # Arachni::HTTP instance for the modules
42
+ #
43
+ # @return [Arachni::Module::HTTP]
44
+ #
45
+ attr_reader :http
46
+
47
+ #
48
+ # Arachni::Page instance
49
+ #
50
+ # @return [Page]
51
+ #
52
+ attr_reader :page
53
+
54
+ #
55
+ # Initializes the module attributes, HTTP client and {Trainer}
56
+ #
57
+ # @see Trainer
58
+ # @see HTTP
59
+ #
60
+ # @param [Page] page
61
+ #
62
+ def initialize( page )
63
+
64
+ @page = page
65
+ @http = Arachni::HTTP.instance
66
+ @http.trainer.page = @page.dup
67
+
68
+ # update the cookies
69
+ if( !@page.cookiejar.empty? )
70
+ @http.update_cookies( @page.cookiejar )
71
+ end
72
+
73
+ #
74
+ # This is slightly tricky...
75
+ #
76
+ # Each loaded module is instantiated for each page,
77
+ # however modules share the elements of each page and access them
78
+ # via the ElementsDB.
79
+ #
80
+ # Since the ElementDB is dynamically updated by the Trainer
81
+ # during the audit, is should only be initialized *once*
82
+ # for each page and not overwritten every single time a module is instantiated.
83
+ #
84
+ @@__last_url ||= ''
85
+ if( @@__last_url != @page.url )
86
+ @http.trainer.page = @page.dup
87
+ @http.trainer.init_forms( @page.forms )
88
+ @http.trainer.init_links( @page.links )
89
+ @http.trainer.init_cookies( @page.cookies )
90
+ @@__last_url = @page.url
91
+ end
92
+ end
93
+
94
+ #
95
+ # ABSTRACT - OPTIONAL
96
+ #
97
+ # It provides you with a way to setup your module's data and methods.
98
+ #
99
+ def prepare( )
100
+ end
101
+
102
+ #
103
+ # ABSTRACT - REQUIRED
104
+ #
105
+ # This is used to deliver the module's payload whatever it may be.
106
+ #
107
+ def run( )
108
+ end
109
+
110
+ #
111
+ # ABSTRACT - OPTIONAL
112
+ #
113
+ # This is called right before an [Arachni::Parser::Element]
114
+ # is submitted/auditted and is used to determine whether to skip it or not.
115
+ #
116
+ # Implementation details are left up to the running module.
117
+ #
118
+ # @param [Arachni::Parser::Element] elem
119
+ #
120
+ def skip?( elem )
121
+ return false
122
+ end
123
+
124
+ #
125
+ # ABSTRACT - OPTIONAL
126
+ #
127
+ # This is called after run() has finished executing,
128
+ #
129
+ def clean_up( )
130
+ end
131
+
132
+ #
133
+ # ABSTRACT - REQUIRED
134
+ #
135
+ # Provides information about the module.
136
+ # Don't take this lightly and don't ommit any of the info.
137
+ #
138
+ def self.info
139
+ {
140
+ :name => 'Base module abstract class',
141
+ :description => %q{Provides an abstract class the modules should implement.},
142
+ #
143
+ # Arachni needs to know what elements the module plans to audit
144
+ # before invoking it.
145
+ # If a page doesn't have any of those elements
146
+ # there's no point in instantiating the module.
147
+ #
148
+ # If you want the module to run no-matter what leave the array
149
+ # empty.
150
+ #
151
+ # 'Elements' => [
152
+ # Issue::Element::FORM,
153
+ # Issue::Element::LINK,
154
+ # Issue::Element::COOKIE,
155
+ # Issue::Element::HEADER
156
+ # ],
157
+ :elements => [],
158
+ :author => 'zapotek',
159
+ :version => '0.1',
160
+ :references => {
161
+ },
162
+ :targets => { 'Generic' => 'all' },
163
+ :issue => {
164
+ :description => %q{},
165
+ :cwe => '',
166
+ #
167
+ # Severity can be:
168
+ #
169
+ # Issue::Severity::HIGH
170
+ # Issue::Severity::MEDIUM
171
+ # Issue::Severity::LOW
172
+ # Issue::Severity::INFORMATIONAL
173
+ #
174
+ :severity => '',
175
+ :cvssv2 => '',
176
+ :remedy_guidance => '',
177
+ :remedy_code => '',
178
+ }
179
+ }
180
+ end
181
+
182
+ def register_results( results )
183
+ Arachni::Module::Manager.register_results( results )
184
+ end
185
+
186
+ end
187
+ end
188
+ end
@@ -0,0 +1,158 @@
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
+ module Arachni
11
+ module Module
12
+
13
+ #
14
+ # Holds a database of all auditable elements of the current page,<br/>
15
+ # including elements that have appeared dynamically during the audit.
16
+ #
17
+ # The database is updated by the {Trainer}.
18
+ #
19
+ # For each page that is audited the database is reset.
20
+ #
21
+ # @author: Tasos "Zapotek" Laskos
22
+ # <tasos.laskos@gmail.com>
23
+ # <zapotek@segfault.gr>
24
+ # @version: 0.2.1
25
+ #
26
+ module ElementDB
27
+
28
+ include Arachni::Module::Utilities
29
+
30
+ #
31
+ # page forms
32
+ #
33
+ @@forms ||= Set.new
34
+
35
+ #
36
+ # page links
37
+ #
38
+ @@links ||= Set.new
39
+
40
+ #
41
+ # page cookies
42
+ #
43
+ @@cookies ||= Set.new
44
+
45
+ #
46
+ # Initializes @@forms with the cookies found during the crawl/analysis
47
+ #
48
+ def init_forms( forms )
49
+ @@forms |= forms.map { |form| form.id }
50
+ end
51
+
52
+ #
53
+ # Initializes @@links with the links found during the crawl/analysis
54
+ #
55
+ def init_links( links )
56
+ @@links |= links.map { |link| link.id }
57
+ end
58
+
59
+ #
60
+ # Initializes @@cookies with the cookies found during the crawl/analysis
61
+ #
62
+ def init_cookies( cookies )
63
+ @@cookies = cookies
64
+ end
65
+
66
+ #
67
+ # Updates @@forms wth new forms that may have dynamically appeared<br/>
68
+ # after analyzing the HTTP responses during the audit.
69
+ #
70
+ # @param [Array<Element::Form>] forms
71
+ #
72
+ def update_forms( forms )
73
+
74
+ return [], 0 if forms.size == 0
75
+
76
+ form_cnt = 0
77
+ new_forms ||= []
78
+
79
+ forms.each {
80
+ |form|
81
+
82
+ next if form.action.include?( seed )
83
+ next if form.auditable.size == 0
84
+
85
+ if !@@forms.include?( form.id )
86
+ @@forms << form.id
87
+ new_forms << form
88
+ form_cnt += 1
89
+ end
90
+ }
91
+
92
+ return new_forms, form_cnt
93
+ end
94
+
95
+ #
96
+ # Updates @@links wth new links that may have dynamically appeared<br/>
97
+ # after analyzing the HTTP responses during the audit.
98
+ #
99
+ # @param [Array<Element::Link>] links
100
+ #
101
+ def update_links( links )
102
+ return [], 0 if links.size == 0
103
+
104
+ link_cnt = 0
105
+ new_links ||= []
106
+ links.each {
107
+ |link|
108
+
109
+ next if !link
110
+ next if link.action.include?( seed )
111
+
112
+ if !@@links.include?( link.id )
113
+ @@links << link.id
114
+ new_links << link
115
+ link_cnt += 1
116
+ end
117
+ }
118
+
119
+ return new_links, link_cnt
120
+ end
121
+
122
+ #
123
+ # Updates @@cookies wth new cookies that may have dynamically appeared<br/>
124
+ # after analyzing the HTTP responses during the audit.
125
+ #
126
+ # @param [Array<Element::Cookie>] cookies
127
+ #
128
+ def update_cookies( cookies )
129
+ return [], 0 if cookies.size == 0
130
+
131
+ cookie_cnt = 0
132
+ @new_cookies ||= []
133
+
134
+ cookies.each_with_index {
135
+ |cookie|
136
+
137
+ @@cookies.each_with_index {
138
+ |page_cookie, i|
139
+
140
+ if( page_cookie.raw['name'] == cookie.raw['name'] )
141
+ @@cookies[i] = cookie
142
+ else
143
+ @new_cookies << cookie
144
+ cookie_cnt += 1
145
+ end
146
+ }
147
+ }
148
+
149
+ @@cookies.flatten!
150
+ @@cookies |= @new_cookies
151
+
152
+ return [ @@cookies, cookie_cnt ]
153
+ end
154
+
155
+ end
156
+
157
+ end
158
+ end
@@ -0,0 +1,87 @@
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 Module
13
+
14
+ #
15
+ # KeyFiller class
16
+ #
17
+ # Included by {Module::Auditor}.<br/>
18
+ # Tries to fill in webapp parameters with values of proper type
19
+ # based on their name.
20
+ #
21
+ # @author: Tasos "Zapotek" Laskos
22
+ # <tasos.laskos@gmail.com>
23
+ # <zapotek@segfault.gr>
24
+ # @version: 0.1.1
25
+ #
26
+ class KeyFiller
27
+
28
+ # Hash of regexps for the parameter keys
29
+ # and the values to to fill in
30
+ #
31
+ # @return [Hash]
32
+ #
33
+ @@regexps = {
34
+ 'name' => 'arachni_name',
35
+ 'user' => 'arachni_user',
36
+ 'usr' => 'arachni_user',
37
+ 'pass' => '5543!%arachni_secret',
38
+ 'txt' => 'arachni_text',
39
+ 'num' => '132',
40
+ 'amount' => '100',
41
+ 'mail' => 'arachni@email.gr',
42
+ 'account' => '12',
43
+ 'id' => '1'
44
+ }
45
+
46
+ #
47
+ # Tries to fill a hash with values of appropriate type<br/>
48
+ # based on the key of the parameter.
49
+ #
50
+ # @param [Hash] hash hash of name=>value pairs
51
+ #
52
+ # @return [Hash]
53
+ #
54
+ def self.fill( hash )
55
+
56
+ hash.keys.each{
57
+ |key|
58
+
59
+ next if hash[key] && !hash[key].empty?
60
+
61
+ if val = self.match?( key )
62
+ hash[key] = val
63
+ end
64
+
65
+ # moronic default value...
66
+ # will figure out ssomething better in the future...
67
+ hash[key] = '1' if( !hash[key] || hash[key].empty? )
68
+ }
69
+
70
+ return hash
71
+ end
72
+
73
+ private
74
+
75
+ def self.match?( str )
76
+ @@regexps.keys.each {
77
+ |key|
78
+ return @@regexps[key] if( str =~ Regexp.new( key, 'i' ) )
79
+
80
+ }
81
+ return false
82
+ end
83
+
84
+ end
85
+
86
+ end
87
+ end
@@ -0,0 +1,87 @@
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
+ #
14
+ # The namespace under which all modules exist
15
+ #
16
+ module Modules
17
+
18
+ #
19
+ # Resets the namespace unloading all module classes
20
+ #
21
+ def self.reset
22
+ constants.each {
23
+ |const|
24
+ remove_const( const )
25
+ }
26
+ end
27
+ end
28
+
29
+ module Module
30
+
31
+ #
32
+ # Arachni::Module::Manager class
33
+ #
34
+ # Holds and manages the modules and their results.
35
+ #
36
+ # @author: Tasos "Zapotek" Laskos
37
+ # <tasos.laskos@gmail.com>
38
+ # <zapotek@segfault.gr>
39
+ # @version: 0.1
40
+ #
41
+ class Manager < Arachni::ComponentManager
42
+
43
+ include Arachni::UI::Output
44
+
45
+ #
46
+ # @param [Arachni::Options] opts
47
+ #
48
+ def initialize( opts )
49
+ super( opts.dir['modules'], Arachni::Modules )
50
+ @opts = opts
51
+ @@results = []
52
+ end
53
+
54
+ #
55
+ # Class method
56
+ #
57
+ # Registers module results with...well..us.
58
+ #
59
+ # @param [Array]
60
+ #
61
+ def self.register_results( results )
62
+ @@results |= results
63
+ end
64
+
65
+ #
66
+ # Class method
67
+ #
68
+ # Gets module results
69
+ #
70
+ # @param [Array]
71
+ #
72
+ def self.results( )
73
+ @@results
74
+ end
75
+
76
+ def results
77
+ @@results
78
+ end
79
+
80
+ def self.reset
81
+ @@results.clear
82
+ Arachni::Modules.reset
83
+ end
84
+
85
+ end
86
+ end
87
+ end