Browse files

display request and response checksums. fixes #32

  • Loading branch information...
1 parent 5ccea81 commit 4321bb23bb2b45298c560162cb59f7b09aacb6a7 @mhils committed Sep 17, 2012
View
3 gui/js/HoneyProxy/models/sharedFlowProperties.js
@@ -16,6 +16,9 @@ define([],function(){
get contentLength() {
return this.data.contentLength;
},
+ get contentChecksums() {
+ return this.data.contentChecksums;
+ },
get hasContent() {
return this.contentLength > 0;
},
View
2 gui/js/HoneyProxy/search.js
@@ -83,7 +83,7 @@ define(["./traffic"],function(traffic){
traffic.each(handleFlow);
else
_.each(ids,function(id){
- handleFlow(DumpManager.get(id));
+ handleFlow(traffic.get(id));
})
}
/**
View
17 gui/js/HoneyProxy/templates/details.ejs
@@ -6,6 +6,16 @@
Request Method: <%- request.method %><br>
Status Code: <%- response.code %><br>
+ <%
+ function printChecksums(r){
+ var intro = 'Checksums';
+ for(var algo in r.contentChecksums) {
+ print('<tr><td>'+intro+'</td><td>'+algo+': '+r.contentChecksums[algo]+'</td></tr>');
+ intro = '';
+ }
+ }
+ %>
+
<table class=headers>
<tr><td colspan=2><b>Request Headers:</b></td></tr>
<%
@@ -34,9 +44,11 @@
} else if(request.hasPayload) {
print("<tr><td colspan=2><b>Request Payload:</b></td></tr>");
+
}
if(request.hasContent) {
print('<tr><td></td><td><a class="button-download button-request-payload" href="'+request.downloadUrl+'">Download ('+request.contentLengthFormatted+')</a></td></tr>');
+ printChecksums(request);
}
%>
<tr><td colspan=2><b>Response Headers:</b></td></tr>
@@ -51,6 +63,11 @@
<%
}
%>
+ <% if(response.hasContent) { %>
+ <tr><td colspan=2><b>Response Data:</b></td></tr>
+ <tr><td>Size</td><td><%- response.contentLengthFormatted %></td></tr>
+ <% printChecksums(response); %>
+ <% } %>
</table>
<% if(response.cert) { %>
<b>Server certificate:</b>
View
5 gui/js/lib/modernizr.js
@@ -1,8 +1,7 @@
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
- * Build: http://modernizr.com/download/#-flexboxlegacy-cssgradients-websockets-prefixes-domprefixes
+ * Build: http://modernizr.com/download/#-flexboxlegacy-cssgradients-websockets-testprop-testallprops-prefixes-domprefixes
*/
-;window.Modernizr=function(a,b,c){function x(a){i.cssText=a}function y(a,b){return x(l.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}var d="2.6.2",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l=" -webkit- -moz- -o- -ms- ".split(" "),m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e}),p.flexboxlegacy=function(){return testPropsAll("boxDirection")},p.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},p.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return x((a+"-webkit- ".split(" ").join(b+a)+l.join(c+a)).slice(0,-a.length)),A(i.backgroundImage,"gradient")};for(var C in p)w(p,C)&&(u=C.toLowerCase(),e[u]=p[C](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof enableClasses!="undefined"&&enableClasses&&(f.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),h=j=null,e._version=d,e._prefixes=l,e._domPrefixes=o,e._cssomPrefixes=n,e}(this,this.document);
-
+;window.Modernizr=function(a,b,c){function x(a){i.cssText=a}function y(a,b){return x(l.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&i[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.6.2",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l=" -webkit- -moz- -o- -ms- ".split(" "),m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e}),p.flexboxlegacy=function(){return D("boxDirection")},p.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},p.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return x((a+"-webkit- ".split(" ").join(b+a)+l.join(c+a)).slice(0,-a.length)),A(i.backgroundImage,"gradient")};for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof enableClasses!="undefined"&&enableClasses&&(f.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),h=j=null,e._version=d,e._prefixes=l,e._domPrefixes=o,e._cssomPrefixes=n,e.testProp=function(a){return B([a])},e.testAllProps=D,e}(this,this.document);
var features = ["websockets","flexboxlegacy","cssgradients"];
var i = features.length;
View
14 libhproxy/flowcollection.py
@@ -1,6 +1,6 @@
from libmproxy import encoding
from libhproxy.honey import HoneyProxy
-import re, json, socket
+import re, socket, hashlib
class FlowCollection:
"""
@@ -49,7 +49,8 @@ def addFlow(self, flow):
import traceback
print traceback.format_exc()
-
+
+ #Save decoded content
decoded_content = {}
for i in ["request","response"]:
#strip content out of the flowRepr
@@ -85,6 +86,15 @@ def addFlow(self, flow):
decoded_content[i] = decoded
+ #calculate hashsums
+ algorithms = ["md5","sha256"]
+ for i in ["request","response"]:
+ checksums = {}
+ for a in algorithms:
+ checksums[a] = getattr(hashlib,a)(decoded_content[i]).hexdigest()
+ flowRepr[i]["contentChecksums"] = checksums
+
+
self._flows.append(flow)
self._flows_serialized.append(flowRepr)
self._decoded_contents.append(decoded_content)

0 comments on commit 4321bb2

Please sign in to comment.