コード例 #1
0
def writefile(input_file, proxy, auto_proxy, ip_proxy, output_file, dynamic):
    ip_content = list_ip.final_list()
    ip16_content = list_ip.center_list()
    proxy_content = get_file_data(input_file)
    proxy_content = proxy_content.replace('__IP_LIST__', ip_content)
    proxy_content = proxy_content.replace('__IP16_LIST__', ip16_content)
    proxy_content = proxy_content.replace('__FAKE_IP_LIST__',
                                          list_ip.fake_list())
    proxy_content = proxy_content.replace('__WHITE_DOMAINS__',
                                          list_white.final_list())
    if '__BLACK_DOMAINS__' in proxy_content:
        proxy_content = proxy_content.replace('__BLACK_DOMAINS__',
                                              list_black.final_list())
    if '__GFWBLACK_DOMAINS__' in proxy_content:
        proxy_content = proxy_content.replace('__GFWBLACK_DOMAINS__',
                                              list_gfw.final_list())

    if dynamic != 'no':
        with open(dynamic + output_file, 'w') as file_obj:
            file_obj.write(js_shorter(proxy_content))

    proxy_content = proxy_content.replace('__PROXY__', proxy)
    proxy_content = proxy_content.replace('__NOWALL_PROXY__', '"DIRECT;"')
    proxy_content = proxy_content.replace('__IP_PROXY__', ip_proxy)
    proxy_content = proxy_content.replace('__AUTO_PROXY__', auto_proxy)
    proxy_content = proxy_content.replace('__DIRECT__', '"DIRECT;"')
    with open(output_file, 'w') as file_obj:
        file_obj.write(proxy_content)

    with open('min_' + output_file, 'w') as file_obj:
        file_obj.write(js_shorter(proxy_content))
コード例 #2
0
ファイル: mainproxy.py プロジェクト: majie1993/gfw_whitelist
def writefile(input_file, proxy, auto_proxy, ip_proxy, output_file, dynamic):
	ip_content = list_ip.final_list()
	ip16_content = list_ip.center_list()
	proxy_content = get_file_data(input_file)
	proxy_content = proxy_content.replace('__IP_LIST__', ip_content)
	proxy_content = proxy_content.replace('__IP16_LIST__', ip16_content)
	proxy_content = proxy_content.replace('__FAKE_IP_LIST__', list_ip.fake_list())
	proxy_content = proxy_content.replace('__WHITE_DOMAINS__', list_white.final_list())
	if '__BLACK_DOMAINS__' in proxy_content:
		proxy_content = proxy_content.replace('__BLACK_DOMAINS__', list_black.final_list())
	if '__GFWBLACK_DOMAINS__' in proxy_content:
		proxy_content = proxy_content.replace('__GFWBLACK_DOMAINS__', list_gfw.final_list())

	if dynamic != 'no':
		with open(dynamic + output_file, 'w') as file_obj:
			file_obj.write( js_shorter(proxy_content) )

	proxy_content = proxy_content.replace('__PROXY__', proxy)
	proxy_content = proxy_content.replace('__NOWALL_PROXY__', '"DIRECT;"')
	proxy_content = proxy_content.replace('__IP_PROXY__', ip_proxy)
	proxy_content = proxy_content.replace('__AUTO_PROXY__', auto_proxy)
	proxy_content = proxy_content.replace('__DIRECT__', '"DIRECT;"')
	with open(output_file, 'w') as file_obj:
		file_obj.write(proxy_content)

	with open('min_' + output_file, 'w') as file_obj:
		file_obj.write(js_shorter(proxy_content))
コード例 #3
0
ファイル: mainproxy.py プロジェクト: Vanson/gfw_whitelist
def writefile(input_file, proxy, auto_proxy, output_file):
	ip_content = list_ip.final_list()
	ip16_content = list_ip.center_list()
	proxy_content = get_file_data(input_file)
	proxy_content = proxy_content.replace('__IP_LIST__', ip_content)
	proxy_content = proxy_content.replace('__IP16_LIST__', ip16_content)
	proxy_content = proxy_content.replace('__FAKE_IP_LIST__', list_ip.fake_list())
	proxy_content = proxy_content.replace('__WHITE_DOMAINS__', list_white.final_list())
	proxy_content = proxy_content.replace('__BLACK_DOMAINS__', list_black.final_list())
	#with open('dyn_' + output_file, 'w') as file_obj:
	#	file_obj.write(proxy_content)

	proxy_content = proxy_content.replace('__PROXY__', proxy)
	proxy_content = proxy_content.replace('__NOWALL_PROXY__', '"DIRECT;"')
	proxy_content = proxy_content.replace('__AUTO_PROXY__', auto_proxy)
	proxy_content = proxy_content.replace('__DIRECT__', '"DIRECT;"')
	with open(output_file, 'w') as file_obj:
		file_obj.write(proxy_content)

	r = re.compile('//.*')
	proxy_content = r.sub('', proxy_content)
	proxy_content = proxy_content.replace('\n', '')
	proxy_content = proxy_content.replace('\t', '')
	with open('min_' + output_file, 'w') as file_obj:
		file_obj.write(proxy_content)
コード例 #4
0
ファイル: mainip.py プロジェクト: Vanson/gfw_whitelist
def writefile(input_file, proxy, output_file):
	ip_content = list_ip.final_list()
	ip16_content = list_ip.center_list()
	fake_ip_content = list_ip.fake_list()
	proxy_content = get_file_data(input_file)
	proxy_content = proxy_content.replace('__PROXY__', proxy)
	proxy_content = proxy_content.replace('__IP_LIST__', ip_content)
	proxy_content = proxy_content.replace('__IP16_LIST__', ip16_content)
	proxy_content = proxy_content.replace('__FAKE_IP_LIST__', fake_ip_content)
	with open(output_file, 'w') as file_obj:
		file_obj.write(proxy_content)
コード例 #5
0
ファイル: main.py プロジェクト: ccat3z/ss_gfw_whitelist
def writefile(input_file, output_file):
    ip_content = list_ip.final_list()
    ip16_content = list_ip.center_list()
    fake_ip_content = list_ip.fake_list()
    domains_content = list_white.final_list()
    proxy_content = get_file_data(input_file)
    proxy_content = proxy_content.replace('__DOMAINS__', domains_content)
    proxy_content = proxy_content.replace('__IP_LIST__', ip_content)
    proxy_content = proxy_content.replace('__IP16_LIST__', ip16_content)
    proxy_content = proxy_content.replace('__FAKE_IP_LIST__', fake_ip_content)
    with open(output_file, 'w') as file_obj:
        file_obj.write(proxy_content)