-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add quick start tutorial if no traffic has been recorded yet.
Add firstflow event Minor cleanups
- Loading branch information
Showing
5 changed files
with
82 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
$(function(){ | ||
|
||
HoneyProxy.on("firstflow",function(){ | ||
$("#tutorial").hide(); | ||
}); | ||
|
||
HoneyProxy.on("configLoaded",function(){ | ||
var addr = HoneyProxy.config.get("proxy-addr"); | ||
if(addr==="") | ||
addr = "HoneyProxy listens on all your network interfaces, choose one (most times localhost)"; | ||
$("#tutorial-proxy-addr").text(addr); | ||
$("#tutorial-proxy-port").text(HoneyProxy.config.get("proxy-port")); | ||
}); | ||
|
||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,27 @@ | ||
class FlowCollection: | ||
def __init__(self): | ||
self._flows_serialized = [] | ||
self._flows = [] | ||
|
||
def getLastFlow(self): | ||
return self._flows_serialized[-1] | ||
|
||
def getFlow(self,flowId): | ||
return self._flows[flowId] | ||
|
||
def getFlowsSerialized(self): | ||
return self._flows_serialized | ||
|
||
def addFlow(self, flow): | ||
flowRepr = flow._get_state() | ||
flowRepr["id"] = len(self._flows_serialized) | ||
|
||
#remove content out of the flowRepr | ||
for i in ["request","response"]: | ||
flowRepr[i]["contentLength"] = len(flowRepr[i]["content"]) | ||
del flowRepr[i]["content"] | ||
|
||
#store unencoded | ||
#from libmproxy import encoding | ||
#enc = flow.response.headers.get("content-encoding") | ||
#if enc and enc[0] != "identity": | ||
# decoded = encoding.decode(enc[0], content) | ||
# if decoded: | ||
# content = decoded | ||
|
||
self._flows.append(flow) | ||
self._flows_serialized.append(flowRepr) | ||
return len(self._flows_serialized)-1 | ||
|
||
class FlowCollection: | ||
def __init__(self): | ||
self._flows_serialized = [] | ||
self._flows = [] | ||
|
||
def getLastFlow(self): | ||
return self._flows_serialized[-1] | ||
|
||
def getFlow(self,flowId): | ||
return self._flows[flowId] | ||
|
||
def getFlowsSerialized(self): | ||
return self._flows_serialized | ||
|
||
def addFlow(self, flow): | ||
flowRepr = flow._get_state() | ||
flowRepr["id"] = len(self._flows_serialized) | ||
|
||
#remove content out of the flowRepr | ||
for i in ["request","response"]: | ||
flowRepr[i]["contentLength"] = len(flowRepr[i]["content"]) | ||
del flowRepr[i]["content"] | ||
|
||
self._flows.append(flow) | ||
self._flows_serialized.append(flowRepr) | ||
return len(self._flows_serialized)-1 | ||
|