-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added logs_processing.py (part of #58)
- Loading branch information
1 parent
2e8faaf
commit 821d9c7
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import logging | ||
import os | ||
from colorama import Fore, Style | ||
def create_log_folder(): | ||
scan_logs_folder = 'scan_logs' | ||
os.makedirs(scan_logs_folder, exist_ok=True) | ||
return scan_logs_folder | ||
|
||
def write_logs(ctime, whois_gather_status, contact_mail_gather_status, subdomains_gather_status, list_to_log): | ||
to_log = [whois_gather_status, contact_mail_gather_status, subdomains_gather_status] | ||
subdomains_processes_logs = [item for sublist in list_to_log for item in sublist] | ||
scan_logs_folder = create_log_folder() | ||
logging.basicConfig(level=logging.INFO, filename=scan_logs_folder + f"//scan_log_{ctime}.log", filemode="w", format="%(asctime)s %(message)s") | ||
logging.info("# THIS FILE REPRESENTS DPULSE SCAN LOGS\n") | ||
print(Fore.GREEN + "Created log file for this scan" + Style.RESET_ALL) | ||
|
||
for log in to_log: | ||
if log[-2:] == "OK": | ||
logging.info(log) | ||
else: | ||
logging.info(log) | ||
|
||
for log in subdomains_processes_logs: | ||
if log[-2:] == "OK": | ||
logging.info(log) | ||
else: | ||
logging.info(log) | ||
logging.shutdown() |