Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few fixes and enhancements #1

Merged
merged 3 commits into from
Feb 27, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions EyeWitness.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python

"""
This script's inspiration was Tim Tomes's web screenshotting script PeepingTom
Expand All @@ -15,6 +15,7 @@
import sys
import xml.etree.ElementTree as XMLParser
import urllib2
import cgi
import re
import logging
import subprocess
Expand Down Expand Up @@ -214,8 +215,8 @@ def webHeader():
web_index_head += "<center>Report Generated on " + report_date + " at " + report_time
web_index_head += "<br><table border=\"1\">\n"
web_index_head += "<tr>\n"
web_index_head += "<th>Web Screenshot</th>\n"
web_index_head += "<th>Web Request Info</th>\n"
web_index_head += "<th>Web Screenshot</th>\n"
web_index_head += "</tr>\n"
return web_index_head

Expand All @@ -229,6 +230,10 @@ def fileNames(url_given):
src_name = pic_name + ".txt"
pic_name = pic_name + ".png"
return url_given, src_name, pic_name

def htmlEncode(dangerous_data):
encoded = cgi.escape(dangerous_data, quote=True)
return encoded

if __name__ == "__main__":

Expand Down Expand Up @@ -302,7 +307,7 @@ def fileNames(url_given):

try:
for key, value in page.headers.items():
web_index += "\n<br><b> " + key.replace("u\'", "") + ":</b> " + value
web_index += "\n<br><b> " + htmlEncode(key.replace("u\'", "")) + ":</b> " + htmlEncode(value)

except AttributeError:
web_index += "\n<br><br>Potential blank page or SSL issue with <a href=\"" + url + "\" target=\"_blank\">" + url + "</a>."
Expand Down Expand Up @@ -406,4 +411,4 @@ def fileNames(url_given):
page_append.write(link_text)
page_append.close()

print "\n[*] Done! Check out the report in the " + report_folder + " folder!"
print "\n[*] Done! Check out the report in the " + report_folder + " folder!"