Compare commits

..

No commits in common. '6e96b0dfb33f693812ba5fba6a49effdcd021061' and '54a4692cac00ed0f6657227cdf3d81db18f60fa3' have entirely different histories.

@ -2,19 +2,19 @@ import os
import json
if not os.path.exists('config.json'):
db = {'os': None,'our_port': 0000, 'ports': [], 'base_url': 'http://0.0.0.0:8000'}
db = {"os": None,"our_port": 0000, "ports": [], "domain": "http://0.0.0.0:8000"}
js = json.dumps(db, indent=2)
with open('config.json', 'w') as outfile:
with open("config.json", "w") as outfile:
outfile.write(js)
print('Created new config.json')
def read(file = 'config.json'):
with open(file, 'r', encoding='utf-8') as openfile:
with open(file, "r", encoding="utf-8") as openfile:
db = json.load(openfile)
return db
def write(db, file = 'config.json'):
js = json.dumps(db, indent=2, ensure_ascii=False)
with open(file, 'w', encoding='utf-8') as outfile:
with open(file, "w", encoding="utf-8") as outfile:
outfile.write(js)

@ -1 +0,0 @@
{"activeProfileId":"InternalProfile_SmartRules","defaultProxyServerId":"usundlzx4uvk2","firstEverInstallNotified":true,"options":{"syncSettings":false,"syncActiveProfile":true,"syncActiveProxy":true,"detectRequestFailures":true,"displayFailedOnBadge":true,"displayAppliedProxyOnBadge":true,"displayMatchedRuleOnBadge":true,"refreshTabOnConfigChanges":false,"proxyPerOrigin":true,"enableShortcuts":true,"shortcutNotification":true,"themeType":0,"themesDark":"themes-cosmo-dark"},"product":"SmartProxy","proxyProfiles":[{"enabled":true,"proxyRules":[],"rulesSubscriptions":[],"profileId":"InternalProfile_Direct","profileType":0,"profileTypeConfig":{"builtin":true,"editable":false,"selectable":true,"supportsSubscriptions":false,"supportsProfileProxy":false,"customProxyPerRule":false,"canBeDisabled":false,"supportsRuleActionWhitelist":false,"defaultRuleActionIsWhitelist":null},"profileName":"Direct (No Proxy)","profileProxyServerId":null},{"enabled":true,"proxyRules":[{"enabled":true,"whiteList":false,"ruleId":99411781,"autoGeneratePattern":true,"ruleType":0,"hostName":"jet","rulePattern":"*.jet/*","ruleRegex":"","ruleExact":"","proxy":{"name":"jet_local","id":"ezgallzykftxq","order":1,"host":"127.0.0.1","port":"8080","protocol":"HTTP","username":"","password":"","proxyDNS":true,"failoverTimeout":null},"proxyServerId":"ezgallzykftxq"},{"enabled":true,"whiteList":false,"ruleId":274078801725,"autoGeneratePattern":true,"ruleType":0,"hostName":"mirror","rulePattern":"*.mirror/*","ruleRegex":"","ruleExact":"","proxy":{"name":"jet_local","id":"ezgallzykftxq","order":1,"host":"127.0.0.1","port":"8080","protocol":"HTTP","username":"","password":"","proxyDNS":true,"failoverTimeout":null},"proxyServerId":"ezgallzykftxq"},{"enabled":true,"whiteList":false,"ruleId":597907496,"autoGeneratePattern":true,"ruleType":0,"hostName":"me","rulePattern":"*.me/*","ruleRegex":"","ruleExact":"","proxy":{"name":"jet_local","id":"ezgallzykftxq","order":1,"host":"127.0.0.1","port":"8080","protocol":"HTTP","username":"","password":"","proxyDNS":true,"failoverTimeout":null},"proxyServerId":"ezgallzykftxq"}],"rulesSubscriptions":[],"profileId":"InternalProfile_SmartRules","profileType":2,"profileTypeConfig":{"builtin":true,"editable":true,"selectable":true,"supportsSubscriptions":true,"supportsProfileProxy":true,"customProxyPerRule":true,"canBeDisabled":true,"supportsRuleActionWhitelist":true,"defaultRuleActionIsWhitelist":false},"profileName":"Smart Proxy","profileProxyServerId":""},{"enabled":true,"proxyRules":[],"rulesSubscriptions":[],"profileId":"InternalProfile_AlwaysEnabled","profileType":3,"profileTypeConfig":{"builtin":true,"editable":true,"selectable":true,"supportsSubscriptions":true,"supportsProfileProxy":true,"customProxyPerRule":true,"canBeDisabled":true,"supportsRuleActionWhitelist":true,"defaultRuleActionIsWhitelist":true},"profileName":"Always Enable","profileProxyServerId":null},{"enabled":true,"proxyRules":[],"rulesSubscriptions":[],"profileId":"InternalProfile_SystemProxy","profileType":1,"profileTypeConfig":{"builtin":true,"editable":false,"selectable":true,"supportsSubscriptions":false,"supportsProfileProxy":false,"customProxyPerRule":false,"canBeDisabled":false,"supportsRuleActionWhitelist":false,"defaultRuleActionIsWhitelist":null},"profileName":"System Proxy","profileProxyServerId":null},{"enabled":true,"proxyRules":[],"rulesSubscriptions":[],"profileType":4,"profileTypeConfig":{"builtin":true,"editable":false,"selectable":false,"supportsSubscriptions":false,"supportsProfileProxy":false,"customProxyPerRule":false,"canBeDisabled":false,"supportsRuleActionWhitelist":false,"defaultRuleActionIsWhitelist":null},"profileName":"Ignore Failure Rules","profileId":"profile-ms5zflzx4opc8"}],"proxyServerSubscriptions":[],"proxyServers":[{"name":"jet_public","id":"usundlzx4uvk2","order":3,"host":"jet.del.pw","port":"8080","protocol":"HTTP","username":"","password":"","proxyDNS":true,"failoverTimeout":null},{"name":"jet_local","id":"ezgallzykftxq","order":1,"host":"127.0.0.1","port":"8080","protocol":"HTTP","username":"","password":"","proxyDNS":true,"failoverTimeout":null}],"updateInfo":{"updateIsAvailable":false,"downloadPage":null,"version":null,"versionName":null,"isBrowserSpecific":true},"version":"1.5"}

