機能•インストール•使用法•スコープ•構成•フィルター•不和に参加
katana を正常にインストールするには、Go 1.18が必要です。インストールするには、以下のコマンドを実行するか、リリースページからコンパイル済みのバイナリをダウンロードしてください。
go install github.com/projectdiscovery/katana/cmd/katana@latest
カタナをインストール/実行するためのその他のオプション-
Dockerを最新のタグにインストール/更新するには-
docker pull projectdiscovery/katana:latest
ドッカーを使用して標準モードでカタナを実行するには-
docker run projectdiscovery/katana:latest -u https://tesla.com
dockerを使用してヘッドレスモードでカタナを実行するには-
docker run projectdiscovery/katana:latest -u https://tesla.com -system-chrome -headless
katana -h
これにより、ツールのヘルプが表示されます。これがサポートされているすべてのスイッチです。
Usage:
./katana [flags]
Flags:
INPUT:
-u, -list string[] target url / list to crawl
CONFIGURATION:
-d, -depth int maximum depth to crawl (default 2)
-jc, -js-crawl enable endpoint parsing / crawling in javascript file
-ct, -crawl-duration int maximum duration to crawl the target for
-kf, -known-files string enable crawling of known files (all,robotstxt,sitemapxml)
-mrs, -max-response-size int maximum response size to read (default 2097152)
-timeout int time to wait for request in seconds (default 10)
-aff, -automatic-form-fill enable optional automatic form filling (experimental)
-retry int number of times to retry the request (default 1)
-proxy string http/socks5 proxy to use
-H, -headers string[] custom header/cookie to include in request
-config string path to the katana configuration file
-fc, -form-config string path to custom form configuration file
HEADLESS:
-hl, -headless enable headless hybrid crawling (experimental)
-sc, -system-chrome use local installed chrome browser instead of katana installed
-sb, -show-browser show the browser on the screen with headless mode
-ho, -headless-options string[] start headless chrome with additional options
-nos, -no-sandbox start headless chrome in --no-sandbox mode
SCOPE:
-cs, -crawl-scope string[] in scope url regex to be followed by crawler
-cos, -crawl-out-scope string[] out of scope url regex to be excluded by crawler
-fs, -field-scope string pre-defined scope field (dn,rdn,fqdn) (default "rdn")
-ns, -no-scope disables host based default scope
-do, -display-out-scope display external endpoint from scoped crawling
FILTER:
-f, -field string field to display in output (url,path,fqdn,rdn,rurl,qurl,qpath,file,key,value,kv,dir,udir)
-sf, -store-field string field to store in per-host output (url,path,fqdn,rdn,rurl,qurl,qpath,file,key,value,kv,dir,udir)
-em, -extension-match string[] match output for given extension (eg, -em php,html,js)
-ef, -extension-filter string[] filter output for given extension (eg, -ef png,css)
RATE-LIMIT:
-c, -concurrency int number of concurrent fetchers to use (default 10)
-p, -parallelism int number of concurrent inputs to process (default 10)
-rd, -delay int request delay between each request in seconds
-rl, -rate-limit int maximum requests to send per second (default 150)
-rlm, -rate-limit-minute int maximum number of requests to send per minute
OUTPUT:
-o, -output string file to write output to
-j, -json write output in JSONL(ines) format
-nc, -no-color disable output content coloring (ANSI escape codes)
-silent display output only
-v, -verbose display verbose output
-version display project version
KatanaはクロールにURLまたはエンドポイントを必要とし、単一または複数の入力を受け入れます。
入力URLはオプションを使用して提供でき、カンマ区切り入力を使用して複数の値を提供でき、同様にファイル入力はオプションを使用してサポートされ、さらにパイプ入力(stdin)もサポートされます。
-u
-list
katana -u https://tesla.com
katana -u https://tesla.com,https://google.com
$ cat url_list.txt
https://tesla.com
https://google.com
katana -list url_list.txt
echo https://tesla.com | katana
cat domains | httpx | katana
刀の実行例 -
katana -u https://youtube.com
__ __
/ /_____ _/ /____ ____ ___ _
/ '_/ _ / __/ _ / _ \/ _ /
/_/\_\\_,_/\__/\_,_/_//_/\_,_/ v0.0.1
projectdiscovery.io
[WRN] Use with caution. You are responsible for your actions.
[WRN] Developers assume no liability and are not responsible for any misuse or damage.
https://www.youtube.com/
https://www.youtube.com/about/
https://www.youtube.com/about/press/
https://www.youtube.com/about/copyright/
https://www.youtube.com/t/contact_us/
https://www.youtube.com/creators/
https://www.youtube.com/ads/
https://www.youtube.com/t/terms
https://www.youtube.com/t/privacy
https://www.youtube.com/about/policies/
https://www.youtube.com/howyoutubeworks?utm_campaign=ytgen&utm_source=ythp&utm_medium=LeftNav&utm_content=txt&u=https%3A%2F%2Fwww.youtube.com%2Fhowyoutubeworks%3Futm_source%3Dythp%26utm_medium%3DLeftNav%26utm_campaign%3Dytgen
https://www.youtube.com/new
https://m.youtube.com/
https://www.youtube.com/s/desktop/4965577f/jsbin/desktop_polymer.vflset/desktop_polymer.js
https://www.youtube.com/s/desktop/4965577f/cssbin/www-main-desktop-home-page-skeleton.css
https://www.youtube.com/s/desktop/4965577f/cssbin/www-onepick.css
https://www.youtube.com/s/_/ytmainappweb/_/ss/k=ytmainappweb.kevlar_base.0Zo5FUcPkCg.L.B1.O/am=gAE/d=0/rs=AGKMywG5nh5Qp-BGPbOaI1evhF5BVGRZGA
https://www.youtube.com/opensearch?locale=en_GB
https://www.youtube.com/manifest.webmanifest
https://www.youtube.com/s/desktop/4965577f/cssbin/www-main-desktop-watch-page-skeleton.css
https://www.youtube.com/s/desktop/4965577f/jsbin/web-animations-next-lite.min.vflset/web-animations-next-lite.min.js
https://www.youtube.com/s/desktop/4965577f/jsbin/custom-elements-es5-adapter.vflset/custom-elements-es5-adapter.js
https://www.youtube.com/s/desktop/4965577f/jsbin/webcomponents-sd.vflset/webcomponents-sd.js
https://www.youtube.com/s/desktop/4965577f/jsbin/intersection-observer.min.vflset/intersection-observer.min.js
https://www.youtube.com/s/desktop/4965577f/jsbin/scheduler.vflset/scheduler.js
https://www.youtube.com/s/desktop/4965577f/jsbin/www-i18n-constants-en_GB.vflset/www-i18n-constants.js
https://www.youtube.com/s/desktop/4965577f/jsbin/www-tampering.vflset/www-tampering.js
https://www.youtube.com/s/desktop/4965577f/jsbin/spf.vflset/spf.js
https://www.youtube.com/s/desktop/4965577f/jsbin/network.vflset/network.js
https://www.youtube.com/howyoutubeworks/
https://www.youtube.com/trends/
https://www.youtube.com/jobs/
https://www.youtube.com/kids/
標準のクロール モダリティでは、内部で標準の go http ライブラリを使用して HTTP 要求/応答を処理します。このモダリティは、ブラウザのオーバーヘッドがないため、はるかに高速です。それでも、JavaScript や DOM レンダリングを行わずに HTTP 応答本文をそのまま分析し、ブラウザー固有のイベントなどに依存する複雑な Web アプリケーションで発生する可能性のある、レンダリング後のエンドポイントや非同期エンドポイント呼び出しが欠落している可能性があります。
ヘッドレス モードでは、内部のヘッドレス呼び出しをフックして、ブラウザー コンテキスト内で HTTP 要求/応答を直接処理します。これには、次の 2 つの利点があります。
ヘッドレスクロールはオプションであり、を使用して有効にすることができますオプション。
-headless
その他のヘッドレスCLIオプションは次のとおりです-
katana -h headless
Flags:
HEADLESS:
-hl, -headless enable experimental headless hybrid crawling
-sc, -system-chrome use local installed chrome browser instead of katana installed
-sb, -show-browser show the browser on the screen with headless mode
-ho, -headless-options string[] start headless chrome with additional options
-nos, -no-sandbox start headless chrome in --no-sandbox mode
-no-sandbox
サンドボックスなしのオプションでヘッドレスChromeブラウザを実行し、rootユーザーとして実行している場合に便利です。
katana -u https://tesla.com -headless -no-sandbox
-headless-options
ヘッドレスモードでクロールする場合、追加のクロムオプションは、たとえば次のように指定できます。
-headless-options
katana -u https://tesla.com -headless -system-chrome -headless-options --disable-gpu,proxy-server=http://127.0.0.1:8080
そのようなカタナにはクロールスコープを定義するための複数のサポートが付属しているため、スコープが設定されていない場合、クロールは無限になる可能性があります。
-field-scope
事前定義されたフィールド名でスコープを定義するための最も便利なオプションは、フィールドスコープのデフォルトオプションです。
rdn
rdn- ルートドメイン名とすべてのサブドメインにスコープされたクロール(デフォルト)
fqdn- 特定のサブ(ドメイン)にスコープされたクロール
dn- ドメイン名キーワードにスコープされたクロール
katana -u https://tesla.com -fs dn
-crawl-scope
高度なスコープ制御のために、正規表現サポートが付属するオプションを使用できます。
-cs
katana -u https://tesla.com -cs login
複数スコープルールの場合、複数行の文字列/正規表現を含むファイル入力を渡すことができます。
$ cat in_scope.txt
login/
admin/
app/
wordpress/
katana -u https://tesla.com -cs in_scope.txt
-crawl-out-scope
クロールしないものを定義するには、オプションを使用して正規表現入力をサポートすることもできます。
-cos
katana -u https://tesla.com -cos logout
複数の範囲外ルールの場合、複数行の文字列/正規表現を含むファイル入力を渡すことができます。
$ cat out_of_scope.txt
/logout
/log_out
katana -u https://tesla.com -cos out_of_scope.txt
-no-scope
Katanaはデフォルトでスコープであり、これを無効にするオプションを使用したり、インターネットをクロールしたりすることもできます。
*.domain
-ns
katana -u https://tesla.com -ns
-display-out-scope
デフォルトでは、スコープオプションを使用すると、外部URLがデフォルトで除外され、この動作を上書きするため、出力として表示するリンクにも適用されます。
-do
katana -u https://tesla.com -do
スコープコントロールのすべてのCLIオプションは次のとおりです。
katana -h scope
Flags:
SCOPE:
-cs, -crawl-scope string[] in scope url regex to be followed by crawler
-cos, -crawl-out-scope string[] out of scope url regex to be excluded by crawler
-fs, -field-scope string pre-defined scope field (dn,rdn,fqdn) (default "rdn")
-ns, -no-scope disables host based default scope
-do, -display-out-scope display external endpoint from scoped crawling
Katanaには、クロールを希望どおりに構成および制御するための複数のオプションが付属しています。
-depth
定義するオプションクロールのURLに従うには、深さが深いほど、クロールされるエンドポイントの数+クロールの時間が多くなります。
depth
katana -u https://tesla.com -d 5
-js-crawl
JavaScript ファイルで検出されたエンドポイントの JavaScript ファイル解析 + クロールを有効にするオプション(デフォルトで無効)。
katana -u https://tesla.com -jc
-crawl-duration
事前定義されたクロール期間のオプション、既定では無効。
katana -u https://tesla.com -ct 2
-known-files
クロールを有効にするオプションとファイル、デフォルトで無効。
robots.txt
sitemap.xml
katana -u https://tesla.com -kf robotstxt,sitemapxml
-automatic-form-fill
既知/未知のフィールドの自動フォーム入力を有効にするオプション、既知のフィールド値は、フォーム設定ファイルを更新することで必要に応じてカスタマイズできます。
$HOME/.config/katana/form-config.yaml
自動フォーム入力は実験的な機能です。
-aff, -automatic-form-fill enable optional automatic form filling (experimental)
必要に応じて構成するオプションは他にもありますが、設定関連のCLIオプションはすべてここにあります-
katana -h config
Flags:
CONFIGURATION:
-d, -depth int maximum depth to crawl (default 2)
-jc, -js-crawl enable endpoint parsing / crawling in javascript file
-ct, -crawl-duration int maximum duration to crawl the target for
-kf, -known-files string enable crawling of known files (all,robotstxt,sitemapxml)
-mrs, -max-response-size int maximum response size to read (default 2097152)
-timeout int time to wait for request in seconds (default 10)
-retry int number of times to retry the request (default 1)
-proxy string http/socks5 proxy to use
-H, -headers string[] custom header/cookie to include in request
-config string path to the katana configuration file
-fc, -form-config string path to custom form configuration file
-field
Katanaには、必要な情報の出力をフィルタリングするために使用できる組み込みフィールドが付属しており、オプションを使用して使用可能なフィールドを指定できます。
-f
-f, -field string field to display in output (url,path,fqdn,rdn,rurl,qurl,qpath,file,key,value,kv,dir,udir)
各フィールドの例と使用時に予想される出力を含む表を次に示します。
畑 | 形容 | 例 |
---|---|---|
url |
URL エンドポイント | https://admin.projectdiscovery.io/admin/login?user=admin&password=admin |
qurl |
クエリパラメータを含むURL | https://admin.projectdiscovery.io/admin/login.php?user=admin&password=admin |
qpath |
クエリパラメータを含むパス | /login?user=admin&password=admin |
path |
URL パス | https://admin.projectdiscovery.io/admin/login |
fqdn |
完全修飾ドメイン名 | admin.projectdiscovery.io |
rdn |
ルートドメイン名 | projectdiscovery.io |
rurl |
ルート URL | https://admin.projectdiscovery.io |
file |
URL 内のファイル名 | login.php |
key |
URL のパラメータ キー | user,password |
value |
URL のパラメーター値 | admin,admin |
kv |
キー=URL 内の値 | user=admin&password=admin |
dir |
URL ディレクトリ名 | /admin/ |
udir |
ディレクトリを含む URL | https://admin.projectdiscovery.io/admin/ |
フィールドオプションを使用して、クエリパラメータを含むすべてのURLのみを表示する例を次に示します。
katana -u https://tesla.com -f qurl -silent https://shop.tesla.com/en_au?redirect=no https://shop.tesla.com/en_nz?redirect=no https://shop.tesla.com/product/men_s-raven-lightweight-zip-up-bomber-jacket?sku=1740250-00-A https://shop.tesla.com/product/tesla-shop-gift-card?sku=1767247-00-A https://shop.tesla.com/product/men_s-chill-crew-neck-sweatshirt?sku=1740176-00-A https://www.tesla.com/about?redirect=no https://www.tesla.com/about/legal?redirect=no https://www.tesla.com/findus/list?redirect=no
-store-field
To compliment option which is useful to filter output at run time, there is option which works exactly like field option except instead of filtering, it stores all the information on the disk under directory sorted by target url.
field
-sf, -store-fields
katana_output
katana -u https://tesla.com -sf key,fqdn,qurl -silent
$ ls katana_output/
https_www.tesla.com_fqdn.txt
https_www.tesla.com_key.txt
https_www.tesla.com_qurl.txt
store-fieldoption can come handy to collect information to build a target aware wordlist for followings but not limited to -
|
-extension-match
Crawl output can be easily matched for specfic extension using option to ensure to display only output containing given extension.
-em
katana -u https://tesla.com -silent -em js,jsp,json
-extension-filter
Crawl output can be easily filtered for specfic extension using option which ensure to remove all the urls containing given extension.
-ef
katana -u https://tesla.com -silent -ef css,txt,md
Here are additonal filter options -
-f, -field string field to display in output (url,path,fqdn,rdn,rurl,qurl,file,key,value,kv,dir,udir)
-sf, -store-field string field to store in per-host output (url,path,fqdn,rdn,rurl,qurl,file,key,value,kv,dir,udir)
-em, -extension-match string[] match output for given extension (eg, -em php,html,js)
-ef, -extension-filter string[] filter output for given extension (eg, -ef png,css)
It's easy to get blocked / banned while crawling if not following target websites limits, katana comes with multiple option to tune the crawl to go as fast / slow we want.
-delay
option to introduce a delay in seconds between each new request katana makes while crawling, disabled as default.
katana -u https://tesla.com -delay 20
-concurrency
option to control the number of urls per target to fetch at the same time.
katana -u https://tesla.com -c 20
-parallelism
option to define number of target to process at same time from list input.
katana -u https://tesla.com -p 20
-rate-limit
option to use to define max number of request can go out per second.
katana -u https://tesla.com -rl 100
-rate-limit-minute
要求の最大数を定義するために使用するオプションは、分ごとに送信できます。
katana -u https://tesla.com -rlm 500
レート制限制御のためのすべてのロング/ショートCLIオプションは次のとおりです-
katana -h rate-limit
Flags:
RATE-LIMIT:
-c, -concurrency int number of concurrent fetchers to use (default 10)
-p, -parallelism int number of concurrent inputs to process (default 10)
-rd, -delay int request delay between each request in seconds
-rl, -rate-limit int maximum requests to send per second (default 150)
-rlm, -rate-limit-minute int maximum number of requests to send per minute
-json
Katanaは、プレーンテキスト形式のファイル出力と,,,検出されたエンドポイントを相互に関連付けるための名前などの追加情報を含むJSONの両方をサポートします。
source
tag
attribute
katana -u https://example.com -json -do | jq .
{
"timestamp": "2022-11-05T22:33:27.745815+05:30",
"endpoint": "https://www.iana.org/domains/example",
"source": "https://example.com",
"tag": "a",
"attribute": "href"
}
出力に関連する追加のCLIオプションは次のとおりです。
katana -h output
OUTPUT:
-o, -output string file to write output to
-j, -json write output in JSONL(ines) format
-nc, -no-color disable output content coloring (ANSI escape codes)
-silent display output only
-v, -verbose display verbose output
-version
カタナはプロジェクトディスカバリーチーム