|
|
@ -8,6 +8,7 @@ from random import randint
|
|
|
|
from shutil import unpack_archive
|
|
|
|
from shutil import unpack_archive
|
|
|
|
# Убираем ненужное (../some => some)
|
|
|
|
# Убираем ненужное (../some => some)
|
|
|
|
from re import compile, sub
|
|
|
|
from re import compile, sub
|
|
|
|
|
|
|
|
# Timeout для команды
|
|
|
|
|
|
|
|
|
|
|
|
from verify import *
|
|
|
|
from verify import *
|
|
|
|
from domain_check import *
|
|
|
|
from domain_check import *
|
|
|
@ -30,12 +31,11 @@ def port_gen():
|
|
|
|
port = randint(4000, 4200)
|
|
|
|
port = randint(4000, 4200)
|
|
|
|
return port
|
|
|
|
return port
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def server_http():
|
|
|
|
def server_http():
|
|
|
|
os.chdir("cached")
|
|
|
|
os.chdir("cached")
|
|
|
|
os.system("python -m http.server")
|
|
|
|
os.system("python -m http.server")
|
|
|
|
|
|
|
|
|
|
|
|
def server(server_port):
|
|
|
|
def server(http_port):
|
|
|
|
host = "127.0.0.1"
|
|
|
|
host = "127.0.0.1"
|
|
|
|
port = 8001
|
|
|
|
port = 8001
|
|
|
|
|
|
|
|
|
|
|
@ -51,7 +51,6 @@ def server(server_port):
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
op = conn.recv(1024).decode()
|
|
|
|
op = conn.recv(1024).decode()
|
|
|
|
print(op)
|
|
|
|
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
if not op:
|
|
|
|
if not op:
|
|
|
@ -78,6 +77,17 @@ def server(server_port):
|
|
|
|
|
|
|
|
|
|
|
|
conn.close()
|
|
|
|
conn.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def recv(q, s):
|
|
|
|
|
|
|
|
okay = False
|
|
|
|
|
|
|
|
while not okay:
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
data = s.recv(1024).decode()
|
|
|
|
|
|
|
|
okay = True
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
q.put(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import multiprocessing as mp
|
|
|
|
# op = operation
|
|
|
|
# op = operation
|
|
|
|
def client(port, op = "ping"):
|
|
|
|
def client(port, op = "ping"):
|
|
|
|
host = 'jetwork.404.mn'
|
|
|
|
host = 'jetwork.404.mn'
|
|
|
@ -90,16 +100,26 @@ def client(port, op = "ping"):
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
s.send(op.encode())
|
|
|
|
s.send(op.encode())
|
|
|
|
okay = False
|
|
|
|
|
|
|
|
while not okay:
|
|
|
|
# Канал обмена процесс - наша функция
|
|
|
|
try:
|
|
|
|
q = mp.Queue()
|
|
|
|
data = s.recv(1024).decode()
|
|
|
|
# Стартуем процесс получения ответа
|
|
|
|
okay = True
|
|
|
|
p = mp.Process(target=recv, args=(q, s))
|
|
|
|
except:
|
|
|
|
p.start()
|
|
|
|
pass
|
|
|
|
# Ждём 10 секунд - максимум
|
|
|
|
print(data)
|
|
|
|
p.join(10)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
data = q.get(block=False)
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
data = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Если процесс жив - убираем
|
|
|
|
|
|
|
|
if p.is_alive():
|
|
|
|
|
|
|
|
p.terminate()
|
|
|
|
|
|
|
|
|
|
|
|
s.close()
|
|
|
|
s.close()
|
|
|
|
|
|
|
|
|
|
|
|
return data
|
|
|
|
return data
|
|
|
|
elif op[:4] == "get_":
|
|
|
|
elif op[:4] == "get_":
|
|
|
|
site = op[4:]
|
|
|
|
site = op[4:]
|
|
|
@ -144,3 +164,16 @@ def client(port, op = "ping"):
|
|
|
|
# Удаляем фальшивые файлы
|
|
|
|
# Удаляем фальшивые файлы
|
|
|
|
os.remove(f"verify/{site}.zip")
|
|
|
|
os.remove(f"verify/{site}.zip")
|
|
|
|
os.remove(f"verify/{site}.sig")
|
|
|
|
os.remove(f"verify/{site}.sig")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from tqdm import tqdm
|
|
|
|
|
|
|
|
def port_check(your_port):
|
|
|
|
|
|
|
|
ports = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
checks = list(range(4000, 4200))
|
|
|
|
|
|
|
|
checks.remove(your_port)
|
|
|
|
|
|
|
|
for port in tqdm(range(4000, 4200)):
|
|
|
|
|
|
|
|
if client(port, "ping"):
|
|
|
|
|
|
|
|
ports.append(port)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ports
|
|
|
|