lib/framework.rb in arachni-0.2.4 vs lib/framework.rb in arachni-0.3
- old
+ new
@@ -69,11 +69,11 @@
include Arachni::UI::Output
include Arachni::Module::Utilities
include Arachni::Mixins::Observable
# the version of *this* class
- REVISION = '0.2.1'
+ REVISION = '0.2.3'
#
# Instance options
#
# @return [Options]
@@ -208,28 +208,44 @@
else
@opts.delta_time = Time.now - @opts.start_datetime
end
curr_avg = 0
- if http.curr_res_cnt > 0
+ if http.curr_res_cnt > 0 && http.curr_res_time > 0
curr_avg = (http.curr_res_cnt / http.curr_res_time).to_i.to_s
end
+ avg = 0
+ if res_cnt > 0
+ avg = ( res_cnt / @opts.delta_time ).to_i.to_s
+ end
+
+ progress = (Float( @auditmap.size ) / @sitemap.size) * 100
+
+ if Arachni::Module::Auditor.timeout_loaded_modules.size > 0 &&
+ Arachni::Module::Auditor.timeout_audit_blocks.size > 0
+
+ progress /= 2
+ progress += ( Float( Arachni::Module::Auditor.timeout_loaded_modules.size ) /
+ Arachni::Module::Auditor.timeout_audit_blocks.size ) * 50
+ end
+
return {
:requests => req_cnt,
:responses => res_cnt,
:time_out_count => http.time_out_count,
:time => audit_store.delta_time,
- :avg => ( res_cnt / @opts.delta_time ).to_i.to_s,
+ :avg => avg,
:sitemap_size => @sitemap.size,
:auditmap_size => @auditmap.size,
+ :progress => progress.to_s[0...5],
:curr_res_time => http.curr_res_time,
:curr_res_cnt => http.curr_res_cnt,
:curr_avg => curr_avg,
:average_res_time => http.average_res_time,
- :max_concurrency => http.max_concurrency,
- :current_page => @current_url
+ :max_concurrency => http.max_concurrency,
+ :current_page => @current_url
}
end
#
# Audits the site.
@@ -248,16 +264,25 @@
# initiates the crawl
@spider.run {
|page|
- @sitemap |= @spider.pages
+ @sitemap |= @spider.sitemap
@page_queue << page
audit_queue if !@opts.spider_first
}
+ exception_jail {
+ if !Arachni::Module::Auditor.timeout_audit_blocks.empty?
+ print_line
+ print_status( 'Running timing attacks.' )
+ print_info( '---------------------------------------' )
+ Arachni::Module::Auditor.timeout_audit_run
+ end
+ }
+
audit_queue
if( @opts.http_harvest_last )
harvest_http_responses( )
end
@@ -426,16 +451,18 @@
def paused?
!@paused.empty?
end
def pause!
+ @spider.pause! if @spider
@paused << caller
return true
end
def resume!
@paused.delete( caller )
+ @spider.resume! if @spider
return true
end
#
# Returns the version of the framework
@@ -589,13 +616,16 @@
begin
# instantiate the module
mod_new = mod.new( page )
+ mod_new.set_framework( self )
mod_new.prepare
mod_new.run
mod_new.clean_up
+ rescue SystemExit
+ raise
rescue Exception => e
print_error( 'Error in ' + mod.to_s + ': ' + e.to_s )
print_debug_backtrace( e )
end
end