Wednesday, January 18, 2012

How to use Arachni Framework

http://arachni.segfault.gr/latest The first thing you will need is CYGWIN, get it here. After it is installed download arachni and use the self extarcting archive and extract it to a folder of your choice. When it's done extracting, open the Cygwin.bat file. Now, we can create a simple RUBY file to include the arachni framework and start auditing a webpage. Type notepad text.rb and notepad will ask if you want to create the file, click yes. In here is where we will use the arachni framework.

Include the header for the CLI output and arachni itself
1:  require 'arachni/ui/cli/output'  
2:  require 'arachni'  

Turn off verbose
1:  Arachni::UI::Output.mute!  

Get some options from the framework
1:  opts = Arachni::Options.instance  

Specify that we want to audit html forms
1:  opts.audit_forms = true  

Now specif the URL (seed)
1:  opts.url = 'http://testfire.net/'  

if we only want to scan a single URL we would add this line
1:  opts.restrict_paths << 'http://testfire.net/search.aspx'  

New class (new arachni object with our options)
1:  framework = Arachni::Framework.new(opts)  

if we want to look for XSS exploits we would use
1:  framework.modules.load(['xss'])  

You can load ALL the modules by using a asterisk
1:  framework.modules.load(['*'])  

now run arachni
1:  framework.run  

get the first exploit we see
1:  issue = framework.audit_store.issues.first  

show the exploit we found on screen (cli output)
1:  puts "#{issue.name} at #{issue.url} in #{issue.elem} input `#{issue.var}` using #{issue.method}."  

And here is a code to scan for all the modules against a specific page.
1:  require 'arachni/ui/cli/output'  
2:  require 'arachni'  
3:  Arachni::UI::Output.mute!  
4:  opts = Arachni::Options.instance  
5:  opts.audit_forms = true  
6:  opts.url = 'http://www.bigcinemas.com/'  
7:  opts.restrict_paths &lt;&lt; 'http://www.bigcinemas.com/in/sendSMS.asp?mobNum=9762001337'  
8:  framework = Arachni::Framework.new( opts )  
9:  framework.modules.load(['*'])  
10:  framework.run  
11:  issue_arr = framework.audit_store.issues  
12:  issue_arr.each do|issue|  
13:    puts "#{issue.name} at #{issue.url} in #{issue.elem} input `#{issue.var}` using #{issue.method}.\n"  
14:  end