57 lines
2.2 KiB
Python
57 lines
2.2 KiB
Python
"""
|
|
Chrome 확장프로그램의 key를 추출하는 스크립트
|
|
사용법: python extract_extension_key.py <확장프로그램_ID>
|
|
"""
|
|
import json
|
|
import os
|
|
import sys
|
|
|
|
def extract_extension_key(extension_id):
|
|
"""Chrome 확장프로그램의 key를 추출합니다."""
|
|
# Windows Chrome 확장프로그램 경로
|
|
chrome_paths = [
|
|
os.path.expanduser(r"~\AppData\Local\Google\Chrome\User Data\Default\Extensions"),
|
|
os.path.expanduser(r"~\AppData\Local\Google\Chrome\User Data\Profile 1\Extensions"),
|
|
]
|
|
|
|
for chrome_path in chrome_paths:
|
|
if not os.path.exists(chrome_path):
|
|
continue
|
|
|
|
ext_path = os.path.join(chrome_path, extension_id)
|
|
if not os.path.exists(ext_path):
|
|
continue
|
|
|
|
# 최신 버전 폴더 찾기
|
|
versions = [d for d in os.listdir(ext_path) if os.path.isdir(os.path.join(ext_path, d))]
|
|
if not versions:
|
|
continue
|
|
|
|
latest_version = sorted(versions, key=lambda x: [int(i) for i in x.split('.')])[-1]
|
|
manifest_path = os.path.join(ext_path, latest_version, "manifest.json")
|
|
|
|
if os.path.exists(manifest_path):
|
|
with open(manifest_path, 'r', encoding='utf-8') as f:
|
|
manifest = json.load(f)
|
|
if 'key' in manifest:
|
|
print(f"✅ 확장프로그램 key를 찾았습니다!")
|
|
print(f"경로: {manifest_path}")
|
|
print(f"\nkey 값:")
|
|
print(manifest['key'])
|
|
return manifest['key']
|
|
|
|
print(f"❌ 확장프로그램 ID '{extension_id}'를 찾을 수 없습니다.")
|
|
print("\n확인 사항:")
|
|
print("1. Chrome이 설치되어 있고 확장프로그램이 설치되어 있는지 확인하세요.")
|
|
print("2. 확장프로그램 ID가 정확한지 확인하세요.")
|
|
return None
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) < 2:
|
|
print("사용법: python extract_extension_key.py <확장프로그램_ID>")
|
|
print("예시: python extract_extension_key.py jlcdjppbpplpdgfeknhioedbhfceaben")
|
|
sys.exit(1)
|
|
|
|
extension_id = sys.argv[1]
|
|
extract_extension_key(extension_id)
|