diff --git a/lib/wraith/gallery.rb b/lib/wraith/gallery.rb index b764dc9a..1b90e974 100755 --- a/lib/wraith/gallery.rb +++ b/lib/wraith/gallery.rb @@ -153,7 +153,10 @@ def generate_html(location, directories, template, destination, path) :location => location, :directories => directories, :path => path, - :threshold => wraith.threshold + :threshold => wraith.threshold, + :wraith => wraith, + :config => wraith.config, + :version => Wraith::VERSION } html = ERB.new(template).result(ErbBinding.new(locals).get_binding) File.open(destination, "w") do |outf| diff --git a/lib/wraith/gallery_template/advanced_template.erb b/lib/wraith/gallery_template/advanced_template.erb new file mode 100644 index 00000000..2a44119b --- /dev/null +++ b/lib/wraith/gallery_template/advanced_template.erb @@ -0,0 +1,732 @@ + + + + + + + + Wraith // Gallery + + + + + + + + + + + + + + + + + + + + + + +<% + # Count pages + totalPagesCount = 0 + failedPagesCount = 0 + warningPagesCount = 0 + passedPagesCount = 0 + + directories.each do |dir, sizes| + sizes.to_a.sort.each do |size, files| + totalPagesCount += 1 + if files[:data] > threshold + failedPagesCount += 1 + else + if files[:data] < threshold and files[:data] != 0 + warningPagesCount += 1 + else + passedPagesCount += 1 + end + end + end + end + + # Progress bar + percentFailed = failedPagesCount.to_f / totalPagesCount * 100 + percentWarning = warningPagesCount.to_f / totalPagesCount * 100 + percentPassed = passedPagesCount.to_f / totalPagesCount * 100 + + # Status label + statusLabel = '' + + if failedPagesCount > 0 + statusLabel = 'label-danger' + statusText = 'Failed' + else if warningPagesCount > 0 + statusLabel = 'label-warning' + statusText = 'Warning' + else + statusLabel = 'label-success' + statusText = 'Passed' + end + end +%> + +
+ + + + + + +
+ +
+

+ Overview + <%=config['directory']%> +

+
+ +
+ + +
+ + +
+
+
+
+ +

Project Configuration

+
+ +
+
+ +
+
+
Domains
+ <% config['domains'].each do |domain| %> +
<%=domain[1]%>
+ <% end %> +
Directory
+
<%=config['directory']%>
+
Generated
+
<%=Time.now.strftime('%Y/%m/%d %H:%M:%S')%>
+
Threshold
+
<%=config['threshold']%>%
+
Fuzz
+
<%=config['fuzz']%>
+
Resolution
+
<%=config['screen_widths']%>
+
Spider Skips
+
<%=config['spider_skips'] ? config['spider_skips'] : '-'%>
+
Before Capture
+
<%=config['before_capture'] ? config['before_capture'] : '-'%>
+
Browser
+
<%=config['browser']%>
+
Status
+
<%=statusText%>
+
+
+ +
+ +
+
+
+
+
+ +
+ Passed + <%=passedPagesCount%> / <%=totalPagesCount%> +
+
+
+ <%=percentPassed.round%>% +
+
+
+ +
+ Warning + <%=warningPagesCount%> / <%=totalPagesCount%> +
+
+
+ <%=percentWarning.round%>% +
+
+
+ +
+ Failed + <%=failedPagesCount%> / <%=totalPagesCount%> +
+
+
+ <%=percentFailed.round%>% +
+
+
+ +
+ + + +
+
+ Passed <%=percentPassed.round%>% +
+
+ Warning <%=percentWarning.round%>% +
+
+ Failed <%=percentFailed.round%>% +
+
+ + +
+ + + +
+ + + +
+ + +
+
+
+ +

Pages

+
+ +
+
+
+ +
+
+
+ + + + + + +
+
+ + +
+ + +
+ + Wraith +
+ + +
+ + +
+ + + + + + + + + + + \ No newline at end of file