# Path: lib/settings.py
# CONF_PATH = os.path.join(ROOT, 'conf/')
# 
# Path: lib/redisopt.py
# def get_hash(host, uri, postdata):
# def content_deal(headers, host, method, postdata, uri, packet):
# 
# Path: lib/config.py
# def load():
# def update(conf):
# def load_rule():
# def update_rule(rule):
# def rule_read(name, get_file_handle=None):
# def rule_write(name, rule):


import re
import ssl
import socket
import warnings
import requests
import threading
from lib.settings import CONF_PATH
from lib.redisopt import conn, content_deal
from lib import config
#!/usr/bin/env python
#coding: utf-8



warnings.filterwarnings("ignore")

"""
Mix proxy with HTTP and HTTPS.
Use local key file and cert file to get https flow.
If there is a "connect" method first, then https it is.
Else it's a http packet.
Request to remote server with python requests lib.
Put requests into redis server to scan.
Black_domain and black_ext had wroten into this script.
White_domain are loaded from white_domain.conf split by "," in one line!
"""


def https_things(sock):
    context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)

# Path: lib/settings.py
# CONF_PATH = os.path.join(ROOT, 'conf/')
# 
# Path: lib/redisopt.py
# def get_hash(host, uri, postdata):
# def content_deal(headers, host, method, postdata, uri, packet):
# 
# Path: lib/config.py
# def load():
# def update(conf):
# def load_rule():
# def update_rule(rule):
# def rule_read(name, get_file_handle=None):
# def rule_write(name, rule):


# Path: proxy/mix_proxy.py
import re
import ssl
import socket
import warnings
import requests
import threading
from lib.settings import CONF_PATH
from lib.redisopt import conn, content_deal
from lib import config

#!/usr/bin/env python
#coding: utf-8



warnings.filterwarnings("ignore")

"""
Mix proxy with HTTP and HTTPS.
Use local key file and cert file to get https flow.
If there is a "connect" method first, then https it is.
Else it's a http packet.
Request to remote server with python requests lib.
Put requests into redis server to scan.
Black_domain and black_ext had wroten into this script.
White_domain are loaded from white_domain.conf split by "," in one line!
"""


def https_things(sock):
    context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)

    context.load_cert_chain(certfile=CONF_PATH + "key.crt", keyfile=CONF_PATH + "key.pem")