Skip to content

Instantly share code, notes, and snippets.

Created May 28, 2015 11:30
What would you like to do?
Generate a report from a crashed Eyewitness run
#!/usr/bin/env ruby
# Pick up a crashed Eyewitness session and generate a report from it.
# Robin Wood
report = "report.html", "w"
screens_files = Dir["screens/*"]
report.puts ' <html>
<link rel="stylesheet" href="style.css" type="text/css"/>
<title>EyeWitness Report</title>
<center>Report Generated on ' + + '</center>
<br><table border="1">
<th>Web Request Info</th>
<th>Web Screenshot</th>
screens_files.each do |screen_file|
source_file = screen_file.sub(/\.png/, ".txt")
source_file.sub!(/^screens/, "source")
full_url = screen_file.sub(/^screens\//, "").sub(/\.png$/,"").sub(/\.(80|443)$/, ":\\1")
full_url.sub!(/^(http|https)\./, "\\1://")
if File.exists?(source_file)
block = '
<td><div style="display: inline-block; width: 300px; word-wrap: break-word">
<a href="' + full_url + '" target="_blank">'+full_url + '</a><br>
<!--<br><b> Page Title:</b> Problem loading page -->
<br><br><a href="' + source_file + '"target="_blank">Source Code</a></div></td>
<td><div id="screenshot" style="display: inline-block; width:850px; height 400px; overflow: scroll;"><a href="' + screen_file + '" target="_blank"><img src="' + screen_file + '" height="400"></a></div></td>
report.puts block
puts "******** MISSING SOURCE***********"
puts source_file
puts screen_file
report.puts '</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment