Permalink
Browse files

improve report editor, add report sample, misc cleanup

  • Loading branch information...
1 parent 0db18bb commit 6c14c5128672c8871b8e4860a57a2d93382efceb @mhils committed Dec 30, 2012
@@ -1,4 +1,5 @@
.reportOutput {
+ overflow: auto;
width: 100%;
height: 100%;
padding: 15px;
View
Oops, something went wrong.
View
@@ -15,23 +15,19 @@
<body class="claro">
<div id="appLayout">
</div>
-
- <div id=reportPane>
- reportpane
- </div>
- <div id=tutorial>
- <h1>Quick start</h1>
- <ul>
- <li><h2>Set up your HTTP proxy settings:</h2>
- <b>Host: </b><span id=tutorial-proxy-addr>IP</span><br>
- <b>Port: </b><span id=tutorial-proxy-port>PORT</span>
- <li><h2>Set up SSL interception if required</h2>
- Follow the steps from the <a href="http://mitmproxy.org/doc/ssl.html">mitmproxy docs</a>. All certificates are stored in the "ca-cert" subdirectory of your HoneyProxy installation.
- <li><h2>Give Feedback!</h2>
- HoneyProxy is still in an early stage. Getting some feedback from you would be awesome. <a href="https://github.com/mhils/HoneyProxy">Thanks!</a>
- </ul>
- </div>
+<div id=tutorial>
+ <h1>Quick start</h1>
+ <ul>
+ <li><h2>Set up your HTTP proxy settings:</h2>
+ <b>Host: </b><span id=tutorial-proxy-addr>IP</span><br>
+ <b>Port: </b><span id=tutorial-proxy-port>PORT</span>
+ <li><h2>Set up SSL interception if required</h2>
+ Follow the steps from the <a href="http://mitmproxy.org/doc/ssl.html">mitmproxy docs</a>. All certificates are stored in the "ca-cert" subdirectory of your HoneyProxy installation.
+ <li><h2>Give Feedback!</h2>
+ HoneyProxy is still in an early stage. Getting some feedback from you would be awesome. <a href="https://github.com/mhils/HoneyProxy">Thanks!</a>
+ </ul>
+</div>
<script src="./js/lib/closure-library/closure/goog/base.js"></script>
<script>
@@ -64,6 +64,7 @@ define([ "lodash",
self.codeMirror = CodeMirror.fromTextArea(self.reportCodeNode, {
lineNumbers: true,
mode: "javascript",
+ tabSize: 2,
matchBrackets: true,
extraKeys: {
"Enter": "newlineAndIndentContinueComment",
@@ -40,8 +40,8 @@
}
} while (level > 0);
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
- if (tprop.type.indexOf('variable') == 0)
- tprop.type = 'function';
+ if (tprop.type.indexOf("variable") === 0)
+ tprop.type = "function";
else return; // no clue
}
if (!context) var context = [];
@@ -106,7 +106,7 @@
// If this is a property, see if it belongs to some object we can
// find in the current environment.
var obj = context.pop(), base;
- if (obj.type.indexOf("variable") == 0) {
+ if (obj.type.indexOf("variable") === 0) {
if (options && options.additionalContext)
base = options.additionalContext[obj.string];
base = base || window[obj.string];
@@ -0,0 +1,35 @@
+require([
+ "dojo/dom-construct",
+ "dojo/promise/all"
+], function(domConstruct, all) {
+
+ //filter all requests for POST requests with request content
+ var requests = traffic.filter(function(flow){
+ return flow.request.method === "POST" && flow.request.hasFormData;
+ });
+
+ console.log("Matched requests: "+requests.length+" of "+traffic.length);
+
+ var data = {}; //Contains all POST data.
+ var promises = []; //getFormData() returns a [dojo] promise.
+ //this array collects all promises to trigger the result
+ //output as soon as they are ready.
+
+ //Iterate over all
+ _.each(requests,function(flow){
+ promises.push(
+ flow.request.getFormData().then(function(formData){
+ if(!(flow.request.fullPath in data))
+ data[flow.request.fullPath] = [];
+ data[flow.request.fullPath].push(formData);
+ })
+ );
+ });
+
+ all(promises).then(function(){
+ var pre = domConstruct.create("pre",{},outNode,"only");
+ pre.innerText = JSON.stringify(data,null,"\t");
+ });
+
+
+});
@@ -16,11 +16,11 @@ require([
});
var trafficPerHost = {};
- traffic.each(function(t){
- var host = t.request.host;
+ traffic.each(function(flow){
+ var host = flow.request.host;
if(!(host in trafficPerHost))
trafficPerHost[host] = {y:0,text:"",count:0};
- trafficPerHost[host]["y"] += t.request.contentLength + t.response.contentLength;
+ trafficPerHost[host]["y"] += flow.request.contentLength + flow.response.contentLength;
trafficPerHost[host]["count"] += 1;
});
var data = [];

0 comments on commit 6c14c51

Please sign in to comment.