# macOS ファイル拡張子 & URL スキームアプリハンドラー
{{#include ../../banners/hacktricks-training.md}}
## LaunchServices データベース
これは、macOS にインストールされているすべてのアプリケーションのデータベースで、サポートされている URL スキームや MIME タイプなど、各インストールされたアプリケーションに関する情報を取得するためにクエリできます。
このデータベースをダンプすることが可能です:
```
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump
```
Or using the tool [**lsdtrip**](https://newosxbook.com/tools/lsdtrip.html).
**`/usr/libexec/lsd`** はデータベースの中枢です。これは **いくつかのXPCサービス** を提供します、例えば `.lsd.installation`、`.lsd.open`、`.lsd.openurl` などです。しかし、これらの公開されたXPC機能を使用するためには、アプリケーションにいくつかの権限が必要です。例えば、mimeタイプやURLスキームのデフォルトアプリを変更するための `.launchservices.changedefaulthandler` や `.launchservices.changeurlschemehandler` などです。
**`/System/Library/CoreServices/launchservicesd`** はサービス `com.apple.coreservices.launchservicesd` を主張し、実行中のアプリケーションに関する情報を取得するためにクエリできます。これはシステムツール /**`usr/bin/lsappinfo`** または [**lsdtrip**](https://newosxbook.com/tools/lsdtrip.html) を使ってクエリできます。
## ファイル拡張子とURLスキームアプリハンドラー
次の行は、拡張子に応じてファイルを開くことができるアプリケーションを見つけるのに役立ちます:
```bash
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep -E "path:|bindings:|name:"
```
Or use something like [**SwiftDefaultApps**](https://github.com/Lord-Kamina/SwiftDefaultApps):
```bash
./swda getSchemes #Get all the available schemes
./swda getApps #Get all the apps declared
./swda getUTIs #Get all the UTIs
./swda getHandler --URL ftp #Get ftp handler
```
アプリケーションがサポートしている拡張子を確認するには、次のようにします:
```
cd /Applications/Safari.app/Contents
grep -A3 CFBundleTypeExtensions Info.plist | grep string
css
pdf
webarchive
webbookmark
webhistory
webloc
download
safariextz
gif
html
htm
js
jpg
jpeg
jp2
txt
text
png
tiff
tif
url
ico
xhtml
xht
xml
xbl
svg
```
{{#include ../../banners/hacktricks-training.md}}