2020-08-19 07:48:14 +08:00
|
|
|
import re
|
|
|
|
|
|
2020-09-26 03:17:49 +08:00
|
|
|
from module.base.mask import Mask
|
2023-07-02 15:24:40 +08:00
|
|
|
from module.ui.assets import PLAYER_CHECK
|
2024-05-23 01:02:06 +08:00
|
|
|
from module.ui.page import MAIN_GOTO_CAMPAIGN_WHITE, MAIN_GOTO_FLEET
|
2020-08-19 07:48:14 +08:00
|
|
|
|
2020-09-26 03:17:49 +08:00
|
|
|
MASK_MAIN = Mask('./assets/mask/MASK_MAIN.png')
|
2024-09-09 23:44:48 +08:00
|
|
|
MASK_MAIN_WHITE = Mask('./assets/mask/MASK_MAIN_WHITE.png')
|
2020-09-26 03:17:49 +08:00
|
|
|
MASK_PLAYER = Mask('./assets/mask/MASK_PLAYER.png')
|
|
|
|
|
|
2020-08-19 07:48:14 +08:00
|
|
|
|
|
|
|
|
def handle_sensitive_image(image):
|
|
|
|
|
"""
|
|
|
|
|
Args:
|
2020-09-26 15:36:17 +08:00
|
|
|
image:
|
2020-08-19 07:48:14 +08:00
|
|
|
|
|
|
|
|
Returns:
|
2022-01-23 15:50:15 +08:00
|
|
|
np.ndarray:
|
2020-08-19 07:48:14 +08:00
|
|
|
"""
|
|
|
|
|
if PLAYER_CHECK.match(image, offset=(30, 30)):
|
2022-01-23 15:50:15 +08:00
|
|
|
image = MASK_PLAYER.apply(image)
|
2024-05-23 01:02:06 +08:00
|
|
|
if MAIN_GOTO_FLEET.match(image, offset=(30, 30)):
|
|
|
|
|
image = MASK_MAIN.apply(image)
|
|
|
|
|
if MAIN_GOTO_CAMPAIGN_WHITE.match(image, offset=(30, 30)):
|
2024-09-09 23:44:48 +08:00
|
|
|
image = MASK_MAIN_WHITE.apply(image)
|
2020-08-19 07:48:14 +08:00
|
|
|
|
2020-09-26 15:36:17 +08:00
|
|
|
return image
|
2020-08-19 07:48:14 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_sensitive_text(text):
|
|
|
|
|
"""
|
|
|
|
|
Args:
|
|
|
|
|
text (str):
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
str:
|
|
|
|
|
"""
|
|
|
|
|
text = re.sub('File \"(.*?)AzurLaneAutoScript', 'File \"C:\\\\fakepath\\\\AzurLaneAutoScript', text)
|
2021-11-09 22:17:20 +08:00
|
|
|
text = re.sub('\[Adb_binary\] (.*?)AzurLaneAutoScript', '[Adb_binary] C:\\\\fakepath\\\\AzurLaneAutoScript', text)
|
2020-08-19 07:48:14 +08:00
|
|
|
return text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handle_sensitive_logs(logs):
|
|
|
|
|
return [handle_sensitive_text(line) for line in logs]
|