def create_main_log_file(self): path = self.logs_dir_path + 'xegtor.log' file = open(path ,'w') file.close() # create log header logger = Logger(log_file=path) logger.add_log_header()
from argparse import ArgumentParser from threading import Thread import subprocess from modules.logger import Logger from os.path import isfile logs_dir = 'logs/' SCRIPT_NAME = 'icmp_ping.py' log_file_name = 'icmp_ping_py.log' log_file_path = logs_dir + log_file_name if isfile(log_file_path): logger = Logger(log_file=log_file_path, filemode='a') else: logger = Logger(log_file=log_file_path, filemode='w') logger.add_log_header(script_name=SCRIPT_NAME) class IcmpPingScan(): def __init__(self, ip_range): self.ip_range = ip_range self.check_os() def start(self): logger.add_log_delimiter() logger.add_log_path() logger.add_script_name('icmp_ping.py') logger.add_time() scanning_msg = 'scanning...' logger.log(scanning_msg)