Introduction
Introduction Statistics Contact Development Disclaimer Help
Another round of cleanups, performance improvements, locking fixes, and other l…
Log
Files
Refs
README
---
commit b638c150a0aaba8a71813689e92dc00b4c9aaf95
parent 44b5a9182697deb00f117d396f4deefb352a3455
Author: HD Moore <[email protected]>
Date: Fri, 6 Mar 2009 02:26:56 +0000
Another round of cleanups, performance improvements, locking fixes, and other l…
Diffstat:
M web/app/controllers/analyze_contro… | 30 +++++++++++----------------…
M web/app/controllers/dial_results_c… | 86 ++++++++++-----------------…
M web/app/views/analyze/index.html.e… | 8 ++++++--
M web/app/views/analyze/view.html.erb | 1 -
M web/app/views/dial_results/analyze… | 4 +---
M web/app/views/dial_results/index.h… | 8 ++++++--
M web/app/views/dial_results/view.ht… | 1 -
M web/app/views/home/about.html.erb | 8 ++++----
8 files changed, 56 insertions(+), 90 deletions(-)
---
diff --git a/web/app/controllers/analyze_controller.rb b/web/app/controllers/an…
@@ -20,29 +20,21 @@ class AnalyzeController < ApplicationController
:conditions => [ 'completed = ? and processed = ? and busy = ?…
)
- @results_all = DialResult.find_all_by_dial_job_id(
- @job_id,
- :conditions => [ 'completed = ? and processed = ? and busy = ?…
- )
-
+
@g1 = Ezgraphix::Graphic.new(:c_type => 'col3d', :div_name => 'calls_p…
- @g1.render_options(:caption => 'Detected Lines by Type', :y_name => 'L…
-
- @g2 = Ezgraphix::Graphic.new(:c_type => 'pie2d', :div_name => 'calls_p…
- @g2.render_options(:caption => 'Ring Time')
-
+ @g1.render_options(:caption => 'Detected Lines by Type', :y_name => 'L…
+
+ ltypes = DialResult.find( :all, :select => 'DISTINCT line_type' ).map{…
res_types = {}
- res_rings = {}
-
- @results_all.each do |r|
- res_rings[ r.ringtime ] ||= 0
- res_rings[ r.ringtime ] += 1
- res_types[ r.line_type.capitalize.to_sym ] ||= 0
- res_types[ r.line_type.capitalize.to_sym ] += 1 …
+
+ ltypes.each do |k|
+ next if not k
+ res_types[k.capitalize.to_sym] = DialResult.count(
+ :conditions => ['dial_job_id = ? and line_type = ?', @…
+ )
end
@g1.data = res_types
- @g2.data = res_rings
end
# GET /dial_results/1/resource?id=XXX&type=YYY
@@ -50,7 +42,7 @@ class AnalyzeController < ApplicationController
ctype = 'text/html'
cpath = nil
- res = DialResult.find_by_id(params[:result_id])
+ res = DialResult.find(params[:result_id])
if(res and res.processed and res.rawfile)
case params[:type]
when 'big_sig'
diff --git a/web/app/controllers/dial_results_controller.rb b/web/app/controlle…
@@ -20,12 +20,8 @@ class DialResultsController < ApplicationController
# GET /dial_results/1/reanalyze
def reanalyze
- DialResult.find_all_by_dial_job_id(params[:id]).each do |r|
- r.processed = false
- r.processed_at = 0
- r.save
- end
- j = DialJob.find_by_id(params[:id])
+ DialResult.update_all(['processed = ?', false], ['dial_job_id = ?', …
+ j = DialJob.find(params[:id])
j.processed = false
j.save
@@ -38,32 +34,34 @@ class DialResultsController < ApplicationController
@job_id = params[:id]
@job = DialJob.find(@job_id)
- @dial_data_total = DialResult.find_all_by_dial_job_id(
- @job_id,
- :conditions => [ 'completed = ? and busy = ?', true, false ]
- ).length
+ if(@job.processed)
+ redirect_to :controller => 'analyze', :action => 'view', :id =…
+ return
+ end
- @dial_data_done_set = DialResult.find_all_by_dial_job_id(
- @job_id,
- :conditions => [ 'processed = ?', true]
+ @dial_data_total = DialResult.count(
+ :conditions => [ 'dial_job_id = ? and completed = ?', @job_id,…
+ )
+
+ @dial_data_done = DialResult.count(
+ :conditions => [ 'dial_job_id = ? and processed = ?', @job_id,…
)
- @dial_data_done = @dial_data_done_set.length
@g1 = Ezgraphix::Graphic.new(:c_type => 'col3d', :div_name => 'calls_p…
- @g1.render_options(:caption => 'Detected Lines by Type', :y_name => 'L…
+ @g1.render_options(:caption => 'Detected Lines by Type', :y_name => 'L…
- @g2 = Ezgraphix::Graphic.new(:c_type => 'pie2d', :div_name => 'calls_p…
- @g2.render_options(:caption => 'Analysis Progress')
-
+ ltypes = DialResult.find( :all, :select => 'DISTINCT line_type' ).map{…
res_types = {}
- @dial_data_done_set.each do |r|
- res_types[ r.line_type.capitalize.to_sym ] ||= 0
- res_types[ r.line_type.capitalize.to_sym ] += 1 …
+
+ ltypes.each do |k|
+ next if not k
+ res_types[k.capitalize.to_sym] = DialResult.count(
+ :conditions => ['dial_job_id = ? and line_type = ?', @…
+ )
end
@g1.data = res_types
- @g2.data = {:Remaining => @dial_data_total-@dial_data_done, :Complete …
-
+
@dial_data_todo = DialResult.paginate_all_by_dial_job_id(
@job_id,
:page => params[:page],
@@ -71,11 +69,6 @@ class DialResultsController < ApplicationController
:per_page => 50,
:conditions => [ 'completed = ? and processed = ? and busy = ?…
)
-
- if(@job.processed)
- redirect_to :controller => 'analyze', :action => 'view', :id =…
- return
- end
if(@dial_data_todo.length > 0)
WarVOX::JobManager.schedule(::WarVOX::Jobs::Analysis, @job_id)
@@ -93,38 +86,15 @@ class DialResultsController < ApplicationController
)
if(@dial_results)
- @g1 = Ezgraphix::Graphic.new(:c_type => 'pie2d', :div_name => …
- @g1.render_options(:caption => 'Call Results')
-
- @g2 = Ezgraphix::Graphic.new(:c_type => 'pie2d', :div_name => …
- @g2.render_options(:caption => 'Call Length')
-
- res = {
- :Timeout => 0,
- :Busy => 0,
- :Answered => 0
+ @g1 = Ezgraphix::Graphic.new(:c_type => 'col3d', :div_name => …
+ @g1.render_options(:caption => 'Call Results', :w => 700, :h =…
+
+ @g1.data = {
+ :Timeout => DialResult.count(:conditions =>['dial_job…
+ :Busy => DialResult.count(:conditions =>['dial_job…
+ :Answered => DialResult.count(:conditions =>['dial_job…
}
- sec = {}
-
- @dial_results.each do |r|
- sec[r.seconds] ||= 0
- sec[r.seconds] += 1
-
- if(not r.completed)
- res[:Timeout] += 1
- next
- end
- if(r.busy)
- res[:Busy] += 1
- next
- end
- res[:Answered] += 1
- end
-
- @g1.data = res
- @g2.data = sec
end
-
respond_to do |format|
format.html # index.html.erb
diff --git a/web/app/views/analyze/index.html.erb b/web/app/views/analyze/index…
@@ -16,10 +16,14 @@
<td><%=h dial_job.id %></td>
<td><%=h dial_job.range %></td>
<td><%=h dial_job.cid_mask %></td>
- <td><%=h DialResult.find(:all, :conditions => ['dial_job_id = ? and proces…
+ <td><%=h (
+ DialResult.count(:conditions => ['dial_job_id = ? and processe…
+ "/" +
+ DialResult.count(:conditions => ['dial_job_id = ?', dial_job.i…
+ )%></td>
<td><%=h dial_job.started_at.localtime.strftime("%Y-%m-%d %H:%M:%S %Z") %>…
<td><%= link_to 'View', view_analyze_path(dial_job) %></td>
- <td><%= link_to 'ReProcess', reanalyze_dial_result_path(dial_job), :co…
+ <td><%= link_to 'ReAnalyze', reanalyze_dial_result_path(dial_job), :co…
</tr>
<% end %>
</table>
diff --git a/web/app/views/analyze/view.html.erb b/web/app/views/analyze/view.h…
@@ -3,7 +3,6 @@
<table width='100%' align='center' border=0 cellspacing=0 cellpadding=6>
<tr>
<td align='center'><%= render_ezgraphix @g1 %></td>
- <td align='center'><%= render_ezgraphix @g2 %></td>
</tr>
</table>
diff --git a/web/app/views/dial_results/analyze.html.rb b/web/app/views/dial_re…
@@ -1,15 +1,13 @@
<% if @dial_data_todo.length > 0 %>
<h1 class='title'>
- Analyzing Calls ( completed <%= @dial_data_done %> of <%= @dial_data_t…
- - <%= @dial_data_total-@dial_data_done %> left )...
+ Analyzing Audio for <%= @dial_data_total-@dial_data_done %> of <%= @di…
</h1>
<table width='100%' align='center' border=0 cellspacing=0 cellpadding=6>
<tr>
<% if @dial_data_done > 0 %>
<td align='center'><%= render_ezgraphix @g1 %></td>
- <td align='center'><%= render_ezgraphix @g2 %></td>
<% end %>
</tr>
</table>
diff --git a/web/app/views/dial_results/index.html.erb b/web/app/views/dial_res…
@@ -6,8 +6,8 @@
<th>ID</th>
<th>Range</th>
<th>CID</th>
+ <th>Answered</th>
<th>Time</th>
- <th>Started</th>
</tr>
<% @completed_jobs.sort{|a,b| b.id <=> a.id}.each do |dial_job| %>
@@ -15,7 +15,11 @@
<td><%=h dial_job.id %></td>
<td><%=h dial_job.range %></td>
<td><%=h dial_job.cid_mask %></td>
- <td><%=h dial_job.seconds %></td>
+ <td><%=h (
+ DialResult.count(:conditions => ['dial_job_id = ? and complete…
+ "/" +
+ DialResult.count(:conditions => ['dial_job_id = ?', dial_job.i…
+ )%></td>
<td><%=h dial_job.started_at.localtime.strftime("%Y-%m-%d %H:%M:%S %Z") %>…
<td><%= link_to 'View', view_dial_result_path(dial_job) %></td>
<% if(dial_job.processed) %>
diff --git a/web/app/views/dial_results/view.html.erb b/web/app/views/dial_resu…
@@ -7,7 +7,6 @@
<table width='100%' align='center' border=0 cellspacing=0 cellpadding=6>
<tr>
<td align='center'><%= render_ezgraphix @g1 %></td>
- <td align='center'><%= render_ezgraphix @g2 %></td>
</tr>
</table>
diff --git a/web/app/views/home/about.html.erb b/web/app/views/home/about.html.…
@@ -28,7 +28,7 @@ team can be reached by email at warvox[at]metasploit.com.
<td valign="top" align="right" class="header_item">
Providers:
</td>
- <td><%= Provider.find(:all).length %></td>
+ <td><%= Provider.count %></td>
</tr>
@@ -36,21 +36,21 @@ team can be reached by email at warvox[at]metasploit.com.
<td valign="top" align="right" class="header_item">
Active Jobs:
</td>
- <td><%= DialJob.find_all_by_status('active').length %></td>
+ <td><%= DialJob.count(:conditions => ['status = ?', 'active']) %></td>
</tr>
<tr>
<td valign="top" align="right" class="header_item">
Total Jobs:
</td>
- <td><%= DialJob.find(:all).length %></td>
+ <td><%= DialJob.count %></td>
</tr>
<tr>
<td valign="top" align="right" class="header_item">
Results:
</td>
- <td><%= DialResult.find(:all).length %></td>
+ <td><%= DialResult.count %></td>
</tr>
</table>
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.