@ -1 +0,0 @@
{"activeProfileId":"InternalProfile_SmartRules","defaultProxyServerId":"usundlzx4uvk2","firstEverInstallNotified":true,"options":{"syncSettings":false,"syncActiveProfile":true,"syncActiveProxy":true,"detectRequestFailures":true,"displayFailedOnBadge":true,"displayAppliedProxyOnBadge":true,"displayMatchedRuleOnBadge":true,"refreshTabOnConfigChanges":false,"proxyPerOrigin":true,"enableShortcuts":true,"shortcutNotification":true,"themeType":0,"themesDark":"themes-cosmo-dark"},"product":"SmartProxy","proxyProfiles":[{"enabled":true,"proxyRules":[],"rulesSubscriptions":[],"profileId":"InternalProfile_Direct","profileType":0,"profileTypeConfig":{"builtin":true,"editable":false,"selectable":true,"supportsSubscriptions":false,"supportsProfileProxy":false,"customProxyPerRule":false,"canBeDisabled":false,"supportsRuleActionWhitelist":false,"defaultRuleActionIsWhitelist":null},"profileName":"Direct (No Proxy)","profileProxyServerId":null},{"enabled":true,"proxyRules":[{"enabled":true,"whiteList":false,"ruleId":42142459831829816,"autoGeneratePattern":true,"ruleType":0,"hostName":"jet","rulePattern":"*.jet/*","ruleRegex":"","ruleExact":"","proxy":{"name":"jet_public","id":"usundlzx4uvk2","order":3,"host":"jet.del.pw","port":"8080","protocol":"HTTP","username":"","password":"","proxyDNS":true,"failoverTimeout":null},"proxyServerId":"usundlzx4uvk2"},{"enabled":true,"whiteList":false,"ruleId":995421339685,"autoGeneratePattern":true,"ruleType":0,"hostName":"mirror","rulePattern":"*.mirror/*","ruleRegex":"","ruleExact":"","proxy":{"name":"jet_public","id":"usundlzx4uvk2","order":3,"host":"jet.del.pw","port":"8080","protocol":"HTTP","username":"","password":"","proxyDNS":true,"failoverTimeout":null},"proxyServerId":"usundlzx4uvk2"},{"enabled":true,"whiteList":false,"ruleId":7021094,"autoGeneratePattern":true,"ruleType":0,"hostName":"me","rulePattern":"*.me/*","ruleRegex":"","ruleExact":"","proxy":{"name":"jet_public","id":"usundlzx4uvk2","order":3,"host":"jet.del.pw","port":"8080","protocol":"HTTP","username":"","password":"","proxyDNS":true,"failoverTimeout":null},"proxyServerId":"usundlzx4uvk2"}],"rulesSubscriptions":[],"profileId":"InternalProfile_SmartRules","profileType":2,"profileTypeConfig":{"builtin":true,"editable":true,"selectable":true,"supportsSubscriptions":true,"supportsProfileProxy":true,"customProxyPerRule":true,"canBeDisabled":true,"supportsRuleActionWhitelist":true,"defaultRuleActionIsWhitelist":false},"profileName":"Smart Proxy","profileProxyServerId":""},{"enabled":true,"proxyRules":[],"rulesSubscriptions":[],"profileId":"InternalProfile_AlwaysEnabled","profileType":3,"profileTypeConfig":{"builtin":true,"editable":true,"selectable":true,"supportsSubscriptions":true,"supportsProfileProxy":true,"customProxyPerRule":true,"canBeDisabled":true,"supportsRuleActionWhitelist":true,"defaultRuleActionIsWhitelist":true},"profileName":"Always Enable","profileProxyServerId":null},{"enabled":true,"proxyRules":[],"rulesSubscriptions":[],"profileId":"InternalProfile_SystemProxy","profileType":1,"profileTypeConfig":{"builtin":true,"editable":false,"selectable":true,"supportsSubscriptions":false,"supportsProfileProxy":false,"customProxyPerRule":false,"canBeDisabled":false,"supportsRuleActionWhitelist":false,"defaultRuleActionIsWhitelist":null},"profileName":"System Proxy","profileProxyServerId":null},{"enabled":true,"proxyRules":[],"rulesSubscriptions":[],"profileType":4,"profileTypeConfig":{"builtin":true,"editable":false,"selectable":false,"supportsSubscriptions":false,"supportsProfileProxy":false,"customProxyPerRule":false,"canBeDisabled":false,"supportsRuleActionWhitelist":false,"defaultRuleActionIsWhitelist":null},"profileName":"Ignore Failure Rules","profileId":"profile-ms5zflzx4opc8"}],"proxyServerSubscriptions":[],"proxyServers":[{"name":"jet_public","id":"usundlzx4uvk2","order":3,"host":"jet.del.pw","port":"8080","protocol":"HTTP","username":"","password":"","proxyDNS":true,"failoverTimeout":null},{"name":"jet_local","id":"ezgallzykftxq","order":1,"host":"127.0.0.1","port":"8080","protocol":"HTTP","username":"","password":"","proxyDNS":true,"failoverTimeout":null}],"updateInfo":{"updateIsAvailable":false,"downloadPage":null,"version":null,"versionName":null,"isBrowserSpecific":true},"version":"1.5"}

