From bb053bca07370fd00c89e8513a95e8b21c3edb94 Mon Sep 17 00:00:00 2001 From: Llloooggg Date: Fri, 8 May 2020 18:05:08 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BF=D1=83=D1=82=D0=B8=20=D0=BD=D0=B0=20=D0=B0=D0=B1?= =?UTF-8?q?=D1=81=D0=BE=D0=BB=D1=8E=D1=82=D0=BD=D1=8B=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __init__.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/__init__.py b/__init__.py index 901c13d..140617c 100755 --- a/__init__.py +++ b/__init__.py @@ -1,6 +1,7 @@ #!venv/bin/python3 import os +import sys import link_extractor import time import random @@ -12,24 +13,25 @@ from threading import Thread global requestCountSuccess, requestCountExecuted -if not os.path.exists('./maps/'): - os.makedirs('./maps/') +script_path = os.path.abspath(os.path.dirname(sys.argv[0])) + +if not os.path.exists(f'{script_path}/maps/'): + os.makedirs(f'{script_path}/maps/') devnull = open('/dev/null', 'w') - def url_grab(full_url): - if os.path.exists(f'./maps/{url}'): + if os.path.exists(f'{script_path}/maps/{url}'): - with open(f'./maps/{url}', 'r') as f: + with open(f'{script_path}/maps/{url}', 'r') as f: subUrls = f.read().splitlines() else: subUrls = link_extractor.extractor('http://' + url) - os.mknod(f'./maps/{url}') - with open(f'./maps/{url}', 'w') as f: + os.mknod(f'{script_path}/maps/{url}') + with open(f'{script_path}/maps/{url}', 'w') as f: for link in subUrls: print(link.strip(), file=f) @@ -58,8 +60,8 @@ class DDoSer(Thread): if __name__ == '__main__': - # url = input(datetime.now().strftime('[%x %X] ') + 'Введите адрес сайта: ') - url = '192.168.56.102' + url = input(f'{datetime.now().strftime("[%X]")} Введите адрес сайта: ') + # url = '192.168.56.102' subUrls = url_grab(url)