| Add matching - warvox - VoIP based wardialing tool, forked from rapid7/warvox. | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit efec78a965e0462c2d4463a976a53b9f36c5ccb5 | |
| parent 1c72c5640233622b887af0192605704f9f4d7b61 | |
| Author: HD Moore <[email protected]> | |
| Date: Thu, 4 Aug 2011 19:37:10 +0000 | |
| Add matching | |
| Diffstat: | |
| M web/app/controllers/analyze_contro… | 7 +++++++ | |
| M web/app/helpers/analyze_helper.rb | 20 ++++++++++++++++++++ | |
| M web/app/models/dial_result.rb | 6 ++++-- | |
| M web/app/views/analyze/view.html.erb | 5 ++++- | |
| A web/app/views/analyze/view_matches… | 108 +++++++++++++++++++++++++++… | |
| 5 files changed, 143 insertions(+), 3 deletions(-) | |
| --- | |
| diff --git a/web/app/controllers/analyze_controller.rb b/web/app/controllers/an… | |
| @@ -137,5 +137,12 @@ class AnalyzeController < ApplicationController | |
| send_data(cdata, :type => ctype, :disposition => 'inline') | |
| end | |
| + | |
| + | |
| + def view_matches | |
| + @result = DialResult.find(params[:dial_result_id]) | |
| + @job_id = @result.dial_job_id | |
| + @results = @result.matches.select{|x| x.matchscore.to_f > 10.0 } | |
| + end | |
| end | |
| diff --git a/web/app/helpers/analyze_helper.rb b/web/app/helpers/analyze_helper… | |
| @@ -1,2 +1,22 @@ | |
| module AnalyzeHelper | |
| + | |
| + | |
| +def fwd_match_html(pct) | |
| + %Q|<span class="fwd_match_span" style='padding-right: 150px; border: 1… | |
| + | |
| + #{"%.3f" % pct.to_f}% Match | |
| + | |
| + </span> | |
| + | |
| + | | |
| +end | |
| + | |
| +def rev_match_html(pct) | |
| + %Q|<span class="rev_match_span" style='padding-left: #{ (pct.to_i * 2)… | |
| +end | |
| + | |
| +def pct_to_color(pct) | |
| + "#" + "80" + (pct.to_i * 2.55).to_i.to_s(16).rjust(2, "0") + "80" | |
| +end | |
| + | |
| end | |
| diff --git a/web/app/models/dial_result.rb b/web/app/models/dial_result.rb | |
| @@ -8,14 +8,16 @@ class DialResult < ActiveRecord::Base | |
| ' (( icount(\'#{fprint}\'::int[] & dial_results.fprint:… | |
| 'FROM dial_results ' + | |
| 'WHERE icount(dial_results.fprint) > 0 AND ' + | |
| - 'dial_results.dial_job_id = \'#{dial_job_id}\' ' + | |
| + 'dial_results.dial_job_id = \'#{dial_job_id}\' AND ' + | |
| + 'dial_results.id != \'#{id}\' ' + | |
| 'ORDER BY matchscore DESC' | |
| has_many :matches_all_jobs, :class_name => 'DialResult', :finder_sql => | |
| 'SELECT dial_results.*, ' + | |
| ' (( icount(\'#{fprint}\'::int[] & dial_results.fprint:… | |
| 'FROM dial_results ' + | |
| - 'WHERE icount(dial_results.fprint) > 0 ' + | |
| + 'WHERE icount(dial_results.fprint) > 0 AND ' + | |
| + 'dial_results.id != \'#{id}\' ' + | |
| 'ORDER BY matchscore DESC' | |
| end | |
| diff --git a/web/app/views/analyze/view.html.erb b/web/app/views/analyze/view.h… | |
| @@ -53,7 +53,10 @@ | |
| col = ("%.2x" % (255 - str)) * 3 | |
| %> | |
| <div style="color: #<%= col%>;"><%=h name%> (<%=h sid … | |
| - <% end %> | |
| + <% end %> | |
| + <% if dial_result.fprint %> | |
| + <a href="<%=view_matches_path(dial_result.id)%>">View … | |
| + <% end %> | |
| </td> | |
| </tr> | |
| <% end %> | |
| diff --git a/web/app/views/analyze/view_matches.html.erb b/web/app/views/analyz… | |
| @@ -0,0 +1,108 @@ | |
| +<% dial_result = @result %> | |
| + | |
| +<h1 class='title'><%= @result.number %> (<a href="<%=view_analyze_path(dial_re… | |
| +<table class='table_scaffold' width='100%'> | |
| + <tr> | |
| + <th>Number</th> | |
| + <th>Signal</th> | |
| + </tr> | |
| + | |
| + | |
| + <tr> | |
| + <td align='center'> | |
| + | |
| + <object | |
| + type="application/x-shockwave-flash" | |
| + data="/images/musicplayer.swf?song_url=<%=resource_ana… | |
| + width="20" | |
| + height="17" | |
| + style="margin-bottom: -5px;" | |
| + > | |
| + <param name="movie" value="/musicplayer.swf?song_url=<… | |
| + <param name="wmode" value="transparent"></param> | |
| + </object> | |
| + | |
| + <b><%= dial_result.number %></b> | |
| + <hr width='100%' size='1'/> | |
| + CallerID: <%= dial_result.cid%><br/> | |
| + Provider: <%=h dial_result.provider.name %><br/> | |
| + Audio: <%=h dial_result.seconds %> Seconds<br/> | |
| + Ringer: <%=h dial_result.ringtime %> Seconds<br/> | |
| + <% if(dial_result.dtmf and dial_result.dtmf.length > 0) %> | |
| + DTMF: <%=h dial_result.dtmf %><br/> | |
| + <% end %> | |
| + <% if(dial_result.mf and dial_result.mf.length > 0) %> | |
| + MF: <%=h dial_result.mf %><br/> | |
| + <% end %> | |
| + </td> | |
| + <td align='center'> | |
| + <b><%=h dial_result.line_type.upcase %></b><br/> | |
| + <a href="<%=resource_analyze_path(@job_id, dial_result.id, "bi… | |
| + <a href="<%=resource_analyze_path(@job_id, dial_result.id, "bi… | |
| + <% (dial_result.signatures||"").split("\n").each do |s| | |
| + sid,mat,name = s.split(':', 3) | |
| + str = [mat.to_i * 6.4, 255].min | |
| + col = ("%.2x" % (255 - str)) * 3 | |
| + %> | |
| + <div style="color: #<%= col%>;"><%=h name%> (<%=h sid … | |
| + <% end %> | |
| + </td> | |
| + </tr> | |
| +</table><br/><br/> | |
| + | |
| +<h1 class='title'>Matches for <%= @result.number %></h1> | |
| + | |
| +<table class='table_scaffold' width='100%'> | |
| + <tr> | |
| + <th>Number</th> | |
| + <th>Signal</th> | |
| + </tr> | |
| + | |
| +<% @results.each do |dial_result| %> | |
| + <tr> | |
| + <td align='center'> | |
| + | |
| + <br/><%= raw(fwd_match_html(dial_result.matchscore)) %><br/><b… | |
| + | |
| + <object | |
| + type="application/x-shockwave-flash" | |
| + data="/images/musicplayer.swf?song_url=<%=resource_ana… | |
| + width="20" | |
| + height="17" | |
| + style="margin-bottom: -5px;" | |
| + > | |
| + <param name="movie" value="/musicplayer.swf?song_url=<… | |
| + <param name="wmode" value="transparent"></param> | |
| + </object> | |
| + | |
| + <b><%= dial_result.number %></b> | |
| + <hr width='100%' size='1'/> | |
| + CallerID: <%= dial_result.cid%><br/> | |
| + Provider: <%=h dial_result.provider.name %><br/> | |
| + Audio: <%=h dial_result.seconds %> Seconds<br/> | |
| + Ringer: <%=h dial_result.ringtime %> Seconds<br/> | |
| + <% if(dial_result.dtmf and dial_result.dtmf.length > 0) %> | |
| + DTMF: <%=h dial_result.dtmf %><br/> | |
| + <% end %> | |
| + <% if(dial_result.mf and dial_result.mf.length > 0) %> | |
| + MF: <%=h dial_result.mf %><br/> | |
| + <% end %> | |
| + </td> | |
| + <td align='center'> | |
| + <b><%=h dial_result.line_type.upcase %></b><br/> | |
| + <a href="<%=resource_analyze_path(@job_id, dial_result.id, "bi… | |
| + <a href="<%=resource_analyze_path(@job_id, dial_result.id, "bi… | |
| + <% (dial_result.signatures||"").split("\n").each do |s| | |
| + sid,mat,name = s.split(':', 3) | |
| + str = [mat.to_i * 6.4, 255].min | |
| + col = ("%.2x" % (255 - str)) * 3 | |
| + %> | |
| + <div style="color: #<%= col%>;"><%=h name%> (<%=h sid … | |
| + <% end %> | |
| + <% if dial_result.fprint %> | |
| + <a href="<%=view_matches_path(dial_result.id)%>">View … | |
| + <% end %> | |
| + </td> | |
| + </tr> | |
| +<% end %> | |
| +</table> |