mirror of
https://github.com/Justuser3310/jetwork.git
synced 2025-03-12 05:30:14 +00:00
Отключение логирования
This commit is contained in:
parent
c5a0111fab
commit
d3a25ee190
23
network.py
23
network.py
@ -13,6 +13,9 @@ from db import read
|
|||||||
from json import loads
|
from json import loads
|
||||||
# Логирование ошибок
|
# Логирование ошибок
|
||||||
import logging
|
import logging
|
||||||
|
# Просто логирование
|
||||||
|
from icecream import ic
|
||||||
|
ic.disable() # Отключение логирования
|
||||||
|
|
||||||
from verify import *
|
from verify import *
|
||||||
from domain_check import *
|
from domain_check import *
|
||||||
@ -43,7 +46,7 @@ def server_http():
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
run = False
|
run = False
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("SERVER_HTTP FALLED")
|
ic("SERVER_HTTP FALLED")
|
||||||
logging.critical(e, exc_info=True)
|
logging.critical(e, exc_info=True)
|
||||||
|
|
||||||
def server(http_port):
|
def server(http_port):
|
||||||
@ -59,7 +62,7 @@ def server(http_port):
|
|||||||
s.listen(2)
|
s.listen(2)
|
||||||
conn, address = s.accept()
|
conn, address = s.accept()
|
||||||
|
|
||||||
print("Connection from: " + str(address))
|
ic("Connection from: " + str(address))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
@ -104,7 +107,7 @@ def server(http_port):
|
|||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("SERVER_HTTP FALLED")
|
ic("SERVER_HTTP FALLED")
|
||||||
logging.critical(e, exc_info=True)
|
logging.critical(e, exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
@ -120,7 +123,7 @@ def recv(s, data_out):
|
|||||||
okay = True
|
okay = True
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
print(data)
|
ic(data)
|
||||||
data_out.put(data)
|
data_out.put(data)
|
||||||
|
|
||||||
# op = operation
|
# op = operation
|
||||||
@ -177,7 +180,7 @@ def client(port, op = "ping", host = 'bore.del.pw'):
|
|||||||
g_site = get(f"http://{host}:{str(port)}/{site}.zip")
|
g_site = get(f"http://{host}:{str(port)}/{site}.zip")
|
||||||
except:
|
except:
|
||||||
return 'error'
|
return 'error'
|
||||||
print('SIZE: ', g_site.headers['Content-Length']) # Размер
|
ic('SIZE: ', g_site.headers['Content-Length']) # Размер
|
||||||
|
|
||||||
with open(f"verify/{site}.zip", "wb") as f:
|
with open(f"verify/{site}.zip", "wb") as f:
|
||||||
f.write(g_site.content)
|
f.write(g_site.content)
|
||||||
@ -214,10 +217,10 @@ def client(port, op = "ping", host = 'bore.del.pw'):
|
|||||||
our_ver = our_conf["ver"]
|
our_ver = our_conf["ver"]
|
||||||
# Если версия не новее - злоумышленник
|
# Если версия не новее - злоумышленник
|
||||||
if our_ver >= dest_ver:
|
if our_ver >= dest_ver:
|
||||||
print("[!] Обнаружена подмена версии сайта.")
|
ic("[!] Обнаружена подмена версии сайта.")
|
||||||
# Сохраняем ключ злоумышленника
|
# Сохраняем ключ злоумышленника
|
||||||
os.replace(f"verify/{site}.pem", f"verify/{site}.pem.FAKE")
|
os.replace(f"verify/{site}.pem", f"verify/{site}.pem.FAKE")
|
||||||
print(f"[!] Порт злоумышленника: {port}")
|
ic(f"[!] Порт злоумышленника: {port}")
|
||||||
# Удаляем фальшивые файлы
|
# Удаляем фальшивые файлы
|
||||||
os.remove(f"verify/{site}.zip")
|
os.remove(f"verify/{site}.zip")
|
||||||
os.remove(f"verify/{site}.sig")
|
os.remove(f"verify/{site}.sig")
|
||||||
@ -235,11 +238,11 @@ def client(port, op = "ping", host = 'bore.del.pw'):
|
|||||||
copytree(f"verify/{site}", f"cached/{site}")
|
copytree(f"verify/{site}", f"cached/{site}")
|
||||||
rmtree(f"verify/{site}")
|
rmtree(f"verify/{site}")
|
||||||
else:
|
else:
|
||||||
print("[!] Обнаружена подмена сайта.")
|
ic("[!] Обнаружена подмена сайта.")
|
||||||
# Сохраняем ключ злоумышленника
|
# Сохраняем ключ злоумышленника
|
||||||
os.replace(f"verify/{site}.pem", f"verify/{site}.pem.FAKE")
|
os.replace(f"verify/{site}.pem", f"verify/{site}.pem.FAKE")
|
||||||
print(f"[!] Порт злоумышленника: {port}")
|
ic(f"[!] Порт злоумышленника: {port}")
|
||||||
print(f"[!] Ключ (вероятно) злоумышленника сохранён в verify/{site}.pem.FAKE\n")
|
ic(f"[!] Ключ (вероятно) злоумышленника сохранён в verify/{site}.pem.FAKE\n")
|
||||||
# Удаляем фальшивые файлы
|
# Удаляем фальшивые файлы
|
||||||
os.remove(f"verify/{site}.zip")
|
os.remove(f"verify/{site}.zip")
|
||||||
os.remove(f"verify/{site}.sig")
|
os.remove(f"verify/{site}.sig")
|
||||||
|
11
updater.py
11
updater.py
@ -6,6 +6,9 @@ from network import *
|
|||||||
|
|
||||||
# Логирование ошибок
|
# Логирование ошибок
|
||||||
import logging
|
import logging
|
||||||
|
# Просто логирование
|
||||||
|
from icecream import ic
|
||||||
|
ic.disable() # Отключение логирования
|
||||||
|
|
||||||
def update_demon(serv_port):
|
def update_demon(serv_port):
|
||||||
while True:
|
while True:
|
||||||
@ -40,23 +43,23 @@ def update_demon(serv_port):
|
|||||||
if check[0] == el:
|
if check[0] == el:
|
||||||
# Сверяем версии
|
# Сверяем версии
|
||||||
if check[1] >= ver:
|
if check[1] >= ver:
|
||||||
print("Ver_ok: ", el)
|
ic("Ver_ok: ", el)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
# Если версия новее
|
# Если версия новее
|
||||||
print("Ver_new: ", el)
|
ic("Ver_new: ", el)
|
||||||
http_port = client(port, f"is_{el}")
|
http_port = client(port, f"is_{el}")
|
||||||
client(http_port, f"get_{el}")
|
client(http_port, f"get_{el}")
|
||||||
found = True
|
found = True
|
||||||
break # Если нашли - выходим
|
break # Если нашли - выходим
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
print("Not_found: ", el)
|
ic("Not_found: ", el)
|
||||||
http_port = client(port, f"is_{el}")
|
http_port = client(port, f"is_{el}")
|
||||||
client(http_port, f"get_{el}")
|
client(http_port, f"get_{el}")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("UPDATER FALLED")
|
ic("UPDATER FALLED")
|
||||||
logging.critical(e, exc_info=True)
|
logging.critical(e, exc_info=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user