Commit
·
0a843a7
1
Parent(s):
de92022
Delete username_searcher.py
Browse files- username_searcher.py +0 -20
username_searcher.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
import re
|
| 2 |
-
from pathlib import Path
|
| 3 |
-
|
| 4 |
-
# データセットのタグからユーザーネームを検知した時にアラートする
|
| 5 |
-
|
| 6 |
-
def check_tags(directory_path):
|
| 7 |
-
dir_path = Path(directory_path)
|
| 8 |
-
username_pattern = re.compile(r'(username|user_name)', re.IGNORECASE)
|
| 9 |
-
|
| 10 |
-
for file_path in dir_path.glob('*.txt'):
|
| 11 |
-
with open(file_path, 'r') as f:
|
| 12 |
-
tags = f.read().replace(" ", "").strip().split(',')
|
| 13 |
-
for tag in tags:
|
| 14 |
-
if username_pattern.search(tag):
|
| 15 |
-
print(f"Warning: File {file_path.name} contains tag: {tag}")
|
| 16 |
-
|
| 17 |
-
if __name__ == "__main__":
|
| 18 |
-
directory_path = r"E:\Dataset\XXXXXX" # ここにディレクトリへのパスを入力してください
|
| 19 |
-
|
| 20 |
-
check_tags(directory_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|