|
|
|
|
|
|
|
|
import os |
|
|
import time |
|
|
from datetime import datetime |
|
|
import json |
|
|
import traceback |
|
|
from colorama import Fore, Back, Style, init |
|
|
|
|
|
|
|
|
def log(msg, msg_type): |
|
|
try: |
|
|
init() |
|
|
time_datetime = datetime.now() |
|
|
if msg_type == 1: |
|
|
print(f"{time_datetime}{Fore.GREEN}[log]: {msg}") |
|
|
elif msg_type == 2: |
|
|
print(f"{time_datetime}{Fore.YELLOW}[warn]: {msg}") |
|
|
elif msg_type == 3: |
|
|
print(f"{time_datetime}{Fore.RED}[error]: {msg}") |
|
|
elif msg_type == 4: |
|
|
print(f"{time_datetime}{Fore.RED}[error]: {msg}") |
|
|
print(Fore.RED) |
|
|
traceback.print_exc() |
|
|
except Exception as e: |
|
|
time_datetime = datetime.now() |
|
|
print(f"{time_datetime}[error]:log()関数にてエラーあり。:{e}") |
|
|
|
|
|
def count_down(sec,count_down_msg): |
|
|
try: |
|
|
START_TIME = sec |
|
|
while START_TIME > 0: |
|
|
print(f"{count_down_msg}{START_TIME}秒",) |
|
|
START_TIME = START_TIME - 1 |
|
|
time.sleep(1) |
|
|
|
|
|
except Exception as e: |
|
|
time_datetime = datetime.now() |
|
|
print(f"{time_datetime}[error]:count_down()関数にてエラーあり:{e}") |
|
|
|
|
|
def hash_time(hash): |
|
|
try: |
|
|
loop = hash |
|
|
rand_hash = random.randint(0, 75) |
|
|
now_hash = hash(f"{rand_hash}") |
|
|
hash_s_time = time.time() |
|
|
while loop > 0 |
|
|
now_hash = hash(f"{now_hash}") |
|
|
hash_e_time = time.time() |
|
|
hash_time = hash_s_time - hash_e_time |
|
|
return hash_time |
|
|
except Exception as e: |
|
|
time_datetime = datetime.now() |
|
|
print(f"{time_datetime}[error]:hash_time()関数にてエラーあり:{e}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|