bigsnitch/mitmaddon/bigsnitch.py
2021-04-26 01:24:08 +02:00

59 lines
1.7 KiB
Python

#!/usr/bin/env python3
#
import pdb
from queue import Queue, Empty
from networkthread import bFlowState, FlowItem, NetworkThread
class BigSnitchBridge:
def __init__(self):
print("BigSnitchBridge started")
self.q = Queue()
#self.thread = NetworkThread("network", self.q)
#self.thread.start()
def request(self, flow):
pdb.set_trace()
flowitem = FlowItem(bFlowState.UNSENT_HTTP_REQUEST, flow)
self.q.put_nowait((flow.id, flowitem))
# intercept until ACK received
flow.intercept()
def response(self, flow):
flowitem = FlowItem(bFlowState.UNSENT_HTTP_RESPONSE, flow)
self.q.put_nowait((flow.id, flowitem))
# intercept until ACK received
flow.intercept()
def error(self, flow):
flowitem = FlowItem(bFlowState.ERROR, flow, time.monotonic())
self.q.put_nowait((flow.id, flowitem))
"""
def requestheaders(self, flow):
self.q.put({'msg': 'requestheaders', 'flow': flow.get_state()})
def responseheaders(self, flow):
self.q.put({'msg': 'responseheaders', 'flow': flow.get_state()})
def websocket_handshake(self):
self.q.put({'msg': 'websocket_handshake', 'flow': flow.get_state()})
def websocket_start(self, flow):
self.q.put({'msg': 'websocket_start', 'flow': flow.get_state()})
def websocket_message(self, flow):
self.q.put({'msg': 'websocket_message', 'flow': flow.get_state()})
def websocket_error(self, flow):
self.q.put({'msg': 'websocket_error', 'flow': flow.get_state()})
def websocket_end(self, flow):
self.q.put({'msg': 'websocket_end', 'flow': flow.get_state()})
"""
addons = [
BigSnitchBridge()
]