
グラフ理論を活用した強力なターゲット偵察フレームワーク
プロジェクトはmonorepoに移行しました。詳細は https://github.com/pownjs/pown をご覧ください。
Reconは、知識グラフを搭載したターゲット偵察フレームワークです。フラットなテーブル表現の代わりに知識グラフを使用することで、異なる種類の情報間の関係を見つけやすくなり、多くの状況で非常に便利です。知識グラフのアルゴリズムは、差分検出、検索、最短経路の発見、その他多くの有益なタスクにも役立ち、情報発見とインテリジェンス収集を支援します。
このツールは、secapps.com のオープンソースイニシアチブの一部です。```
/ | / | /_\ | _ \ _ / |
_ \ | ( / _ | / /_
|/__// __| || |___/
https://secapps.com
> **注意**: Recon は、SecApps の優れた [Recon](https://recon.secapps.com) ツールのほぼ直接的なコピーです。
## クイックスタート
このツールは [Pown.js](https://github.com/pownjs/pown) の一部として使用することを想定していますが、独立したツールとして単独で起動することもできます。
まず、通常通り Pown をインストールします:```sh
$ npm install -g pown@latest
recon をインストール:```sh $ pown modules install @pown/recon
Pownから直接呼び出す:```sh
$ pown recon
このモジュールをプロジェクトのルートからローカルにインストールしてください:```sh $ npm install @pown/recon --save
完了したら、pown cli を呼び出してください:```sh
$ POWN_ROOT=. ./node_modules/.bin/pown-cli recon
グローバルな pown を使用して、ツールをローカルで呼び出すこともできます:```sh $ POWN_ROOT=. pown recon
## ライブラリの使用
このモジュールはライブラリでもあります。使用方法のアイデアについては、コードと例を確認してください。ドキュメントは近日公開予定です。
## 使い方
> **警告**: このpownコマンドは現在開発中であり、その結果、破壊的な変更が生じる可能性があります。```
pown-cli recon <command>
Target recon
Commands:
pown-cli recon transform <transform> Perform inline transformation [aliases: t]
pown-cli recon template <command> Recon template commands [aliases: p, templates]
pown-cli recon select <expressions...> Select nodes [aliases: s]
pown-cli recon traverse <expressions...> Traverse nodes [aliases: v]
pown-cli recon options <command> Manage options [aliases: option]
pown-cli recon cache <command> Manage cache
pown-cli recon add <nodes...> Add nodes [aliases: a]
pown-cli recon remove <expressions...> Remove nodes [aliases: r]
pown-cli recon edit <expressions...> Edit nodes [aliases: e]
pown-cli recon merge <files...> Perform a merge between at least two recon files [aliases: m]
pown-cli recon diff <fileA> <fileB> Perform a diff between two recon files [aliases: d]
pown-cli recon group <name> <expressions...> Group nodes [aliases: g]
pown-cli recon ungroup <expressions...> Ungroup nodes [aliases: u]
pown-cli recon load <file> Load a file [aliases: l]
pown-cli recon save <file> Save to file [aliases: o]
pown-cli recon import <file> Import file [aliases: i]
pown-cli recon export <file> Export to file [aliases: x]
pown-cli recon remote <command> Remote managment [aliases: remotes, f]
pown-cli recon layout <name> Layout the graph [aliases: k]
pown-cli recon summary [options] Create a summary [aliases: y]
pown-cli recon exec <files...> Execute js file [aliases: c]
Options:
--version Show version number [boolean]
--help Show help [boolean]
pown-cli recon transform <transform>
Perform inline transformation
Commands:
pown-cli recon transform bitbucketlistrepos [options] <nodes...> List Bitbucket repositories [aliases: bitbucket_list_repos, bblr]
pown-cli recon transform bitbucketlistsnippets [options] <nodes...> List Bitbucket snippets [aliases: bitbucket_list_snippets, bbls]
pown-cli recon transform bitbucketlistteamrepos [options] <nodes...> List Bitbucket team repos [aliases: bitbucket_list_team_repos, bbltr]
pown-cli recon transform bitbucketlistteammembers [options] <nodes...> List Bitbucket team members [aliases: bitbucket_list_team_members, bbltm]
pown-cli recon transform bufferoverrunsubdomainsearch [options] <nodes...> Obtain a list of subdomains using bufferover.run DNS service [aliases: bufferoverrun_subdomain_search, brss]
pown-cli recon transform certspotterissuances [options] <nodes...> Obtain issuances from Certspotter [aliases: certspotter_issuances, csi]
pown-cli recon transform cloudflarednsquery [options] <nodes...> Query CloudFlare DNS API [aliases: cloudflare_dns_query, cfdq]
pown-cli recon transform crtshcndomainreport [options] <nodes...> Obtain crt.sh domain report which helps enumerating potential target subdomains [aliases: crtsh_cn_domain_report, crtshcdr]
pown-cli recon transform crtshsandomainreport [options] <nodes...> Obtain crt.sh domain report which helps enumerating potential target subdomains [aliases: crtsh_san_domain_report, crtshsdr]
pown-cli recon transform dnsresolve [options] <nodes...> Performs DNS resolution [aliases: dns_resolve, dr, dns]
pown-cli recon transform dockerhublistrepos [options] <nodes...> List DockerHub repositories for a given member or org [aliases: dockerhub_list_repos, dhlr]
pown-cli recon transform gravatar [options] <nodes...> Get gravatar
pown-cli recon transform hackertargetreverseiplookup [options] <nodes...> Obtain reverse IP information from hackertarget.com [aliases: hackertarget_reverse_ip_lookup, htril]
pown-cli recon transform hackertargetonlineportscan [options] <nodes...> Obtain port information from hackertarget.com [aliases: hackertarget_online_port_scan, htps]
pown-cli recon transform httpfingerprint [options] <nodes...> Performs a fingerprint on the HTTP server and application [aliases: http_fingerprint, hf]
pown-cli recon transform ipinfoiowidgetsearch [options] <nodes...> Obtain ipinfo.io whois report via the web widget [aliases: ipinfoio_widget_search, iiiows]
pown-cli recon transform omnisintsubdomainreport [options] <nodes...> Obtain omnisint domain report which helps enumerating target subdomains [aliases: omnisint_subdomain_report]
pown-cli recon transform pkslookupkeys [options] <nodes...> Look the the PKS database at pool.sks-keyservers.net which pgp.mit.edu is part of [aliases: pks_lookup_keys, pkslk]
pown-cli recon transform pwndbsearch [options] <nodes...> Searching the PwnDB database [aliases: pwndb_search, pds]
pown-cli recon transform riddleripsearch [options] <nodes...> Searches for IP references using F-Secure riddler.io [aliases: riddler_ip_search, rdis]
pown-cli recon transform riddlerdomainsearch [options] <nodes...> Searches for Domain references using F-Secure riddler.io [aliases: riddler_domain_search, rdds]
pown-cli recon transform script [options] <nodes...> Perform transformation with external script [aliases: script]
pown-cli recon transform scyllasearch [options] <nodes...> Searching the Scylla database [aliases: scylla_search, scys]
pown-cli recon transform securitytrailssuggestions [options] <nodes...> Get a list of domain suggestions from securitytrails.com [aliases: securitytrails_domain_suggestions, stds]
pown-cli recon transform shodanorgsearch [options] <nodes...> Performs search using ORG filter [aliases: shodan_org_search, sos]
pown-cli recon transform shodansslsearch [options] <nodes...> Performs search using SSL filter [aliases: shodan_ssl_search, sss]
pown-cli recon transform spysesubdomains [options] <nodes...> Performs subdomain searching with Spyse [aliases: spyse_subdomains, ssds]
pown-cli recon transform tcpportscan [options] <nodes...> Simple, full-handshake TCP port scanner (very slow and sometimes inaccurate) [aliases: tcp_port_scan, tps]
pown-cli recon transform threatcrowddomainreport [options] <nodes...> Obtain threatcrowd domain report which helps enumerating potential target subdomains and email addresses [aliases: threatcrowd_domain_report, tcdr]
pown-cli recon transform threatcrowdipreport [options] <nodes...> Obtain threatcrowd ip report which helps enumerating virtual hosts [aliases: threatcrowd_ip_report, tcir]
pown-cli recon transform urlscanliveshot [options] <nodes...> Generates a liveshot of any public site via urlscan [aliases: urlscan_liveshot, usls]
pown-cli recon transform urlscansubdomains [options] <nodes...> Find subdomains via urlscan [aliases: urlscan_subdomains, uss]
pown-cli recon transform noop [options] <nodes...> Does not do anything [aliases: nop]
pown-cli recon transform sleep [options] <nodes...> Sleeps for predefined time [aliases: sleep, wait]
pown-cli recon transform duplicate [options] <nodes...> Duplicate node [aliases: dup]
pown-cli recon transform extract [options] <nodes...> Extract property [aliases: excavate]
pown-cli recon transform prefix [options] <nodes...> Creates a new node with a prefix [aliases: prepand]
pown-cli recon transform suffix [options] <nodes...> Creates a new node with a suffix [aliases: append]
pown-cli recon transform augment [options] <nodes...> Update node with prefix or suffix
pown-cli recon transform splitemail [options] <nodes...> Split email at the @ sign [aliases: split_email]
pown-cli recon transform buildemail [options] <nodes...> Build email from node label [aliases: build_email]
pown-cli recon transform splitdomain [options] <nodes...> Split domain at the first dot [aliases: split_domain]
pown-cli recon transform builddomain [options] <nodes...> Build domain from node label [aliases: build_domain]
pown-cli recon transform splituri [options] <nodes...> Split URI to corresponding parts [aliases: split_uri]
pown-cli recon transform builduri [options] <nodes...> Build URI from node label [aliases: build_uri]
pown-cli recon transform bakeimages [options] <nodes...> Convert external image into data URIs for self-embedding purposes [aliases: bake_images, bes]
pown-cli recon transform virustotalsubdomains [options] <nodes...> Obtain subdomains from Virustotal [aliases: virustotal_subdomains, vtsd]
pown-cli recon transform vulnerssearch [options] <nodes...> Obtain vulnerability information via vulners.com [aliases: vulners_search, vs]
pown-cli recon transform wappalyzerprofile [options] <nodes...> Enumerate technologies with api.wappalyzer.com [aliases: wappalyzer_profile, wzp]
pown-cli recon transform worker [options] <nodes...> Perform transformation with external worker [aliases: worker]
pown-cli recon transform zonecrunchersubdomains [options] <nodes...> Performs subdomain searching with Zonecruncher [aliases: zonecruncher_subdomains, zcss]
pown-cli recon transform auto [options] <nodes...> Select the most appropriate methods of transformation
Options:
--version Show version number [boolean]
--help Show help [boolean]
-r, --read Read file [string]
-w, --write Write file [string]
生成されたグラフは、このツールのベースとなっているSecApps Reconで便利にプレビューできます。ブラウザからSecApps Reconにアクセスできますが、コマンドラインから呼び出すことも可能です。
最初に@pown/appsをインストールする必要があります。```sh
$ pown modules install @pown/apps
これはオプションのapps command packageをインストールします。
書き込みオプションを使用してグラフを生成してください:```sh
$ pown recon transform auto -w path/to/file.network --node-type brand target
偵察が完了したら、SecApps Recon でグラフをプレビュー用に開いてください:```sh $ pown apps recon < path/to/file.network
## スクリプティング
Pown recon は、お好みのシェル環境、[Pown Script](https://github.com/pownjs/script)、[Pown Engine Templates](https://github.com/pownjs/engine)、JavaScript を使用してスクリプト化できるように設計されています。スクリプトは、各コマンド実行間でコンテキストが保持される利点があります。つまり、中間ファイルに保存して復元する必要なくグラフを構築できます。
お好みのエディタを使用して、`example.pown` という名前のファイルを以下の内容で作成してください。```sh
echo This is script
recon add --node-type brand target
recon t auto
pown からスクリプトを実行:```sh $ pown script path/to/example.pown
詳細については、`./examples`を参照してスクリプトの使用方法のアイデアを得てください。
## Selectors
> 一部のコマンドはグラフセレクタを期待します。このドキュメントの残りの部分は、cytoscape.jsセレクタマニュアルのコピーであり、若干の違いがあります。
セレクタは、DOM要素に対するCSSセレクタと同様に機能しますが、Reconのセレクタは代わりにグラフ要素のコレクションに対して機能します。このメカニズムは、強力なcytoscape.jsによって提供されています。
セレクタは組み合わせて強力なクエリを作成できます。例えば:```
pown select 'node[weight >= 50][height < 180]'
セレクタはカンマで結合(論理ORを作成)できます。``` pown select 'node#j, edge[source = "j"]'
文字列は引用符で囲む必要があることに注意することが重要です:```
pown select 'node[type = "domain"]'
Note that metacharacters ( ^ $ \ / ( ) | ? + * [ ] { } , . ) need to be escaped:
pown select '#some\$funky\@id'
node, edge, or * (group selector) Matches elements based on group (node for nodes, edge for edges, * for all)..className Matches elements that have the specified class (e.g. use .foo for a class named "foo").#id Matches element with the matching ID (e.g. #foo is the same as [id = 'foo'])[name] Matches elements if they have the specified data attribute defined, i.e. not undefined (e.g. [foo] for an attribute named “foo”). Here, null is considered a defined value.[^name] Matches elements if the specified data attribute is not defined, i.e. undefined (e.g [^foo]). Here, null is considered a defined value.[?name] Matches elements if the specified data attribute is a truthy value (e.g. [?foo]).[!name] Matches elements if the specified data attribute is a falsey value (e.g. [!foo]).[name = value] Matches elements if their data attribute matches a specified value (e.g. [foo = 'bar'] or [num = 2]).[name != value] Matches elements if their data attribute doesn’t match a specified value (e.g. or ).> (child selector) Matches direct children of the parent node (e.g. node > node). (descendant selector) Matches descendants of the parent node (e.g. node node).$ (subject selector) Sets the subject of the selector (e.g. $node > node to select the parent nodes instead of the children).A complex type of selection is known as traversal.
Here are some of the transforms available in Recon. Additional transforms are available in optional pown modules.
To demonstrate the power of Recon and graph-based OSINT (Open Source Intelligence), let's have a look at the following trivial example.
Let's start by querying everyone who is a member of Google's engineering team and contributes to their GitHub account.```sh pown recon t -w google.network ghlm google
このコマンドは以下のようなテーブルを生成します:```
github:member
┌─────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────┐
│ uri │ login │ avatar │
├─────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────┤
│ https://github.com/3rf │ 3rf │ https://avatars1.githubusercontent.com/u/1242478?v=4 │
├─────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────┤
│ https://github.com/aaroey │ aaroey │ https://avatars0.githubusercontent.com/u/31743510?v=4 │
├─────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────┤
│ https://github.com/aarongable │ aarongable │ https://avatars3.githubusercontent.com/u/2474926?v=4 │
...
...
...
│ https://github.com/alexpennace │ alexpennace │ https://avatars1.githubusercontent.com/u/2506548?v=4 │
├─────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────┤
│ https://github.com/alexv │ alexv │ https://avatars0.githubusercontent.com/u/30807372?v=4 │
├─────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────┤
│ https://github.com/alexwhouse │ alexwhouse │ https://avatars3.githubusercontent.com/u/1448490?v=4 │
└─────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────┘
最初のネットワークを作成しました!
表形式で表示されていますが、実際にはノードがエッジで接続されたモデルが背後にあります。
その様子を知りたい場合は、SecApps Recon を使用できます。コマンドラインには、グラフの複雑さを表現するために必要な対話性が備わっていません。
-w google.network コマンドラインオプションでネットワークをファイルにエクスポートしました。ファイルを直接 SecApps Recon に読み込むには、ファイルを開く機能を使用します。結果は次のようになります:
次に、これらの Google エンジニアがどのリポジトリで作業しているかを問い合わせたいとします。これは簡単です。まず、グラフ内のノードを選択し、次に「GitHub List Repositories」変換でそれらを変換する必要があります。コマンドラインからは次のように行います:```sh pown recon t ghlr -r google.network -w google2.nework -s 'node[type="github:member"]'
GitHub APIのレート制限に達しなければ、次のように表示されます:```
github:repo
┌──────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────┐
│ uri │ fullName │
├──────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────┤
│ https://github.com/3rf/2015-talks │ 3rf/2015-talks │
├──────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────┤
│ https://github.com/3rf/codecoroner │ 3rf/codecoroner │
├──────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────┤
│ https://github.com/3rf/DefinitelyTyped │ 3rf/DefinitelyTyped │
...
...
...
│ https://github.com/agau4779/ultimate-tic-tac-toe │ agau4779/ultimate-tic-tac-toe │
├──────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────┤
│ https://github.com/agau4779/worm_scraper │ agau4779/worm_scraper │
├──────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────┤
│ https://github.com/agau4779/zsearch │ agau4779/zsearch │
└──────────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────────┘
今や2つのファイル google.network と google2.network がありますので、これらの違いが何か気になるかもしれません。では、そのためのツールがあります。```sh
pown recon diff google.network google2.network
これで分かりました!この機能は、大規模な偵察マップを構築していて、主要な違いを把握したい場合に非常に便利です。毎日同じ偵察を実行するcronジョブがあり、さらに調査する価値がある新しい何かが現れたかどうかを知りたいと想像してみてください。こんにちは、バグ報奨金ハンターの皆さん!
[foo != 'bar'][num != 2][name > value] Matches elements if their data attribute is greater than a specified value (e.g. [foo > 'bar'] or [num > 2]).[name >= value] Matches elements if their data attribute is greater than or equal to a specified value (e.g. [foo >= 'bar'] or [num >= 2]).[name < value] Matches elements if their data attribute is less than a specified value (e.g. [foo < 'bar'] or [num < 2]).[name <= value] Matches elements if their data attribute is less than or equal to a specified value (e.g. [foo <= 'bar'] or [num <= 2]).[name *= value] Matches elements if their data attribute contains the specified value as a substring (e.g. [foo *= 'bar']).[name ^= value] Matches elements if their data attribute starts with the specified value (e.g. [foo ^= 'bar']).[name $= value] Matches elements if their data attribute ends with the specified value (e.g. [foo $= 'bar']).@ (data attribute operator modifier) Prepended to an operator so that is case insensitive (e.g. [foo @$= 'ar'], [foo @>= 'a'], [foo @= 'bar'])! (data attribute operator modifier) Prepended to an operator so that it is negated (e.g. [foo !$= 'ar'], [foo !>= 'a'])[[]] (metadata brackets) Use double square brackets in place of square ones to match against metadata instead of data (e.g. [[degree > 2]] matches elements of degree greater than 2). The properties that are supported include degree, indegree, and outdegree.