site inspector, hotlinking page

This commit is contained in:
Kyle Drake 2015-12-29 20:26:00 -06:00
parent 71fabef58f
commit d86f614248
3 changed files with 108 additions and 0 deletions

57
views/admin/site.erb Normal file
View file

@ -0,0 +1,57 @@
<div class="header-Outro">
<div class="row content single-Col">
<h1>Site Inspector</h1>
<h2 class="subtitle"><%= @site.username %></h2>
</div>
</div>
<div class="content misc-page single-Col txt-Center" style="padding-top: 20px;">
<h3>Site Pages</h3>
<table>
<% @site.site_files_dataset.where(path: /\.html/).all.each do |site_file| %>
<tr style="outline: thin solid black;">
<td><img src="<%= @site.screenshot_url(site_file.path, '210x158') %>"></td>
<td>
<p><strong><%= site_file.path %></strong></p>
<% if !site_file.classifier.blank? %>
<p>
<% if site_file.classifier == 'ham' %>
<span style="color: green"><%= site_file.classifier %></span>
<% else %>
<span style="color: red"><strong><%= site_file.classifier %></strong></span>
<% end %>
</p>
<% else %>
<p>Not Classified</p>
<% end %>
<form action="/admin/site_files/train" target="_blank" method="POST">
<%== csrf_token_input_html %>
<input type="hidden" name="site_id" value="<%= @site.id %>">
<input type="hidden" name="path" value="<%= site_file.path %>">
<input type="hidden" name="classifier" value="ham">
<button>Ham</button>
</form>
<form action="/admin/site_files/train" target="_blank" method="POST" onsubmit="return confirm('Confirm spam train of <%= "#{@site.username}/#{site_file.path}" %>');">
<%== csrf_token_input_html %>
<input type="hidden" name="site_id" value="<%= @site.id %>">
<input type="hidden" name="path" value="<%= site_file.path %>">
<input type="hidden" name="classifier" value="spam">
<button>Spam</button>
</form>
<form action="/admin/site_files/train" target="_blank" method="POST" onsubmit="return confirm('Confirm phishing train of <%= "#{@site.username}/#{site_file.path}" %>');">
<%== csrf_token_input_html %>
<input type="hidden" name="site_id" value="<%= @site.id %>">
<input type="hidden" name="path" value="<%= site_file.path %>">
<input type="hidden" name="classifier" value="phishing">
<button>Phishing</button>
</form>
</td>
</tr>
<% end %>
</table>
</div>