通过python的代理服务器不会捕获所有发出的请求

时间:2016-12-24 10:10:15

标签: python multithreading sockets server

我创建了一个绑定并侦听某个端口的python服务器,使用端口转发将android连接到所述端口并监视捕获的请求。然而,在将捕获物交叉检查到Fiddler时,它显示了几个未经检查的请求。

服务器 -

import socket
import _thread
import sys

ip = '192.168.1.2'
listening_port = 8888

max_conn = 5
buffer_size = 65536

def start():
    try:
        s = socket.socket(socket.AF_INET , socket.SOCK_STREAM)
        s.bind((ip , listening_port))
        s.listen(max_conn)

        print('Initializing Socket..Done')
        print('Sockets bound successfully')
        print('Server Started..')

    except:
        print('Unable To Initialize')
        sys.exit()

    while True:
        try:
            conn , addr = s.accept()
            _thread.start_new_thread(conn_string , (conn,addr))

        except KeyboardInterrupt:
            print('Proxy Shutting Down')
            sys.exit()

    s.close()

def conn_string(conn,addr):

    data = conn.recv(buffer_size)

    port = addr[1]
    print('Receiving form Port - ' , port)

    print(data)
    print('--'*20)

start()

0 个答案:

没有答案