1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-09 18:39:04 +08:00
AzurLaneAutoScript/module/handler/sensitive_info.py

42 lines
977 B
Python
Raw Normal View History

import re
from module.base.mask import Mask
from module.ui.assets import PLAYER_CHECK
from module.ui.page import MAIN_CHECK
MASK_MAIN = Mask('./assets/mask/MASK_MAIN.png')
MASK_PLAYER = Mask('./assets/mask/MASK_PLAYER.png')
def handle_sensitive_image(image):
"""
Args:
2020-09-26 15:36:17 +08:00
image:
Returns:
np.ndarray:
"""
if PLAYER_CHECK.match(image, offset=(30, 30)):
image = MASK_PLAYER.apply(image)
if MAIN_CHECK.match(image, offset=(30, 30)):
image = MASK_MAIN.apply(image)
2020-09-26 15:36:17 +08:00
return image
def handle_sensitive_text(text):
"""
Args:
text (str):
Returns:
str:
"""
text = re.sub('File \"(.*?)AzurLaneAutoScript', 'File \"C:\\\\fakepath\\\\AzurLaneAutoScript', text)
text = re.sub('\[Adb_binary\] (.*?)AzurLaneAutoScript', '[Adb_binary] C:\\\\fakepath\\\\AzurLaneAutoScript', text)
return text
def handle_sensitive_logs(logs):
return [handle_sensitive_text(line) for line in logs]