mirror of
https://github.com/Justuser3310/jetwork.git
synced 2025-03-12 13:39:47 +00:00
Перенос проверки доменов.
This commit is contained in:
parent
3f1a3e3a7d
commit
a4edba8db2
@ -1,8 +1,15 @@
|
|||||||
|
from re import compile, sub
|
||||||
|
|
||||||
def domain_ok(domain):
|
def domain_ok(domain):
|
||||||
domains = ["jet"]
|
domains = ["jet"]
|
||||||
|
|
||||||
if domain.count(".") == 1:
|
if domain.count(".") == 1:
|
||||||
if domain.split(".")[1] in domains:
|
if domain.split(".")[1] in domains:
|
||||||
return True
|
# ../some => some
|
||||||
|
# Защита от проверки папок выше, чем нужно и др.
|
||||||
|
regex = compile('[^a-zA-Zа-яА-ЯЁё.]')
|
||||||
|
c_domain = regex.sub('', domain)
|
||||||
|
if domain == c_domain:
|
||||||
|
return domain
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
15
network.py
15
network.py
@ -10,6 +10,7 @@ from shutil import unpack_archive
|
|||||||
from re import compile, sub
|
from re import compile, sub
|
||||||
|
|
||||||
from verify import *
|
from verify import *
|
||||||
|
from domain_check import *
|
||||||
|
|
||||||
# Здесь идёт обработка всех запросов через сеть
|
# Здесь идёт обработка всех запросов через сеть
|
||||||
|
|
||||||
@ -29,18 +30,6 @@ def port_gen():
|
|||||||
port = randint(4000, 4200)
|
port = randint(4000, 4200)
|
||||||
return port
|
return port
|
||||||
|
|
||||||
# ../some => some
|
|
||||||
# Защита от проверки папок выше, чем нужно и др.
|
|
||||||
def v_check(check):
|
|
||||||
regex = compile('[^a-zA-Zа-яА-ЯЁё.]')
|
|
||||||
check = regex.sub('', check)
|
|
||||||
|
|
||||||
if check.count('.') > 1:
|
|
||||||
return 'BAD'
|
|
||||||
|
|
||||||
return check
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def server_http():
|
def server_http():
|
||||||
os.chdir("cached")
|
os.chdir("cached")
|
||||||
@ -73,7 +62,7 @@ def server(http_port):
|
|||||||
check = op[3:]
|
check = op[3:]
|
||||||
print(check)
|
print(check)
|
||||||
# Защита от доступа выше
|
# Защита от доступа выше
|
||||||
check = v_check(check)
|
check = domain_ok(check)
|
||||||
print(check)
|
print(check)
|
||||||
|
|
||||||
if os.path.exists(f'cached/{check}'):
|
if os.path.exists(f'cached/{check}'):
|
||||||
|
Loading…
Reference in New Issue
Block a user