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 robin@digi.ninja https://digi.ninja | |
# | |
report = File.open "report.html", "w" | |
screens_files = Dir["screens/*"] | |
report.puts ' <html> | |
<head> | |
<link rel="stylesheet" href="style.css" type="text/css"/> | |
<title>EyeWitness Report</title> | |
</head> | |
<body> | |
<center> | |
<center>Report Generated on ' + Time.now.to_s + '</center> | |
<br><table border="1"> | |
<tr> | |
<th>Web Request Info</th> | |
<th>Web Screenshot</th> | |
</tr> | |
' | |
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 = ' | |
<tr> | |
<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> | |
</tr> | |
' | |
report.puts block | |
else | |
puts "******** MISSING SOURCE***********" | |
puts source_file | |
puts screen_file | |
end | |
end | |
report.puts '</table> | |
</body> | |
</html>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment