WASEProxy.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:WASE 作者: thomaspatzke 项目源码 文件源码
def mitm_request(self, data):
    # Initialize ES connection and index
    res = connections.create_connection(hosts=[args.elasticsearch])
    idx = Index(args.index)
    idx.doc_type(DocHTTPRequestResponse)
    try:
        DocHTTPRequestResponse.init()
        idx.create()
    except:
        pass

        r = HTTPRequest(data)

        # determine url
        if self.is_connect:
            scheme = "https"
        else:
            scheme = "http"
        url = scheme + "://" + self.hostname
        if scheme == "http" and int(self.port) != 80 or scheme == "https" and int(self.port) != 443:
            url += ":" + str(self.port)
        url += self.path

        if args.verbose:
            print(url)

        self.doc = DocHTTPRequestResponse(host=self.hostname, port=int(self.port), protocol=scheme)
        self.doc.meta.index = args.index
        self.doc.request.url = url
        self.doc.request.requestline = r.requestline
        self.doc.request.method = r.command
        self.doc.host = self.hostname
        self.doc.port = int(self.port)
        self.doc.protocol = scheme

        return data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号