main.py 文件源码

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

项目:honeypot 作者: fabio-d 项目源码 文件源码
def handle_tcp_default(sk, dstport):
    # Attempt to guess protocol according to what the client sends
    data = ''
    try:
        rlist, _, _ = select.select([sk], [], [], 30)
        if len(rlist) != 0:
            data = sk.recv(20, socket.MSG_PEEK)
    except Exception as err:
        #print(traceback.format_exc())
        pass

    if data[:3] in SSL_CLIENT_HELLO_SIGNATURES:
        print colored("Guessing this is a SSL/TLS connection, attempting to handshake.", 'red', attrs=['bold'])
        handle_tcp_hexdump_ssl(sk, dstport)
    elif data.startswith("GET "):
        handle_tcp_http(sk, dstport)
    elif data.startswith("CONNECT "):
        handle_tcp_httpproxy(sk, dstport)
    else:
        handle_tcp_hexdump(sk, dstport)
    sk.close()

# UDP DISPATCHER
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号