Refactored log named format and remoted redundant import

This commit is contained in:
moony 2021-07-01 11:19:42 -07:00
parent d6c64d6953
commit 002e71e6c9

View File

@ -7,7 +7,7 @@ import os
import sys
import threading
import traceback
from datetime import date, datetime
from datetime import datetime
from time import sleep
import requests
@ -22,8 +22,8 @@ DIR = os.path.abspath(os.path.dirname(__file__))
logging.captureWarnings(True)
FORMAT = '%(asctime)s (%(levelname)s): %(message)s'
logging.basicConfig(filename=DIR + '/logs/aftermath_' +
str(datetime.today().date()) +
str(datetime.today().time()) + '.log',
str(datetime.today().date()) + '_' +
str(datetime.today().time().strftime('%H:%M:%S')) + '.log',
format=FORMAT,
level=logging.INFO)
@ -36,15 +36,15 @@ class ui:
BLUE = '\33[34m'
def getTime():
now = datetime.now()
return now.strftime('%H:%M:%S')
now = datetime.now().strftime('%H:%M:%S')
return now
def getDate():
today = date.today()
today = datetime.today().date()
return today
def prompt():
now = datetime.now().strftime('%H:%M:%S')
now = datetime.today().time().strftime('%H:%M:%S')
prompt = f' {ui.BLUE}[{ui.GREEN}{now}{ui.BLUE}]{ui.END}'
return prompt
@ -79,6 +79,7 @@ def scan_target(target, args):
f.close()
else:
print(f'{ui.prompt()} no shell found: {target}')
logging.info(f'no shell found: {target}')
except Exception as e:
@ -106,7 +107,8 @@ def main():
'-o',
'--output',
dest='output_file',
default=f'{DIR}/output/{ui.getDate()}_{ui.getTime()}.txt',
default=
f'{DIR}/output/{datetime.today().time()}_{datetime.today().date()}.txt',
metavar='<output_file>',
help='output file to save valid urls')