@ -1,5 +1,5 @@
from re import compile, sub
domains = ['jet', 'mirror', 'me']
domains = ['jet', 'dyn']
def domain_ok(domain):
global domains

@ -67,11 +67,11 @@ def update_servers(n):
Input('interval-component', 'n_intervals'),
Input('search', 'value'))
def update_sites(n, s_val):
# Префикс
base_url = read()['base_url']
# Домен по умолчанию
domain = read()['domain']
# Если есть элемент в поиске
if s_val:
return html.Div([ dcc.Link(children=i, href=f'{base_url}/{s_val}',
return html.Div([ dcc.Link(children=i, href=f'{domain}/{s_val}',
target='_blank') ], className='sites_elem')
res = []

@ -13,9 +13,6 @@ from db import read
from json import loads
# Логирование ошибок
import logging
# Просто логирование
from icecream import ic
ic.disable() # Отключение логирования
from verify import *
from domain_check import *
@ -46,7 +43,7 @@ def server_http():
except KeyboardInterrupt:
run = False
except Exception as e:
ic("SERVER_HTTP FALLED")
print("SERVER_HTTP FALLED")
logging.critical(e, exc_info=True)
def server(http_port):
@ -62,7 +59,7 @@ def server(http_port):
s.listen(2)
conn, address = s.accept()
ic("Connection from: " + str(address))
print("Connection from: " + str(address))
while True:
try:
@ -107,7 +104,7 @@ def server(http_port):
conn.close()
except Exception as e:
ic("SERVER_HTTP FALLED")
print("SERVER_HTTP FALLED")
logging.critical(e, exc_info=True)
@ -123,7 +120,7 @@ def recv(s, data_out):
okay = True
except:
pass
ic(data)
print(data)
data_out.put(data)
# op = operation
@ -180,7 +177,7 @@ def client(port, op = "ping", host = 'bore.del.pw'):
g_site = get(f"http://{host}:{str(port)}/{site}.zip")
except:
return 'error'
ic('SIZE: ', g_site.headers['Content-Length']) # Размер
print('SIZE: ', g_site.headers['Content-Length']) # Размер
with open(f"verify/{site}.zip", "wb") as f:
f.write(g_site.content)
@ -217,10 +214,10 @@ def client(port, op = "ping", host = 'bore.del.pw'):
our_ver = our_conf["ver"]
# Если версия не новее - злоумышленник
if our_ver >= dest_ver:
ic("[!] Обнаружена подмена версии сайта.")
print("[!] Обнаружена подмена версии сайта.")
# Сохраняем ключ злоумышленника
os.replace(f"verify/{site}.pem", f"verify/{site}.pem.FAKE")
ic(f"[!] Порт злоумышленника: {port}")
print(f"[!] Порт злоумышленника: {port}")
# Удаляем фальшивые файлы
os.remove(f"verify/{site}.zip")
os.remove(f"verify/{site}.sig")
@ -238,11 +235,11 @@ def client(port, op = "ping", host = 'bore.del.pw'):
copytree(f"verify/{site}", f"cached/{site}")
rmtree(f"verify/{site}")
else:
ic("[!] Обнаружена подмена сайта.")
print("[!] Обнаружена подмена сайта.")
# Сохраняем ключ злоумышленника
os.replace(f"verify/{site}.pem", f"verify/{site}.pem.FAKE")
ic(f"[!] Порт злоумышленника: {port}")
ic(f"[!] Ключ (вероятно) злоумышленника сохранён в verify/{site}.pem.FAKE\n")
print(f"[!] Порт злоумышленника: {port}")
print(f"[!] Ключ (вероятно) злоумышленника сохранён в verify/{site}.pem.FAKE\n")
# Удаляем фальшивые файлы
os.remove(f"verify/{site}.zip")
os.remove(f"verify/{site}.sig")

@ -15,14 +15,8 @@ conf = read()
conf['os'] = os
write(conf)
if os == 'Android':
print('''---
Устанавливаем зависимости rust...
---''')
system('pkg install rust')
print('''---
[1/3] Устанавливаем зависимости Python...
[1/3] Устанавливаем зависимости python...
---''')
system('pip install -r requirements.txt')
@ -39,7 +33,7 @@ elif os == 'Windows':
unpack('bore.zip')
system('del bore.zip')
elif os == 'Android':
system('pkg install bore')
system('pkg install bore-cli')
else:
print('Увы, вероятно Ваша ОС не поддерживается.')
print('Завершение работы...')

@ -52,11 +52,11 @@ def update_servers(n):
Input('interval-component', 'n_intervals'),
Input('search', 'value'))
def update_sites(n, s_val):
# Префикс
base_url = read()['base_url']
# Домен по умолчанию
domain = read()['domain']
# Если есть элемент в поиске
if s_val:
return html.Div([ dcc.Link(children=i, href=f'{base_url}/{s_val}',
return html.Div([ dcc.Link(children=i, href=f'{domain}/{s_val}',
target='_blank') ], className='sites_elem')
res = []

@ -6,9 +6,6 @@ from network import *
# Логирование ошибок
import logging
# Просто логирование
from icecream import ic
ic.disable() # Отключение логирования
def update_demon(serv_port):
while True:
@ -43,23 +40,23 @@ def update_demon(serv_port):
if check[0] == el:
# Сверяем версии
if check[1] >= ver:
ic("Ver_ok: ", el)
print("Ver_ok: ", el)
pass
else:
# Если версия новее
ic("Ver_new: ", el)
print("Ver_new: ", el)
http_port = client(port, f"is_{el}")
client(http_port, f"get_{el}")
found = True
break # Если нашли - выходим
if not found:
ic("Not_found: ", el)
print("Not_found: ", el)
http_port = client(port, f"is_{el}")
client(http_port, f"get_{el}")
except:
pass
except Exception as e:
ic("UPDATER FALLED")
print("UPDATER FALLED")
logging.critical(e, exc_info=True)

@ -2,42 +2,34 @@ import http.server
import socketserver
import urllib.request
import logging
from os.path import exists
from db import *
base_url = read()['base_url']
domain = read()['domain']
# Логирование
#logging.basicConfig(level=ic, format='%(asctime)s - %(message)s')
from icecream import ic
ic.disable() # Выключить отладку
class Proxy(http.server.SimpleHTTPRequestHandler):
# Отключение всех сообщений (чтобы не забивать вывод)
def log_message(self, format, *args):
pass
def do_GET(self):
# Log the requested domain
ic(f"Request for: {self.path}")
# 'js-check.jet/favicon.ico' -> '127.0.0.1:8000/favicon.ico'
target = self.path
domain = target[7:]
domain = domain[:domain.find('/')]
if not exists(f'cached/{domain}'):
self.send_error(404, f"Site not found")
return 404
# Если статичный
if read(f'cached/{domain}/config.json')['type'] == 'static':
target = f'{base_url}/{target[7:]}' # http://127.0.0.1:8000 / js-check.jet
# Если динамический
elif read(f'cached/{domain}/config.json')['type'] == 'dynamic':
port = read(f'cached/{domain}/config.json')['port']
target = f'http://bore.del.pw:{port}/{target.replace(f"http://{domain}/", "")}'
ic(f"Modded request: {target}")
if 'jet' in target:
target = f'{domain}/{target[7:]}' # http://127.0.0.1:8000 / js-check.jet
ic(f"Modded request: {target}")
elif 'dyn' in target:
addr = target[target.find('://')+3:]
addr = addr[:addr.find('/')]
port = read(f'cached/{addr}/config.json')['port']
target = f'http://bore.del.pw:{port}/{target[target.find("dyn")+4:]}'
ic(f"Modded request: {target}")
# Направление запроса по адресу
# Forward the request to the actual server
try:
with urllib.request.urlopen(target) as response:
self.send_response(response.getcode())
@ -48,21 +40,16 @@ class Proxy(http.server.SimpleHTTPRequestHandler):
self.send_error(500, f"Error: {str(e)}")
def do_POST(self):
# Log the requested domain
ic(f"Request for: {self.path}")
if not exists(f'cached/{domain}'):
self.send_error(404, f"Site not found")
return 404
if read(f'cached/{domain}/config.json')['type'] == 'static':
target = f'{base_url}/{target[7:]}' # http://127.0.0.1:8000 / js-check.jet
elif read(f'cached/{domain}/config.json')['type'] == 'dynamic':
port = read(f'cached/{domain}/config.json')['port']
target = f'http://bore.del.pw:{port}/{target.replace(f"http://{domain}/", "")}'
ic(f"Modded request: {target}")
if 'jet' in target:
target = f'{domain}/{target[7:]}' # http://127.0.0.1:8000 / js-check.jet
ic(f"Modded request: {target}")
else:
pass
# Направление запроса по адресу
# Forward the request to the actual server
try:
content_length = int(self.headers['Content-Length'])
post_data = self.rfile.read(content_length)
@ -78,5 +65,5 @@ class Proxy(http.server.SimpleHTTPRequestHandler):
def web_proxy():
PORT = 8080
with socketserver.TCPServer(("", PORT), Proxy) as httpd:
print(f"HTTP proxy on port {PORT}")
ic(f"Serving on port {PORT}")
httpd.serve_forever()

@ -0,0 +1,71 @@
import http.server
import socketserver
import urllib.request
import logging
from db import *
domain = read()['domain']
# Логирование
#logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(message)s')
from icecream import ic
class Proxy(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
# Log the requested domain
logging.info(f"Request for: {self.path}")
# 'js-check.jet/favicon.ico' -> '127.0.0.1:8000/favicon.ico'
target = self.path
# Если статичный
if 'jet' in target:
target = f'{domain}/{target[7:]}' # http://127.0.0.1:8000 / js-check.jet
logging.info(f"Modded request: {target}")
elif 'dyn' in target:
addr = target[target.find('://')+3:]
addr = addr[:addr.find('/')]
port = read(f'cached/{addr}/config.json')['port']
target = f'http://bore.pub:{port}/{target[target.find("dyn")+4:]}'
logging.info(f"Modded request: {target}")
# Forward the request to the actual server
try:
with urllib.request.urlopen(target) as response:
self.send_response(response.getcode())
self.send_header("Content-type", response.headers.get_content_type())
self.end_headers()
self.wfile.write(response.read())
except Exception as e:
self.send_error(500, f"Error: {str(e)}")
def do_POST(self):
# Log the requested domain
logging.info(f"Request for: {self.path}")
if 'jet' in target:
target = f'{domain}/{target[7:]}' # http://127.0.0.1:8000 / js-check.jet
logging.info(f"Modded request: {target}")
else:
pass
# Forward the request to the actual server
try:
content_length = int(self.headers['Content-Length'])
post_data = self.rfile.read(content_length)
req = urllib.request.Request(self.path, data=post_data, method='POST')
with urllib.request.urlopen(req) as response:
self.send_response(response.getcode())
self.send_header("Content-type", response.headers.get_content_type())
self.end_headers()
self.wfile.write(response.read())
except Exception as e:
self.send_error(500, f"Error: {str(e)}")
#if __name__ == "__main__":
def web_proxy():
PORT = 8080
with socketserver.TCPServer(("", PORT), Proxy) as httpd:
logging.info(f"Serving on port {PORT}")
httpd.serve_forever()
web_proxy()
Loading…
Cancel
Save