
このガイドの目的は非常にシンプルです - サイバーセキュリティに興味がある人なら誰でも、知識レベルに関係なく、Netlas.io を最大限に活用する方法を教えることです。
このガイドの目的は、サイバーセキュリティに興味があるすべての人(知識レベルを問わず)が、Netlas Search Toolsを最大限に活用できるようにすることです。これは長文の読み物です。できるだけ多くのシンプルなユースケースを集め、それらを自動化する方法を示しました。
⭐️ 私たちにスターを送って感謝を示してください
👁️ 更新情報を購読する
Netlasは、インターネット上で利用可能なすべてのIPアドレスとドメインに関する情報を検索・分析するために設計された検索エンジンです。Netlasには攻撃対象領域管理機能もありますが、このガイドでは主にNetlas Search Toolsと、それらを自動化で使用する方法に焦点を当てています。
Netlasにはいくつかの検索ツールが含まれています:
主にResponses search(インターネットスキャン結果)を使用しますが、すべてのツールは同じように動作します。Responses Search Toolの使い方を理解すれば、他のツールも扱えるようになります。
技術的な詳細に入る前に、いくつかの簡単な例でNetlas.ioの動作を見てみましょう。

Netlas.io IP/Domain infoを開き、ドメイン名またはIPを入力します。結果として以下の情報が表示されます:

中国語など国際化ドメイン名を検索する必要がある場合は、Punycodeに変換します。例えば:``` domain:*.xn--fiqs8s
この作業は、専用のオンラインツールを使用して行うことができます。例 - [Charset.org](https://www.charset.org/punycode)
### 特定の単語をタイトルに含むウェブサイトを検索する

[Netlas.io レスポンス検索](https://app.netlas.io/responses/) を開き、次のように入力します:```
http.title:g*thub
これにより、HTTPタイトルに「g」で始まり「thub」で終わる単語が含まれるすべてのサーバーが見つかります。ワイルドカードの使い方の詳細は以下をご覧ください。
それでは、Netlas.io での検索クエリの仕組みについて詳しく学びましょう。
Netlas.io は Elasticsearch をベースとしており、これは無料でオープンな分散型RESTful検索エンジンです。Netlas.io の検索方法は、他のElasticsearchベースのデータベースと非常に似ています。

Response、DNS、IP、および証明書の検索では、検索クエリにフィルター(フィールド)を使用できます。例:``` http.body:netlas
[Netlasで試す](https://app.netlas.io/responses/?q=http.body%3Anetlas&page=1&indices=)
このクエリを使用すると、`<body>` HTMLタグ内に「netlas」という単語を含むページを見つけることができます。
各検索タイプで利用可能なフィルタの一覧は、ページの右側に表示されます。

フィルタを使用すると、さまざまなパラメータに基づいてサーバを検索できます。例:
* `domain`
* `ip`
* `protocol`
* `certificate`
* `cve`
* `geolocation` (`city`, `continent`, `country`)
その他多数。
### 論理演算子
単一のクエリで複数のフィルタを使用し、論理演算子`AND`、`OR`、`NOT`を使って組み合わせることができます。例:```
http.title:netlas NOT port:443
クエリで複数の条件を組み合わせたい場合は、括弧を使用してください:``` http.title:(netlas OR shodan) NOT port:443
[Netlasで試す](https://nt.ls/OrFOY)
### 範囲
フィールドの値として数値を使用する場合、その値を範囲の最小値と最大値(値範囲の極限)として指定できます:```
ip:[173.194.222.0 TO 173.194.222.255]
または、値の上限または下限のみを指定します:``` host:"1.1.1.1" port:<=1000
[Try in Netlas](https://app.netlas.io/responses/?q=host%3A%221.1.1.1%22%20port%3A%3C%3D1000&page=1&indices=)
### ワイルドカード
クエリ内の特定の文字の正確な記述がわからない場合(たとえば、ドメインのゾーンや名前のスペルが不明な場合)、アスタリスクに置き換えることができます。```
domain:google.*
クエスチョンマークも使用できます:``` domain:google.?
[Netlasで試す](https://app.netlas.io/responses/?q=domain%3Agoogle.%3F&page=1&indices=)
`*` - 多くの記号、`?` - 1つの記号。
フィルター内でもアスタリスクを使用できます。例:```
\*.banner:database
このクエリは、すべてのバナー種別を同時に検索し、amqp.banner:、ftp.banner:、dns.banner:、telnet.banner: などの複数のフィルタを置き換えます。

フィールドの正確な値ではなく、おおよその値で検索する必要がある場合(例えば、タイトルに Joseph と類似した名前をすべて含むページなど)、クエリに ~ を追加します。```
http.title:Joseph~
[Try in Netlas](https://app.netlas.io/responses/?q=http.title%3AJoseph~&page=1&indices=)
### 正規表現
正規表現とは、特定のパターンに一致するソースドキュメント内のテキスト部分を検索、抽出、置換するための文字の並びです。例えば:
* 任意の電子メールアドレス: ```text
([a-zA-Z0–9+._-]+@[a-zA-Z0–9._-]+\.[a-zA-Z0–9_-]+)
正規表現の使用に関する詳細は、Netlas Cookbook(現在お読みいただいているもの)の例と、以下のリンクを参照してください。
ElasticsearchドキュメントのRegex構文マニュアル
OSINTにおける正規表現の有用性。理論とGoogle Sheetsを使った実践

結果(すべてのフィールドまたは選択したフィールド)をJSONおよびCSV形式で保存し、好みの形式で表示したり、さまざまなツールで自動的に分析したりできます。

ドメイン名や地理位置情報など、異なるフィールド値で結果をグループ化して、検索時間を短縮できます。

検索結果へのリンクは自由に共有できます(開くのに登録は不要ですが、無料枠の50リクエストを超えた場合は制限があります)。

また、行ったすべてのクエリはプロフィールページ(右上のリンク)で確認できることも覚えておいてください。
Netlas.ioの最も重要な機能は、サイバーセキュリティ調査をより迅速かつ効率的に行えるようにすることです。このサービスにはAPI(アプリケーションプログラミングインターフェース)があり、さまざまなリクエストの実行を自動化できます。
これは、数行の簡単なPythonやBashスクリプトから、複雑な多機能アプリケーションまで、さまざまな形で実装できます。
Netlas APIの使用に関する詳細は、Netlas Cookbook(現在お読みいただいているもの)または公式ドキュメントをご覧ください:
APIを使い始めるには、まさにここが最初のポイントです。購読料を支払う必要さえありません(1日50リクエストは無料です)。プロフィールページにアクセスしてください。

Netlas APIを使い始めるために、スクリプトを書いたりアプリケーションを作成する必要はありません。お気に入りのAPIクライアントを使って簡単にテストできます。こちらの手順を参照してください。

他のAPIと同様に、Netlas APIのレスポンスはヘッダーとJSON(JavaScript Object Notation)形式のレスポンスボディで構成されます。JSONファイルはキーと値の形式でデータを含み、ほぼすべてのプログラミング言語で分析できます。
Swaggerを使用している場合は、レスポンスボディをコピーまたはダウンロードして、任意のテキストエディタやJSONアナライザで表示できます。

Netlas APIを使ったコードを書く際に役立つちょっとしたヒントです。JSONファイルの構造をより速く理解し、特定の値を取得するためのパスを見つけるには、以下のような特別なツールを使用してください:
Netlas APIへのリクエストを自動化する最も簡単な方法は、専用に設計されたPythonライブラリ(パッケージ)を使用することです。
Netlas-Python ライブラリの GitHub リポジトリ
簡単な例で動作を確認してみましょう。Netlas Cookbookのすべてのコードサンプルはscriptsフォルダにあります。このリポジトリをクローンして、お使いのデバイスで実行できます:```shell git clone https://github.com/netlas-io/netlas-cookbook
まだ今日までにPythonスクリプトを実行したことがなく、その方法がわからない場合は、まずNetlas CookBookリポジトリをGitpodで開くことから始められます。
GitpodはUbuntu(Linuxディストリビューション)ベースのクラウド開発環境です。以下のリンクをブラウザで開いてください(Githubアカウントでログイン):
[Run Netlas Cookbook in Gitpod](https://gitpod.io#https://github.com/netlas-io/netlas-cookbook)

pip(Pythonのパッケージインストーラー)を使用してNetlas Pythonライブラリをインストールします。コマンドラインで入力してください:```shell
pip install netlas
インストールを確認してください。コマンドラインで次を入力してください:```shell netlas --help
netlas_python_example.py を実行:```shell
python3 scripts/netlas_python_example.py
もちろん、コードをコピーしてファイルに保存することもできます。最初の例のコードは次のとおりです。```python import netlas
apikey = "YOUR API KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
port:7001netlas_query = netlas_connection.query(query="port:7001")
for response in netlas_query['items']: print(f"{response['data']['ip']}:{response['data']['port']}{response['data']['path']} [{response['data']['protocol']}]")
### 便利なデータ取得のためのレスポンスキーの例
先に述べたように、APIレスポンスのJSONパッチを見つけて必要なデータを取得するには、特別なオンラインアプリケーション(JSON-evaluators)を使用できます。さらに便利にするために、最もよく必要とされるPythonライブラリのレスポンスキーの例をいくつか挙げておきます。```python
# Main domain/ip info
response['data']['uri']
response['data']['ip']
response['data']['http']['title']
response['data']['http']['meta']
response['data']['http']['body']
# Geo info
response['data']['geo']['continent']
response['data']['geo']['country']
response['data']['geo']['city']
response['data']['geo']['location']['lat']
response['data']['geo']['location']['long']
# Whois geo info
response['data']['whois']['net']['country']
response['data']['whois']['net']['address']
response['data']['whois']['net']['city']
response['data']['whois']['net']['contacts']['emails']
response['data']['whois']['net']['contacts']['phones']
# Http status and favicon ico info
response['data']['port']
response['data']['http']['status_code']
response['data']['http']['status_line']
response['data']['http']['favicon']['image']
response['data']['http']['favicon']['path']
# Basic CVE info
response['data']['cve'][0]['name']
response['data']['cve'][0]['description']
response['data']['cve'][0]['base_score']
response['data']['cve'][0]['has_exploit']
response['data']['cve'][0]['exploit_links']

Netlas Python ライブラリを使用する際、取得したいデータのタイプを正しく指定することが非常に重要です。デフォルトでは response タイプが返され、多くの Netlas CookBook の例でこれが使用されています。
しかし、ドメインの whois 情報を取得したり、サブネット内のドメインを検索したりするような一部のタスクでは、別のデータタイプを使用する必要があります。例:```python netlas_query = netlas_connection.query(query='a:"163.114.132.0/24"',datatype="domain")
クエリが結果を返すべきなのに返していないと思われる場合は、**datatype** パラメータの値を変更してみてください。これで解決する可能性が非常に高いです。
利用可能なデータタイプ:
- **datatype="response"** は、[Netlas Responses Search](https://app.netlas.io/responses/) で取得できる結果に対応します。
- **datatype="domain"** は、[Netlas DNS search](https://app.netlas.io/domains/) で取得できる結果に対応します。
- **datatype="domain-whois"** は、[Netlas Domain Whois Search](https://app.netlas.io/whois_domains/) で取得できる結果に対応します。
- **datatype="ip-whois"** は、[Netlas IP Whois Search](https://app.netlas.io/whois_ip/) で取得できる結果に対応します。
- **datatype="cert"** は、[Netlas Certificates Search](https://app.netlas.io/certs/) で取得できる結果に対応します。
### Netlas CLI Tools

Netlas Python ライブラリをコマンドラインから直接使用することもできます。例:```bash
netlas search "http.title:johnsmith" -f json >results.json
このシンプルなコマンドは、ヘッダーに「johnsmith」という単語を含むすべてのサーバーを検索し、結果をJSON形式で返し、その結果をresutls.jsonファイルに保存します。
Netlas APIの他のすべての機能も同じ方法で使用できます。詳細については、ヘルプ(-hコマンド)およびNetlas Cookbook(今お読みいただいているもの)の例を参照してください。``` Usage: netlas [OPTIONS] COMMAND [ARGS]...
Options: -h, --help Show this message and exit.
Commands: count Calculate count of query results. download Download data. host Host (ip or domain) information. indices Get available data indices. profile Get user profile data. savekey Save API key to the local system. search (query) Search query. stat Get statistics for query.
さまざまなNetlas CLI Toolsコマンドを実行する前に、設定にAPI keyを保存してください:```bash
netlas savekey YOUR_API_KEY
また、bashスクリプトとNetlas CLIツールを使用してさまざまなタスクを自動化する例を含むGitHubリポジトリもあります:
Netlas APIには多くのメソッドがありますが、最も一般的に使用されるのは検索(search)とダウンロード(download)です。これらは非常に似ていますが、いくつかの違いがあります。
検索メソッドは一度に1ページ(20件)の結果を読み込み、最大200ページ(20*200=4000件)まで読み込むことができます。ダウンロードメソッドはすべての結果をダウンロードします(ただし、実行により多くのリソースを必要とします)。
また、ホストメソッドは特定のドメインやIPに関する最も基本的な情報を返すだけです(データタイプ(他のメソッドと同様)を指定する必要はありません):```bash netlas host "51.159.153.170"
### 追加リクエストパラメータ
Netlas APIでは、追加パラメータを使用してリクエストで返されるデータを柔軟に調整できます。例:
* indices - 特定のインデックス日付に対応するID。特定の日付のIDを確認するには、app.netlas.ioを開き、検索クエリ入力バーの右側にあるカレンダーをクリックし、関心のある日付を選択し、ブラウザのアドレスバーのURL内のindicesパラメータがどのように変化するかを確認します。
* start - 結果のページ番号(デフォルトは0)
* fields - 結果に含めるフィールドの名前(デフォルトでは全てのフィールド)。多数のリクエストを行う際にコードの高速化と最適化に役立ちます。
### Pythonでリクエストを作成する(Netlas Pythonライブラリを使用しない場合)
場合によっては、Netlas Pythonライブラリを使用せず、多くの開発者になじみのある標準のPythonリクエストパッケージを使用する方が簡単な場合があります。
コマンドラインで入力:```bash
python scripts/python_example.py
python_example.pyのソースコード:```python import requests
response = requests.get("https://app.netlas.io/api/domains/?q=ivanov.com&source_type=include&start=0&fields=*",{'X-API-Key': 'YOUR API KEY'})
print(response.json())
しかし、Netlas Python Libraryは、クエリ処理における様々な問題(エラー、長時間待機など)に対応するように設計されているため、依然として推奨されます。
### 他のプログラミング言語向けの例
当社ではNetlas検索の自動化にPython Libraryの使用を推奨していますが、Netlas APIは多種多様なテクノロジースタックを持つほとんどのアプリケーションに組み込むことが可能です。重要なのは、**RESTリクエスト**を実行し、**JSON**データを解析できることです。
以下に、様々な人気プログラミング言語での例を示します。
#### NodeJS <!-- omit in toc -->

コマンドラインで入力してください:```bash
node scripts/node_example.js
Gitpodを使用していない場合は、デバイスにNodeJSをインストールしておく必要があります。
nodejs_example.jsのソースコード:```javascript fetch('https://app.netlas.io/api/domains/?q=ivanov.com&source_type=include&start=0&fields=*', { headers: { "X-API-Key": "YOUR_API_KEY", }, }) .then((response) => response.text()) .then((body) => { var jsonArray = JSON.parse(body); console.log(jsonArray['items'][0]); });
#### Ruby <!-- omit in toc -->

コマンドラインで入力してください:```bash
ruby scripts/ruby_example.rb
Gitpod を使用していない場合は、デバイスに Ruby をインストールしておく必要があります。
ruby_example.rb のソースコード:```ruby require 'net/http' require 'uri' require 'json'
uri = URI("https://app.netlas.io/api/domains/?q=ivanov.com&source_type=include&start=0&fields=*") req = Net::HTTP::Get.new(uri) req['X-API-Key'] = "YOUR_API_KEY"
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') { |http| http.request(req) }
jsonArray = JSON.parse(res.body)
puts jsonArray['items'][0]['data']['domain']
#### Bash <!-- omit in toc -->

コマンドラインで入力:```bash
bash scripts/bash_example.sh
bash_example.shのソースコード:```
curl -X 'GET'
'https://app.netlas.io/api/domains/?q=ivanov.com&source_type=include&start=0&fields=*'
-H 'accept: application/json'
-H 'X-API-Key: YOUR_API_KEY' | jq .items[0].data.last_updated
### JQユーティリティ
上記の例では、JQユーティリティを使用してJSONデータからフィールドを抽出したことに注意してください。
「JSONデータのためのsedのようなもの」と呼ばれることもあります。これは、あらゆるJSONデータを扱う際に驚くほど便利なツールです。以下に構文の例を示します。
JSON配列の最初のアイテムを出力:```
.items[0]
JSON配列のすべての項目を表示します:``` .items[]
JSON配列の最初の項目のすべての 'data' サブ項目を表示:```
.['items'][0]['data'][]
JSON-arrayの各アイテムのすべてのサブサブアイテムを表示する:``` .items[].data.technical[]
JQの詳細はこちらをご覧ください(データフィルタリングに特に注意することをお勧めします):[JQユーティリティドキュメント](https://jqlang.github.io/jq/)
### コード作成のためのAIツール

Netlas Cookbookの例をカスタマイズする際に問題が発生した場合は、コードの改善や作成のためにAIツールの助けを求めることをお勧めします。例:
[ChatGPT](https://chatgpt.com)
[Code Llama](https://huggingface.co/spaces/codellama/codellama-playground)
[You.com](https://you.com/)
このようなサービスを利用する際は、コードを使って解決したいタスクを言葉で説明するだけで十分です。
### コードチェッカー

Netlas Cookbookの例を自分の目的に合わせて作り直すと、コードがエラーで実行されない場合があります。特別なオンラインツールがそれらを見つけて修正するのに役立ちます:
[ExtendsClass Python Tester](https://extendsclass.com/python-tester.html)
[Snyk](https://snyk.io/code-checker/python/)
コードをサードパーティサービスにコピーしたくない場合は、Pylint(静的コードアナライザ)を使用して自分のデバイスでエラーをチェックできます:
[Pylint Python Package](https://pypi.org/project/pylint/)
## OSINT(オープンソースインテリジェンス)のためのNetlas.ioの使用

Netlas.ioは、ドメインや企業に関するデータを収集したり、インターネット上の人物(または誰でも)の言及を見つけるのに役立ちます。
また、Webページの古いバージョンを見つけるためにも使用できます(Wayback Machineの類似品として)。
### WHOIS連絡先での個人のニックネームまたはメールアドレスの検索
ほとんどの場合、WHOISデータにはドメインを登録する企業の連絡先情報のみが含まれています。しかし、時には関心のある人物の個人連絡先が含まれていることもあります。このクエリはそれらを見つけるのに役立ちます。
*この方法は有料サブスクリプションが必要な場合があります。* [料金を見る](https://netlas.io/pricing/)
**検索クエリの例**
```
whois.related_nets.contacts.emails:sweetwater
APIリクエスト例
Netlas CLIツール:```bash netlas search "whois.related_nets.contacts.emails:sweetwater*" -f json
Curl:```bash
curl -X 'GET' \
'https://app.netlas.io/api/responses/?q=whois.related_nets.contacts.emails%3Asweetwater*&fields=' \
-H 'accept: application/json' \
-H 'X-API-Key: aqkd8L4MR93Tkcaz2UXDXrRleV8Vlvbv' | jq .items[].data.uri
コード例 (Netlas Python ライブラリ)

コマンドラインで実行:```bash python scripts/osint/whois_email_search.py
scripts/osint/whois_email_search.py のソースコード:```python
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `whois.related_nets.contacts.emails:sweetwater`
netlas_query = netlas_connection.query(query="whois.related_nets.contacts.emails:sweetwater*")
# iterate over data and print: URL, Country, Related nets data
for response in netlas_query['items']:
print (response['data']['uri'])
print (response['data']['geo']['country'])
print (response['data']['whois']['related_nets'])
Netlasを使用すると、Webページの見出しやHTMLコード内の特定の単語の言及を検索できます。完全一致、あいまい一致(あいまいクエリのセクションを参照)で単語を検索したり、確信が持てない文字をアスタリスクに置き換えたりすることができます。
検索クエリの例
```
http.title:sweetwater OR http.body:sweetwater
[Netlasで試す](https://app.netlas.io/responses/?q=http.title%3Asweetwater%20OR%20http.body%3Asweetwater&page=1&indices=)
**APIリクエスト例**
Netlas CLIツール:```bash
netlas search "http.title:sweetwater OR http.body:sweetwater" -f json
Curl:```bash
curl -X 'GET'
'https://app.netlas.io/api/responses/?q=whois.related_nets.contacts.emails%3Asweetwater*&fields='
-H 'accept: application/json'
-H 'X-API-Key: YOUR_API_KEY' | jq .items[].data.uri
**コード例 (Netlas Python Library)**

コマンドラインで実行:```bash
python scripts/osint/title_body_search.py
scripts/osint/title_body_search.py のソースコード:```python import netlas
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
http.title:sweetwater OR http.body:sweetwaternetlas_query = netlas_connection.query(query="http.title:sweetwater OR http.body:sweetwater*")
for response in netlas_query['items']: print (response['data']['ip']) print (response['data']['uri']) print (response['data']['http']['title'])
### 会社のWebサイトのサブドメインで「Juicy Info Files」を検索

Metagoofilは、長年にわたりOSINT実践者の間で人気のツールです。これは、会社のWebサイト上のドキュメントファイル(pdf、xlsx、docxなど)をGoogleで検索し、そのメタデータを分析します。
そして、Googleにインデックスされていないものは、Netlasを使用して見つけ、コンピュータにダウンロードして、[MetaDetective](https://github.com/franckferman/MetaDetective)ツールで分析することができます。```
uri:*lidl.* AND http.body:pdf
uri:フィルタをdomain:やhost:に置き換えることもできます(これらの3つのフィルタを使用する際は、常に結果を比較することをお勧めします)。
また、探したい内容に応じて、さまざまなファイル拡張子を検索することもできます。例:``` http.body:xls http.body:xlsx http.body:doc http.body:docx http.body:ppt http.body:pptx http.body:mdb http.body:csv http.body:sql http.body:sqlite
**APIリクエスト例**
Netlas CLIツール:```bash
netlas search "uri:*lidl.* AND http.body:pdf"
Curl:```bash
curl -X 'GET'
'https://app.netlas.io/api/responses/?q=uri%3A*lidl.*%20AND%20http.body%3Apdf&source_type=include&start=0&fields=*'
-H 'accept: application/json'
-H 'X-API-Key: 'YOUR_API_KEY' | jq .items[].data.domain
**コード例 (Netlas Python Library)**

コマンドラインで実行:```bash
python scripts/osint/juicyinfo_search.py
scripts/osint/juicyinfo_search.py のソースコード:```python import netlas
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
uri:*lidl.* AND http.body:pdfnetlas_query = netlas_connection.query(query='uri:lidl. AND http.body:pdf')
for response in netlas_query['items']: print (response['data']['uri']) print (response['data']['http']['body'])
In order to automate links to PDF documents from the web page body you can use the Python [Re](https://docs.python.org/3/library/re.html) package.
### Phone Number Mentions Search
As with nicknames and emails, you can also look for mentions of a phone number in the code of web pages or WHOIS contact information.
We single out this task as a separate example, because searching for a phone number is complicated by the fact that it can be written in different formats.
**Search query example**
```
http.body:1?234?567?89?99 OR http.body:12345678999 OR http.body:1234?5678?999
リクエストを行う際には、対象の電話番号を所有する国で受け入れられている電話番号の記録形式を考慮する必要があります。
APIリクエスト例
Netlas CLI ツール:```bash netlas search "http.body:1?234?567?89?99 OR http.body:12345678999 OR http.body:1234?5678?999" -f json
ページ本文だけでなく、WHOISの連絡先情報でも電話番号を検索できることをお忘れなく。これは **whois.related_nets.contacts.phones:** フィルターを使用して行うことができます。
Curl:```bash
curl -X 'GET' \
'https://app.netlas.io/api/responses/?q=http.body%3A1%3F234%3F567%3F89%3F99%20OR%20http.body%3A12345678999%20OR%20http.body%3A1234%3F5678%3F999&source_type=include&start=0&fields=*' \
-H 'accept: application/json' \
-H 'X-API-Key: YOUR_API_KEY' jq .items[].data.uri
コード例(Netlas Pythonライブラリ)

コマンドラインで実行:```bash python scripts/osint/phonenumber_search.py
scripts/osint/phonenumber_search.py のソースコード:```python
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `http.body:1?234?567?89?99 OR http.body:12345678999 OR http.body:1234?5678?999`
netlas_query = netlas_connection.query(query="http.body:1?234?567?89?99 OR http.body:12345678999 OR http.body:1234?5678?999")
# iterate over data and print: ip, url
for response in netlas_query['items']:
print (response['data']['ip'])
print (response['data']['uri'])
あなたがミュージシャンで、自分のトラックが投稿されているすべてのサイトを見つけたいと想像してみてください。これは、あなたの名前が言及されており、.mp3拡張子のファイルへのリンクがあるページを検索することで実現できます。
検索クエリの例
```
(http.title:alla OR http.body:alla) AND http.body:*.mp3
[Netlasで試す](https://nt.ls/HEhJj)
**APIリクエストの例**
Netlas CLI ツール:```bash
netlas search "(http.title:alla OR http.body:alla) AND http.body:*.mp3" -f json
Curl:```bash
curl -X 'GET'
'https://app.netlas.io/api/responses/?q=(http.title%3Aalla%20OR%20http.body%3Aalla)%20AND%20http.body%3A*.mp3&source_type=include&start=0&fields=*'
-H 'accept: application/json'
-H 'X-API-Key: YOUR_API_KEY' | jq .items[].data.http.title
**コード例(Netlas Pythonライブラリ)**

コマンドラインで実行:```bash
python scripts/osint/file_mentions_search.py
scripts/osint/file_mentions_search.pyのソースコード:```python import netlas
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
(http.title:alla OR http.body:alla) AND http.body:*.mp3netlas_query = netlas_connection.query(query="(http.title:alla OR http.body:alla) AND http.body:*.mp3")
for response in netlas_query['items']: print (response['data']['ip']) print (response['data']['uri']) print (response['data']['http']['title'])
### ドメインWHOIS情報収集
WHOISは、世界中の全登録ドメインに関する情報を保存する世界的な公開データベースです。
**検索クエリの例**

[WHOISドメイン検索](https://app.netlas.io/whois_domains/)```
github.com
APIリクエストの例
Netlas CLI Tools:```bash netlas host github.com -f json
Curl:```bash
curl -X 'GET' \
'https://app.netlas.io/api/whois_domains/?q=github.com&source_type=include&start=0&fields=*' \
-H 'accept: application/json' \
-H 'X-API-Key: YOUR_API_KEY' | jq .items[].data.technical.street
コード例 (Netlas Python Library)

コマンドラインで実行:```bash python scripts/osint/whois_search.py
scripts/osint/whois_search.pyのソースコード:```python
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from whois for google.com domain
netlas_query = netlas_connection.query(query="google.com",datatype="whois-domain")
# iterate over data and print: owner name
for response in netlas_query['items']:
print (response['data']['technical']['name'])
<address> タグは Web ページの <head> タグ内にあり、物理的な住所を含む場合があります。このタグを使用した検索により、特定の通り、場合によっては特定の建物に関連付けられたサイトを見つけることができます。
検索クエリの例
```
http.contacts.address:kirby
[Try in Netlas](https://app.netlas.io/responses/?q=http.contacts.address%3Akirby&page=1&indices=)
メール検索にはhttp.contacts.email:も使用できます。
**APIリクエスト例**
Netlas CLIツール:```bash
netlas search "http.contacts.address:kirby" -f json
Curl:```bash
curl -X 'GET'
'https://app.netlas.io/api/responses/?q=http.contacts.address%3Akirby&source_type=include&start=0&fields=*'
-H 'accept: application/json'
-H 'X-API-Key: 'YOUR_API_KEY' | jq .items[].data.http.contacts
**コード例(Netlas Pythonライブラリ)**

コマンドラインで実行:```bash
python scripts/osint/contacts_search.py
scripts/osint/contacts_search.py のソースコード:```python import netlas
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
http.contacts.address:kirbynetlas_query = netlas_connection.query(query="http.contacts.address:kirby")
for response in netlas_query['items']: print (response['data']['uri']) print (response['data']['http']['contacts'])
### メタタグ内の著者名を検索
`<meta>` タグはウェブページの `<head>` タグ内にあり、最も重要なキーワード、説明、その他のサービス情報、著者名を含んでいます。
メタタグ(http.meta)によるニックネームや姓名の検索は、HTMLコード全体(http.body)を検索するよりも、特定の人物に関連するサイトをより迅速に見つけることができます。
**検索クエリの例**
```
http.meta:nazar
APIリクエストの例
Netlas CLI ツール:```bash netlas search "http.meta:nazar" -f json
Curl:```bash
curl -X 'GET' \
'https://app.netlas.io/api/responses/?q=http.meta%3Anazar&source_type=include&start=0&fields=*' \
-H 'accept: application/json' \
-H 'X-API-Key: YOUR_API_KEY' | jq .items[].data.http.meta
コード例(Netlas Pythonライブラリ)

コマンドラインで実行:```bash python scripts/osint/author_meta_search.py
scripts/osint/author_meta_search.pyのソースコード:```python
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `http.meta:nazar`
netlas_query = netlas_connection.query(query="http.meta:nazar")
# iterate over data and print: ip, url
for response in netlas_query['items']:
print (response['data']['uri'])
print (response['data']['http']['title'])
print (response['data']['http']['meta'])
著者名に加えて、メタタグにはさまざまな情報が含まれる可能性があります:エンコーディング、言語、検索エンジンのロボットによるページインデックス許可、ソーシャルネットワークのリンクカード用テキスト、OpenGraphメタデータなどです。以下は調査に役立つ可能性のあるメタタグのさらなる例です:
<meta name="description"> - Webページの内容の説明。<meta name="keywords"> - Webページの内容を説明するキーワード。<meta name="generator"> - ページ内容の生成に使用されたツールの名前(CMSやホスティングプラットフォームの検索に有用)。<meta name="copyright"> - Webページの内容の著作権を保有する個人または会社の名前。個人や企業に関する情報を見つけるもう一つの重要なステップは、FTPサーバーのバナーテキスト内でその言及を探すことです。見つかったサーバーのIPアドレスが、関心のある個人や企業に関連する他のサイトを見つける鍵となる可能性があります。そして非常に運が良ければ、そこに公開されているファイル(FTPサーバーがオープンな場合)に何か興味深いものを見つけるかもしれません。
検索クエリ例
```
ftp.banner:"Collado"
別のパラメータ(都市やIPアドレス範囲など)でFTPサーバーを検索する必要がある場合は、`prot7:ftp`フィルタを使用します。
[Netlasで試す](https://app.netlas.io/responses/?q=ftp.banner%3A%22Collado%22%20&page=1&indices=)
**APIリクエストの例**
Netlas CLI Tools:```bash
netlas search 'ftp.banner:"Collado"' -f json
クエリで二重引用符を使用する場合、クエリ自体は単一引用符で記述されることに注意してください。
Curl:```bash
curl -X 'GET'
'https://app.netlas.io/api/responses/?q=ftp.banner%3A%22Collado%22&source_type=include&start=0&fields=*'
-H 'accept: application/json'
-H 'X-API-Key: YOUR_API_KEY' | jq .items[].data.uri
**Code example (Netlas Python Library)**

コマンドラインで実行:```bash
python scripts/osint/ftp_banner_search.py
scripts/osint/ftp_banner_search.py のソースコード:```python import netlas
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
ftp.banner:"Collado"netlas_query = netlas_connection.query(query='ftp.banner:"Collado"')
for response in netlas_query['items']: print (response['data']['ip']) print (response['data']['uri']) print (response['data']['ftp']['banner'])
### SSL証明書の連絡先情報を検索

SSL証明書は、Webサイトを認証し、暗号化接続の使用を可能にするデジタル証明書です。これには、所有者に関する情報(連絡担当者の名前、組織名、国、場合によっては住所や郵便番号)が含まれている場合があります。この情報は、以下のフィルタ(およびその他多数)を使用して検索できます:
- `certificate.issuer.email_address`
- `certificate.issuer.given_name`
- `certificate.issuer.organization`
- `certificate.issuer.postal_code`
- `certificate.issuer.street_address`
- `certificate.issuer.surname`
それでは、証明書の住所に特定の単語が含まれているIPアドレスを検索してみましょう:```
certificate.issuer.street_address:*mcgill*
APIリクエストの例
Netlas CLI ツール:```bash netlas search "certificate.issuer.street_address:mcgill" -f json
Curl:```bash
curl -X 'GET' \
'https://app.netlas.io/api/responses/?q=certificate.issuer.street_address%3A*mcgill*&source_type=include&start=0&fields=*' \
-H 'accept: application/json' \
-H 'X-API-Key: YOUR_API_KEY' jq .items[].data.uri
コード例 (Netlas Python ライブラリ)

コマンドラインで実行:```bash python scripts/osint/certificates_search.py
scripts/osint/certificates_search.py のソースコード:```python
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `certificate.issuer.street_address:*mcgill*`
netlas_query = netlas_connection.query(query="certificate.issuer.street_address:*mcgill*")
print (type(netlas_query))
# iterate over data and print: ip, url, cetificate issuer
for response in netlas_query['items']:
print (response['data']['uri'])
print (response['data']['certificate']['issuer'])
OSINT専門家は、削除された連絡先情報やその他の情報を見つけるために、Webサイトやソーシャルメディアプロフィールページの旧バージョンを検索する際にArchive.orgを使用してきました。
しかし、残念ながらarchive.orgはすべてのサイトのコピーを保存しておらず、頻繁に保存も行いません(一部のサイトでは年に数回、またはそれ以下)。
しかし、Netlasも2021年からサイトの旧バージョンを保存しています!
サイトを検索するために最もよく使用されるフィルターは次のとおりです:``` http.title:"github.com"
domain:github.com
host:github.com

検索クエリを入力するフィールドの右端にあるアイコンをクリックすると、スキャン日付を選択するメニューが表示されます。これを使用して、特定の日付に保存されたサイトのHTMLコードをフィルタリングできます。

サイトの外観を確認するには、「body」フィールド(レスポンスタブ)の内容をテキストエディタにコピーし、HTMLコードから \t\r\n 文字を削除します。

その後、コードをオンラインのHTMLプロモーター([Code beautify](https://codebeautify.org/htmlviewer)など)にコピーします。または、ファイルをhtml形式で保存してからブラウザで開いてください。
### 関連ウェブサイトを検索する9つの方法

個人や企業に関する情報を収集する際、何らかの形で関連する可能性のあるサイトをできるだけ多く見つけることが重要になる場合があります。Netlasでは、これを実行する少なくとも5つの方法があります。
1. 各種サービスのID(分析、広告システム、ソーシャルネットワークや出版システムとの統合用アプリケーション)。これらの重複は、同じ人物またはチームが関与していたことを示す可能性があります。いくつかの例:
Google Analytics:```
http.tracker.google_analytics:"G-X82FSVSMTV"
Google タグ マネージャー:``` http.tracker.google_analytics:"GTM-N6462KFQ"
AddThis:```
http.body:"AT-ra-500bcd681b192302"
Facebookピクセル:``` http.tracker.facebook_pixel:317853189093681
Yandex Metrika```
http.tracker.yandex_metrica:89723437
Amazon Publisher Servies:``` http.body:APS-XXXX
はい、それは一部のサイトのコード内に見られます。
また、その他の多くの識別子も、HTMLコードの先頭(ただし、コードのあらゆる場所にあることもあります)に最も頻繁に見られます。
[Try in Netlas](https://nt.ls/BCrw9)
2. アフィリエイトプログラムのID(検索にはhttp.bodyも使用します)。それらは、他のサイトやソーシャルネットワークで公開されているアフィリエイトリンク内に見られます。これらは、次のようなURLパラメータになります(類似のものも含む):```
aff_fcid=
user_id=
partner_id=
ref_id=
```
"GitHub, Inc."
[Netlasで試す](https://app.netlas.io/whois_domains/?q=%22GitHub%2C%20Inc.%22&page=1&indices=)
4. DNS Netlas検索でのメールサーバーによる検索
```
mx:*.parklogic.com
```
ns:ns?.parklogic.com
[Try in Netlas](https://app.netlas.io/domains/?q=mx%3A*.parklogic.com&page=1&indices=)
6. ファイル(主にユーザーのロゴやアバター)の言及検索 [->](https://github.com/netlas-io/netlas-cookbook#search-file-mentions-looking-for-content-that-may-be-infringing-on-copyrights)
7. サブドメイン検索 [->](https://github.com/netlas-io/netlas-cookbook#search-subdomains)
8. WhoIs 連絡先検索(Netlas 応答検索内) [->](https://github.com/netlas-io/netlas-cookbook#search-persons-nickname-or-email-in-whois-contacts)
9. ファビコン検索 [->](https://github.com/netlas-io/netlas-cookbook#favicon-search)
## スクレイピング(Web ページの本文からデータを抽出)
Netlas API は、連絡先やその他の Web サイトデータを収集するための優れたツールです。まず、迅速に実行できます。次に、プロキシを使用する必要がありません。第三に、現在利用できないサイトからもデータを収集できます。
ただし、いくつかの欠点もあります。Netlas はサイトのメインページのみをスキャンし、保護されているために一部の稀なサイトはデータベースに含まれていません。それでも、非常に役立ちます。
スクレイピングには主に 3 つのアプローチがあります。HTML タグと CSS セレクターから情報を収集する方法、正規表現を使用してデータを抽出する方法、AI スクレイピングです。最初の 2 つについて詳しく見てみましょう。
### Beatifulsoup パッケージ
[Beatifulsoup](https://pypi.org/project/beautifulsoup4/) は、HTML コードと XML ファイルを解析するための世界で最も人気のある Python パッケージの 1 つです。これを使ってページタイトル(\<title> タグではなく \<h1> タグ)を抽出してみましょう。
まず、パッケージをインストールします:```bash
pip install beautifulsoup4
そして、scripts/osint/scraping_beatifulsoup.py を実行してください:```bash python scripts/osint/scraping_beatifulsoup.py

scripts/osint/scraping_beatifulsoup.py のソースコード:```python
import netlas
from bs4 import BeautifulSoup
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `http.body:shop`
netlas_query = netlas_connection.query(query="http.body:shop")
# iterate over data and print: URL, h1 tags from body
for response in netlas_query['items']:
print (response['data']['uri'])
soup = BeautifulSoup(response['data']['http']['body'], "html.parser")
try:
print(soup.find("h1").get_text())
except Exception:
print("no h1 tags")
pass
ウェブページの他の要素からも同様にデータを抽出できます:``` soup.find("h3").get_text() soup.find("id='loginform'").get_text() soup.find("class='forms'").get_text() soup.find("href='https://example.com'").get_text()
特定の型のすべての要素を見つけるには、find_all() メソッドを使用します。
### Re パッケージ
[Re](https://docs.python.org/3/library/re.html) は、正規表現を使用してデータを検索・取得するための、Python にプリインストールされたパッケージです。Web ページから連絡先情報を抽出したり、その他多くのタスクに役立ちます。動作の例を見てみましょう。
スクリプト scripts/osint/scraping_re.py を実行してください:```bash
python scripts/osint/scraping_re.py

scripts/osint/scraping_re.py のソースコード:```python import netlas import re
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
http.body:shopnetlas_query = netlas_connection.query(query="http.body:shop")
for response in netlas_query['items']: print (response['data']['uri']) emails = re.findall("[a-zA-Z0-9-.]+@[a-zA-Z0-9-.]+", response['data']['http']['body']) try: print(emails) except Exception: print("no emails") pass
同様に、リンク、電話番号、暗号通貨ウォレットアドレスなどを抽出できます。既製のパターンは正規表現ライブラリにあります:
[Regex Lib](https://regexlib.com/)
[UI Bakery Regex Library](https://uibakery.io/regex-library)
[Regex 101](https://regex101.com/)
### スクレイピングのためのその他のPythonパッケージ
Beaitiful soup と Re パッケージは、Pythonを使用してWebページからデータをスクレイピングするための多くのツールの1つです。以下にそのようなパッケージの例をいくつか示します:
* [Scrapy](https://pypi.org/project/Scrapy/): これは主にクローラー(他のページで見つかったリンクを使用してウェブサイトのページを巡回するツール)であり、さらに、ウェブページからデータを抽出するための広範な機能を備えています。
* [Selenium](https://pypi.org/project/selenium/): ブラウザ体験を自動化するツールです。JavaScriptによって生成されたコンテンツからデータを抽出することができます。
* [Lxml](https://pypi.org/project/lxml/): XMLファイルをスクレイピングおよび検証するためのツールです。
* [PDFtoText](https://pypi.org/project/pdftotext/) - PDFファイルからテキストコンテンツを抽出するためのツールです。
* [pyChatGPT](https://pypi.org/project/pyChatGPT/) - ChatGPTとの対話のための非公式パッケージ(OpenAI APIキー不要)。AIによるテキスト情報の分析が可能です。
## 暗号通貨調査のためのNetlas.ioの使用
Netlasは、暗号通貨犯罪を専門とする研究者に大きな機会を提供します。まず、ウォレットアドレスやトランザクション番号への参照を検索するために使用できます。次に、脆弱なマイニングファーム、ノード、その他の暗号インフラに関連するサーバーを検索するために使用できます。
### マイニングファームの検索

Antminerマイニングファームは、2013年にBitmainによって初めてリリースされ、世界で最も人気のあるマイニングファームモデルのラインの1つです。www_authenticateヘッダー内の「antMiner」という単語の存在によってそれらを見つけることができます。```
http.headers.www_authenticate:antMiner
他の種類のマイニングファームを検索することもできます。例:``` http.headers.www_authenticate:XMR-Stak-Miner
さまざまなフィルター、単語「miner/mining」、および暗号通貨名を組み合わせて実験してみてください。
**APIリクエストの例**
Netlas CLI Tools:```bash
netlas search "http.headers.www_authenticate:antMiner"
Curl:```bash
curl -X 'GET'
'https://app.netlas.io/api/responses/?q=http.headers.www_authenticate%3AantMiner&source_type=include&start=0&fields=*'
-H 'accept: application/json'
-H 'X-API-Key: 'YOUR_API_KEY' | jq .items[].data.uri
**コード例(Netlas Python Library)**

コマンドラインで実行:```bash
python scripts/crypto/mining_farms_search.py
scripts/crypto/mining_farms_search.pyのソースコード:```python import netlas
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
http.headers.www_authenticate:antMinernetlas_query = netlas_connection.query(query='http.headers.www_authenticate:antMiner')
for response in netlas_query['items']: print (response['data']['uri']) print (response['data']['http']['headers'])
### クリプトマイナーに感染したウェブサイトを検索

Coinhiveは、ウェブサイト(主にハッキングされたもの)が訪問者のコンピュータを使用して暗号通貨を採掘できるようにするサービスですが、2019年に閉鎖されます。しかしそれでも、世界中の多くのサイトにCoinhiveへのリンクが埋め込まれています。それらを見つけてみましょう:```
http.body:coinhive.min.js domain:*
注意:サイトを特定して検索するためにdomain:*フィルタを使用していることに注意してください。すべてのデバイスを対象としているわけではありません。
同様に、他のクリプトマイナー(ユーザー側で実行される他の悪意のあるコードも含む)に感染したサイトを検索することもできます。
APIリクエストの例
Netlas CLI Tools:```bash netlas search "http.body:coinhive.min.js domain:*"
Curl:```bash
curl -X 'GET' \
'https://app.netlas.io/api/responses/?q=http.body%3Acoinhive.min.js%20domain%3A*&source_type=include&start=0&fields=*' \
-H 'accept: application/json' \
-H 'X-API-Key: 'YOUR_API_KEY' | jq .items[].data.uri
コード例(Netlas Pythonライブラリ)

コマンドラインで実行:```bash python scripts/crypto/search_sites_injected_with_miners.py
ソースコード:```python
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `http.body:coinhive.min.js domain:*`
netlas_query = netlas_connection.query(query='http.body:coinhive.min.js domain:*')
# iterate over data and print: uri
for response in netlas_query['items']:
print (response['data']['uri'])

BitcoinノードはTCP接続にポート8333を使用します。したがって、"port:" 検索フィルターを使用して簡単に見つけることができます。``` port:8333 cve:*
なお、脆弱性のあるサーバーを検索するために「cve:*」フィルタを使用しています。
**APIリクエストの例**
Netlas CLI Tools:```bash
netlas search "port:8333 cve:*"
Curl:```bash
curl -X 'GET'
'https://app.netlas.io/api/responses/?q=port%3A8333%20cve%3A*&source_type=include&start=0&fields=*'
-H 'accept: application/json'
-H 'X-API-Key: 'YOUR_API_KEY' | jq .items[].data.uri
**コード例 (Netlas Python Library)**

コマンドラインで実行:```bash
python scripts/crypto/search_bitcoin_nodes.py
ソースコードの scripts/crypto/search_bitcoin_nodes.py:```python import netlas
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
port:8333 cve:*netlas_query = netlas_connection.query(query='port:8333 cve:*')
for response in netlas_query['items']: print (response['data']['uri']) print (response['data']['cve'][0]['name']) print (response['data']['cve'][0]['description'])
## Neltas を Pentest で使用する
Netlas.io を使用すると、さまざまな種類の脆弱性を持つサイトを検索できます。脆弱性番号 (CVE-...)、サーバーにインストールされているソフトウェア名、ページヘッダー内の特定の単語、その他のパラメータで検索できます。
最も最近公開された CVE (Common Vulnerabilities and Exposures) は、以下のサイトで追跡できます。
* [CVE Details](https://www.cvedetails.com/)
* [VulDB](https://vuldb.com/)
* [OpenCVE](https://www.opencve.io/)
また、脆弱なデバイスやソフトウェアを検索するための最も関連性の高いクエリを、当社の [Twitter](https://twitter.com/Netlas_io)、[Telegram](https://t.me/netlas)、[Discord](https://nt.ls/discord) フィード、および [Netlas Dorks](https://github.com/netlas-io/netlas-dorks) Github リポジトリに定期的に投稿しています。
このセクションでは、脆弱性を持つサイトやサーバーを検索する一般的な原則について簡単に説明します。
### サブドメイン検索
検索クエリでアスタリスクを使用すると、さまざまなレベルのサブドメイン(名前が特定のトップレベルドメイン (.com) またはセカンドレベルドメイン (google.com) で終わるもの)をすべて見つけることができます。
**検索クエリの例**
```
domain:*.github.com OR host:*.github.com
APIリクエスト例
Netlas CLI Tools:```bash netlas search "domain:.github.com OR host:.github.com" -f json
Curl:```bash
curl -X 'GET' \
'https://app.netlas.io/api/responses/?q=domain%3A*.github.com%20OR%20host%3A*.github.com&source_type=include&start=0&fields=*' \
-H 'accept: application/json' \
-H 'X-API-Key: YOUR_API_KEY' | jq .items[].data.uri
コード例(Netlas Pythonライブラリ)

コマンドラインで実行:```bash python scripts/pentest/subdomain_search.py
scripts/pentest/subdomain_search.py のソースコード:```python
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `domain:*.github.com OR host:*.github.com`
netlas_query = netlas_connection.query(query="domain:*.github.com OR host:*.github.com")
# iterate over data and print: ip, url
for response in netlas_query['items']:
print (response['data']['ip'])
print (response['data']['uri'])
検索クエリの例
```
cve.name:CVE-2022-22965
[Netlasで試す](https://app.netlas.io/responses/?q=cve.name%3ACVE-2022-22965&page=1&indices=)
**APIリクエスト例**
Netlas CLI Tools:```bash
netlas search "cve.name:CVE-2022-22965" -f json
CVE-2022-22965 - JDK 9+ 上で動作する Spring MVC または Spring WebFlux アプリケーションは、データバインディングを介したリモートコード実行 (RCE) に対して脆弱である可能性があります。詳細
Curl:```bash
curl -X 'GET'
'https://app.netlas.io/api/responses/?q=http.body%3A1%3F234%3F567%3F89%3F99%20OR%20http.body%3A12345678999%20OR%20http.body%3A1234%3F5678%3F999&source_type=include&start=0&fields=*'
-H 'accept: application/json'
-H 'X-API-Key: YOUR_API_KEY' jq .items[].data.uri
**コード例(Netlas Pythonライブラリ)**

コマンドラインで実行:```bash
python scripts/pentest/cve_search.py
scripts/pentest/cve_search.py のソースコード:```python import netlas
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
cve.name:CVE-2022-22965netlas_query = netlas_connection.query(query="cve.name:CVE-2022-22965")
for response in netlas_query['items']: print (response['data']['ip']) print (response['data']['uri'])
### 説明に特定の単語を含む脆弱性のあるサイトを検索する
特定の種類の脆弱性を持つサーバーを調査する必要はなく、特定のグループ(Oracle WebLogic Server や WordPress サイトなど)の脆弱性のあるサーバーを確認したいだけの場合は、キーワードと cve.description: フィルターを使用して検索できます。
脆弱性に対して公開されたエクスプロイトがあるサイトを除外するには、cve.has_exploit:true を使用します。
**検索クエリの例**
```
cve.description:weblogic AND cve.has_exploit:true
APIリクエストの例
Netlas CLIツール:```bash netlas search "cve.description:weblogic AND cve.has_exploit:true" -f json
Curl:```bash
curl -X 'GET' \
'https://app.netlas.io/api/responses/?q=cve.description%3Aweblogic%20AND%20cve.has_exploit%3Atrue&source_type=include&start=0&fields=*' \
-H 'accept: application/json' \
-H 'X-API-Key: YOUR_API_KEY | jq .items[].data.uri
コード例(Netlas Python Library)

コマンドラインで実行:```bash python scripts/pentest/cve_description_search.py
scripts/pentest/cve_description_search.py のソースコード:```python
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `cve.description:weblogic AND cve.has_exploit:true`
netlas_query = netlas_connection.query(query="cve.description:weblogic AND cve.has_exploit:true")
# iterate over data and print: url, first CVE name first CVE description
for response in netlas_query['items']:
print (response['data']['uri'])
print (response['data']['cve'][0]['name'])
print (response['data']['cve'][0]['description'])
この方法を使うと、特定の企業が製造したデバイスを見つけることができます。
検索クエリの例
```
http.headers.server:"yawcam"
YawCamウェブカメラを検索します。
[Netlasで試す](https://app.netlas.io/responses/?q=http.headers.server%3A%22yawcam%22&page=1&indices=)
**APIリクエスト例**
Netlas CLI ツール:```bash
netlas search 'http.headers.server:"yawcam"' -f json
クエリで二重引用符が使用される場合、クエリ自体は一重引用符で記述されることに注意してください。
Curl:```bash
curl -X 'GET'
'https://app.netlas.io/api/responses/?q=http.headers.server%3A%22yawcam%22&source_type=include&start=0&fields=*'
-H 'accept: application/json'
-H 'X-API-Key: YOUR_API_KEY' | jq .items[].data.uri
**コード例 (Netlas Python ライブラリ)**

コマンドラインで実行:```bash
python scripts/pentest/server_name_search.py
scripts/pentest/server_name_search.py のソースコード:```python import netlas
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
http.headers.server:"yawcam"netlas_query = netlas_connection.query(query='http.headers.server:"yawcam"')
for response in netlas_query['items']: print (response['data']['ip']) print (response['data']['http']['headers']['server'])
#### デフォルトログインとパスワード <!-- omit in toc -->
サーバーヘッダーでソフトウェア名を検索する実用的な用途のひとつは、特定のベンダーのデバイスを検索することです。これは、特定の脆弱性を持つデバイスや、標準的なログイン・パスワードを持つデバイスを検索する際に必要となることがあります。

さまざまなデバイスモデルの標準ログインとパスワードは、専用リストで見つけることができます。例:
* [Default Router Login Password For Top Router Models (2023 List)](https://www.softwaretestinghelp.com/default-router-username-and-password-list/)
* [Default Username – Password – IP Address for Security Cameras](https://www.a1securitycameras.com/blog/default-username-passwords-ip-addresses-for-surveillance-cameras/)
* [The Default Passwords of Nearly Every IP Camera](https://www.hackers-arise.com/post/the-default-passwords-of-nearly-every-ip-camera)
* [List of default passwords from Datarecovery](https://datarecovery.com/rd/default-passwords/)
標準ログインとパスワードを使用して他人のシステムにログインすることは、倫理規定に違反し、お住まいの国では違法となる可能性があることに注意してください。
### Favicon ハッシュによる脆弱なサーバーの検索
特定の脆弱性にさらされている Web サーバーを見つける方法のひとつは、特定の Web サーバーソフトウェアの favicon ico を検索することです。
**検索クエリの例**
```
http.favicon.hash_sha256:ebaaed8ab7c21856f888117edaf342f6bc10335106ed907f95787b69878d9d9e
このクエリはSecurePointのfavicon(CVE-2023-22620)を検索します。
APIリクエスト例
Netlas CLI Tools:```bash netlas search "http.favicon.hash_sha256:ebaaed8ab7c21856f888117edaf342f6bc10335106ed907f95787b69878d9d9e" -f json
Curl:```bash
curl -X 'GET' \
'https://app.netlas.io/api/responses/?q=http.favicon.hash_sha256%3Aebaaed8ab7c21856f888117edaf342f6bc10335106ed907f95787b69878d9d9e&source_type=include&start=0&fields=*' \
-H 'accept: application/json' \
-H 'X-API-Key: YOUR_API_KEY' | jq .items[].data.uri
コード例 (Netlas Python Library)

コマンドラインで実行:```bash python scripts/pentest/favicon_hash_search.py
scripts/pentest/favicon_hash_search.py のソースコード:```python
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `http.favicon.hash_sha256:ebaaed8ab7c21856f888117edaf342f6bc10335106ed907f95787b69878d9d9e`
netlas_query = netlas_connection.query(query="http.favicon.hash_sha256:ebaaed8ab7c21856f888117edaf342f6bc10335106ed907f95787b69878d9d9e")
# iterate over data and print: IP,URL,web page title
for response in netlas_query['items']:
print (response['data']['ip'])
print (response['data']['uri'])
print (response['data']['http']['title'])
異なるソフトウェアを実行しているサーバー間の検索を簡素化するため、Netlas は検索結果に特定のタグを自動的に付与します。
タグの例:
「tag.name:」フィルタを使用してタグで検索できます。また、「tag.category:」フィルタを使用してタグカテゴリで検索することもできます。利用可能なすべてのタグとカテゴリの一覧は、Netlas ホームページの検索クエリ入力ボックスの右側にあるアイコンをクリックすると表示されます。
注釈: すべての料金プランでタグの使用がサポートされているわけではありません。
検索クエリの例
```
tag.name:"adobe_coldfusion"
このクエリは Adobe ColdFusion(CVE-2023-26359)を検索します。
[Try in Netlas](https://app.netlas.io/responses/?q=tag.name%3A%22adobe_coldfusion%22&page=1&indices=)
**APIリクエスト例**
Netlas CLI Tools:```bash
netlas search 'tag.name:"adobe_coldfusion"' -f json
クエリ内で二重引用符を使用する場合、クエリ自体は一重引用符で記述されることに注意してください。
Curl:```bash
curl -X 'GET'
'https://app.netlas.io/api/responses/?q=tag.name%3A%22adobe_coldfusion%22&source_type=include&start=0&fields=*'
-H 'accept: application/json'
-H 'X-API-Key: YOUR_API_KEY' | jq .items[].data.uri
**コード例 (Netlas Python Library)**

コマンドラインで実行:```bash
python scripts/pentest/search_tag_name.py
scripts/pentest/search_tag_name.py のソースコード:```python import netlas
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
tag.name:"adobe_coldfusion"netlas_query = netlas_connection.query(query='tag.name:"adobe_coldfusion"')
for response in netlas_query['items']: print (response['data']['ip']) print (response['data']['uri'])
### 近く(または任意の場所)にある脆弱なサーバーとデバイスを検索

あなたの周りに脆弱なサイトやデバイスがどれだけあるか知りたいですか?特定の地理位置情報でCVEフィールドが入力されているすべてのIPアドレスを検索するだけです。```
geo.city:London AND cve:*
他の地理位置情報フィルターも使用できます。
geo.continentgeo.countrygeo.locationAPIリクエストの例
Netlas CLI ツール:``` geo.city:London AND cve:*
Curl:```bash
curl -X 'GET' \
'https://app.netlas.io/api/responses/?q=geo.city%3ALondon%20AND%20cve%3A*&source_type=include&start=0&fields=*' \
-H 'accept: application/json' \
-H 'X-API-Key: 'YOUR_API_KEY' | jq .items[].data.domain
コード例 (Netlas Python ライブラリ)

コマンドラインで実行:```bash python scripts/pentest/cve_location_search.py
scripts/pentest/cve_location_search.py のソースコード:```python
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `geo.city:London AND cve:*`
netlas_query = netlas_connection.query(query='geo.city:London AND cve:*')
# iterate over data and print: uri, cve name, location
for response in netlas_query['items']:
print (response['data']['uri'])
print (response['data']['cve'][0]['name'])
print (response['data']['geo']['city'])

多くのサイトやサーバーには、ログインやパスワードのWebページがあり、これらを利用して(デフォルトパスワードの使用、ブルートフォース、脆弱性の悪用などにより)サイトやサーバーの完全な制御を取得することができます。
これらは、uri: または http.title フィルタを使用して見つけることができます:```
uri:login.php
uri:login.aspx
uri:user http.title:login
uri:admin http.title:login
http.title:admin http.title:panel
組み合わせは非常に多いです。脆弱性のあるサーバのパネルのみを検索するには、フィルタ `cve:*` を使用してください。
また、タグを使用してインストールされたソフトウェアでサーバをフィルタリングできることもお忘れなく。例:```
tag.1c_bitrix:*
tag.Cisco:
tag.amazon_s3:*
tag.drupal:*
tag.wordpress:*

脆弱なphpMyAdmin管理パネル(MySQLデータベース管理で最も人気のあるソフトウェアの1つ)を検索してみましょう:``` http.title:phpMyAdmin cve:*
そして、他の人気のあるデータベース管理ツールの例をいくつか示します:
[Adminer](https://www.adminer.org/):```
http.title:adminer http.title:login cve:*
PostgreSQL``` http.title:(phpPgAdmin OR pgadmin) cve:*
また、タグや特別なフィルターを使用して、異なるデータベースのソフトウェアがインストールされているサーバーを検索することもできます。```
tag.adminer:*
tag.phpMyAdmin:*
tag.elastic:*
mongodb:*
mssql:*
mysql:*
django:*
このようにして見つかったサーバーの管理パネルを探すのは、サイト管理者が標準的なリンクをより安全なものに変更することが多いため、必ずしも容易ではありません。

SQLインジェクションは、URLパラメータを操作することでデータベースクエリを実行可能にする脆弱性の一種です(これは設定ミスや品質の低いコードによって発生する可能性があります)。
SQLインジェクションの脆弱性がある可能性のあるページを見つけるための最も古い手法の1つは、Google Dorksを使用して、MySQLクエリでエラーメッセージ表示が有効になっているページを検索することです。
同様の検索はNetlasでも実行できます:``` http.body:mysql_fetch_array http.body:warning
[Try in Netlas](https://app.netlas.io/responses/?q=http.body%3Amysql_fetch_array%20http.body%3Awarning&page=1&indices=)
その他の例:```
http.body:mysql_num_rows http.body:warning
http.body:mysql_connect http.body:denied
http.body:mysql_query http.body:warning
http.body:pg_connect http.body:fatal
APIリクエスト例
Netlas CLI Tools:```bash netlas search "http.body:mysql_fetch_array http.body:warning" -f json
Curl:```bash
curl -X 'GET' \
'https://app.netlas.io/api/responses/?q=http.body%3Amysql_fetch_array%20http.body%3Awarning&source_type=include&start=0&fields=*' \
-H 'accept: application/json' \
-H 'X-API-Key: YOUR_API_KEY' jq .items[].data.uri
コード例(Netlas Pythonライブラリ)

コマンドラインで実行:```bash python scripts/pentest/sql_injection_search.py
scripts/pentest/sql_injection_search.py のソースコード:```python
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# search in Netlas "http.body:mysql_fetch_array http.body:warning"
netlas_query = netlas_connection.query(query="http.body:mysql_fetch_array http.body:warning")
# iterate over data and print: uri, web page body
for response in netlas_query['items']:
print (response['data']['uri'])
print (response['data']['http']['body'])
以下のフィルタを使用して、脆弱性のあるMySQLサーバを検索することもできます:
mysql.error_codemysql.error_idmysql.error_messageNetlasはウェブサイトやサーバだけでなく、インターネットに接続されたすべてのデバイス(スマート家電、監視カメラ、プリンタ、ルーター、信号機、医療機器など)を検索します。
これらのデバイスを見つけるには、主に4つの方法があります。

最も簡単な方法は、レスポンスのHTTPタイトル内でベンダー名やデバイスタイプを単純に検索することです。
Jeedomのホームオートメーションデバイスを検索してみてください:``` http.title:Jeedom
[Try in Netlas](https://app.netlas.io/responses/?q=http.title%3AJeedom&page=1&indices=)
またはAvigilonウェブカメラ:```
http.title:"Avigilon"
この方法には2つの欠点があります。1つ目は、不適切な結果(タイトルに関連語が含まれるだけのウェブサイト)が多数表示されることです。しかし、引用符や port: のような追加の検索フィルターを使用すると、それらは減少します。
2つ目は、多くのIoTデバイスがhttpタイトルに識別可能な情報を持っていないことです。そのため、他の検索フィルターも有用です。

同様に、http応答のボディ内でキーワードを検索することもできます。一般的なウェブサイトの少なくとも一部を除外するには、NOT domain:* フィルターを使用します。Reolinkカメラを検索してみましょう:```
http.body:(clip-status) NOT domain:*
この例は完全に正しいわけではないので、これらのカメラはタグを使用して見つけることができます(詳細は後述)。
### ポート番号による検索

さまざまなIoTデバイスは通信に異なるポートを使用します。そして、開放ポート番号によって、そのIPアドレスが特定の種類のデバイスに属する可能性があると仮定できます(**この仮定は多くの場合正しいですが、不正確さや偶然の一致が生じる可能性があります**)。
インターネットラジオ(ポート8000)を検索してみてください:```
port:8000 http.title:radio
または、ポート7547が開いているすべてのデバイス(CWMPを介してルーターをリモート管理するために使用されます):``` port:7547
[Try in Netlas](https://app.netlas.io/responses/?q=port%3A7547&page=1&indices=)
### バナーによる検索

Telnetプロトコルを使用するルーターを探してみましょう(port:23でフィルタリングすることもできます):```
telnet.banner:router
または、すべてのプロトコルのバナーを検索:``` *.banner:router
[Netlasで試す](https://app.netlas.io/responses/?q=%5C*.banner%3Arouter&page=1&indices=)
### ファビコンで検索

特定のソフトウェアがインストールされたデバイスを見つける最も簡単な方法の1つは、ファビコンで検索することです。さまざまなCisco製品がどこで使用されているかを見つけてみましょう。```
http.favicon.hash_sha256:62a8461e328d5bace3780ff738d0b58f6502592c04afa564e0a8a792583a7bfb
Netlasでファビコンを検索する主な方法は3つあります:

httpタイトルに識別可能なデバイス情報がない場合でも、他のヘッダーに含まれていることがあります。例えば、http.server.header:``` http.headers.server:"i-Catcher Console"
[Netlasで試す](https://app.netlas.io/responses/?q=http.headers.server%3A%22i-Catcher%20Console%22&page=1&indices=)
Netlasは数十種類のヘッダータイプにわたる検索をサポートしています。さまざまなバリアントを試してみてください。
### Cookieによる検索

Eco JS Parking lotsを検索:```
http.headers.set_cookie:(regist_carNo=)

この方法は有料サブスクリプションが必要な場合があります。 価格を見る
タグ(カテゴリ)でデバイスを検索することもできます。``` tag.category:"IoT" tag.category:"Web cameras"
[Try in Netlas](https://app.netlas.io/responses/?q=tag.category%3A%22Web%20cameras%22&page=1&indices=)
ただし、タグは自動的に割り当てられるため、一部の該当デバイスが対応するカテゴリに含まれていない場合があることに注意してください。
### 追加の検索フィルター
特定の地理的位置にあるIoTデバイスを検索することも可能です:
- `geo.city`
- `geo.country`
- `geo.continent`
IPアドレス範囲でデバイスをフィルタリング:```
ip:[162.245.241.131 TO 162.245.241.133]
または、"新しい"脆弱性を持つデバイス:``` cve.name:2023
More examples of queries to search for IoT devices can be found here:
[Netlas Dorks](https://github.com/netlas-io/netlas-dorks)
## Using Netlas.io for Darknet Research
Netlasの主な利点の一つは、Googleによってインデックスされていないものを検索できることです。これは一般的にDeepWebと呼ばれるものです。例えば、FTPサーバーやTelnetサーバー:```
ftp.banner:*
telnet.banner:*
しかし、Netlasはダークネット(.onion、.i2pなど)のインデックス作成を行いません。グローバルIPアドレスのみをスキャンするためです。ただし、代替ネットワークインフラを探索し、.onionサイトへのリンクを見つけるために使用することは可能です。
Tor Exitノードは、WebトラフィックがTorネットワークを離れて宛先に転送されるポイントです。アクティブなTor EntryノードのIPアドレスの最新リストは、TorProjectのWebサイトで常に入手可能です:
Netlasを使用して、すべてのアクティブなTor Exitノードに関する情報を一度に収集する方法を見てみましょう。この例は、ドメインやIPアドレスのリストに関する情報を収集する必要がある他のすべてのタスクにも役立ちます。
scripts/darknet/tor_nodes.pyを実行:```bash python scripts/darknet/tor_nodes.py

scripts/darknet/tor_nodes.py のソースコード:```python
import netlas
import urllib
import time
apikey = 'YOUR_API_KEY'
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# read file with Tor Exit Nodes IPs line by line
response = urllib.request.urlopen('https://check.torproject.org/torbulkexitlist?ip=1.1.1.1')
ip_lines = response.readlines()
# save each line to ip variable
for ip in ip_lines:
# wait one second
time.sleep(1)
# conver byte string to text
ip=ip.decode("utf-8")
# retrieve data from responses by query `ip: + tor exit node ip`
netlas_query = netlas_connection.query(query="ip:"+ip)
# iterate over data and print: ip, geo data, banner text
for response in netlas_query['items']:
print(response['data']['ip'])
print(response['data']['geo'])
print(response['data']['ntp']['banner'])
pass
pass
timeパッケージとsleepメソッドの使用は、単純な例にのみ適しています。最適な解決策は、rate limit packageを使用することです。
前述の通り、Netlasはグローバルドメインのみをスキャンするため、.onionドメインを検索することはできません。しかし、Webページのテキスト内で.onionドメインへの参照を検索することは可能です。以下はそのための簡単なPythonスクリプト(正規表現を使用)の例です。
scripts/darknet/onion_links.py を実行してください:```bash python scripts/darknet/onion_links.py

スクリプト `scripts/darknet/onion_links.py` のソースコード:```python
import netlas
import re
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `http.body:*.onion AND forum`
netlas_query = netlas_connection.query(query="http.body:(*.onion AND forum)")
# iterate over data and print: URL, .onion link from body
for response in netlas_query['items']:
print(response['data']['uri'])
onion_links = re.findall("[a-z-1-9]*\.onion", response['data']['http']['body'])
try:
print(onion_links)
except:
print("no onion links")
pass
同じ方法で、I2Pinのような他のネットワークのリンクを収集できます:``` http.body:*.i2p
## ファイル、バックアップ、ログディレクトリの検索

設定ミス(時には意図的に)によりファイルディレクトリを公開したままにしているサイトやサーバーが非常に多く存在します。以下は、それらを見つけるためのクエリの例です。
任意のファイルディレクトリを検索:```
http.title:Index http.title:of
ログファイルがあるディレクトリを検索:``` http.title:Index http.title:of http.body:logs
データベースダンプを含むディレクトリを検索する:```
http.title:Index http.title:of http.body:sql
アーカイブされたバックアップがあるディレクトリを検索:``` http.title:Index http.title:of http.body:backup?zip
SSHアクセス情報があるディレクトリを検索:```
http.title:Index http.title:of http.body:("ssh_config" OR "ssh_known_hosts" OR "authorized_keys" OR "id_rsa" OR "id_dsa")
他の認証情報を含むファイルがあるディレクトリを検索する:``` http.title:Index http.title:of http.body:("pass" OR "logins" OR "config" OR "password")
ユーザーによってダウンロードされたファイルを含むディレクトリを検索:```
http.title:index http.title:of http.body:downloads
Docker設定ファイルがあるディレクトリを検索する:``` http.title:index http.title:of http.body:docker-compose
他にも何百もの同様のリクエストが考えられます。さまざまなファイル名と拡張子を試してみてください。
## Netlas.io をデジタルフォレンジックとインシデントレスポンスに使用する
このセクションは、Netlas for OSINTセクションから分けるのが非常に難しいです。なぜなら、そこにリストされているクエリは、デジタルフォレンジックに関わる人にも役立つからです。
このセクションでは、より「技術的な」クエリについて説明します。これらは、例えばネットワークの技術的インフラに関する情報を収集したり、フィッシング攻撃を調査したりするのに役立ちます。
### SMTPサーバーの情報収集
SMTP(Simple Mail Transfer Protocol)は、電子メールの送受信を可能にする通信プロトコルです。ほとんどのメールクライアントでは、メールを表示する際に「Show Original」機能が利用可能で、これによりメールが送信されたSMTPサーバーのアドレスを確認できます。
Netlasを使用すると、SMTPサーバーに関する情報を取得できるだけでなく、他のIPやドメインに関する情報も取得でき、SMTPバナーのテキストを検索することもできます。これにより、特定のドメイン、企業、またはホスティングプロバイダーに関連するサーバーを見つけることができます。
**検索クエリの例**
```
smtp.banner:fornex.cloud
Netlas CLI ツール:```bash netlas search "smtp.banner:fornex.cloud" -f json
Curl:```bash
curl -X 'GET' \
'https://app.netlas.io/api/responses/?q=smtp.banner%3Afornex.cloud&source_type=include&start=0&fields=*' \
-H 'accept: application/json' \
-H 'X-API-Key: 'YOUR_API_KEY' | jq .items[].data.smtp.banner
コード例(Netlas Python ライブラリ)

コマンドラインで実行:```bash python scripts/dfir/smtp_banner_search.py
scripts/dfir/smtp_banner_search.py のソースコード:```python
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `smtp.banner:fornex.cloud`
netlas_query = netlas_connection.query(query="smtp.banner:fornex.cloud")
# iterate over data and print: SMTP banner, URL, ISP
for response in netlas_query['items']:
print (response['data']['smtp']['banner'])
print (response['data']['uri'])
print (response['data']['isp'])
詐欺師の一般的な手口の1つは、有名企業のドメインと綴りが非常に似ているドメインを使用することです。
Netlasとあいまい検索を使用して、特定の企業に関するそのようなドメインを見つけることができます。

Whoisドメイン検索を開き、企業のドメイン名に続けてを入力します。例:```
domain:facebook.com
[Netlasで試す](https://app.netlas.io/whois_domains/?q=domain%3Afacebook.com~&page=1&indices=)

その後、左のアイコンをクリックし、エクスポートファイルの種類、ファイル名、およびファイルに保存したいフィールドを選択します。「ダウンロード」をクリックし、しばらく待ちます。

例えば、CSVファイル形式と、domain、expiration_date、statusフィールドを選択できます。このようなテーブルは、Excel、Numbers、またはGoogleドキュメントで便利に表示できます。
### ファビコン検索

favicon.icoの検索には主に3つの用途があります。
まず、関連する可能性のあるサイトやサブドメインを見つけることができます。Lidlショップに関連するIPを見つけてみてください:```
http.favicon.perceptual_hash:003c7e72207e3c00
また、人気のソーシャルネットワークやオンラインストアなどのデザインを利用したフィッシングサイトを見つけるためにも使用します。
第二に、さまざまなIoTデバイスの検索です。HP製品を探してみてください:``` http.favicon.perceptual_hash:0c5ec8c181f37e2c
[Netlasで試す](https://app.netlas.io/responses/?q=http.favicon.perceptual_hash%3A0c5ec8c181f37e2c&page=1&indices=)
第三に、特定のソフトウェアが起動されているサーバーを検索します。PhpMyAdminが動作しているサーバーを探してみてください:```
http.favicon.perceptual_hash:00084e5e5fffff8d
Netlasでファビコンハッシュを検索する主な方法は3つあります:
以下のフィルタを使用してファビコンを検索することもできます:
http.favicon.last_modifiedhttp.favicon.last_updatedhttp.favicon.urihttp.favicon.path
Netlasのドメイン検索では、特定のIPアドレスまたはアドレス範囲に関連付けられたドメインの完全なリストを取得できます。例えば:``` a:"163.114.132.0/24"
[Netlas で試す](https://app.netlas.io/domains/?q=a%3A%22163.114.132.0%2F24%22&page=1&indices=)
API リクエスト例
Netlas CLI ツール:```bash
netlas search -d domain a:\"163.114.132.0/24\"
Curl:```bash
curl -X 'GET'
'https://app.netlas.io/api/domains/?q=a%3A%22163.114.132.0%2F24%22&source_type=include&start=0&fields=*'
-H 'accept: application/json'
-H 'X-API-Key: 'YOUR_API_KEY' | jq .items[].data.domain
**コード例 (Netlas Python Library)**

コマンドラインで実行:```bash
python scripts/dfir/subnet_search.py
scripts/dfir/subnet_search.py のソースコード:```python import netlas
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
a:"163.114.132.0/24"netlas_query = netlas_connection.query(query='a:"163.114.132.0/24"',datatype="domain")
for response in netlas_query['items']: print (response['data']['domain'])
### 悪意のあるソフトウェアを使用したサーバーの検索

Netlasを使用すると、さまざまなマルウェアがインストールされているサーバーを見つけることができます。これは、http.titleやhttp.body内の特定の単語、ファビコンハッシュ、SSL、その他のパラメータの有無によって見つけることができます。
以下は、GoFish(オープンソースのフィッシングフレームワーク)がインストールされているサーバーを見つけるクエリの例です。```
http.title:Gophish http.title:Login
同じ演算子を2回続けて使う(2つの単語の間にアスタリスクを挟む代わりに)という手法がここで使われていることに注意してください。これにより、より多くの検索結果が得られることがあります。
以下に、類似のリクエストの例をさらにいくつか示します:``` http.title:CALDERA http.title:login http.title:Deimos http.title:C2
**APIリクエスト例**
Netlas CLI Tools:```bash
netlas search "http.title:Gophish http.title:Login" -f json
Curl:```bash
curl -X 'GET'
'https://app.netlas.io/api/responses/?q=http.title%3AGophish%20http.title%3ALogin&source_type=include&start=0&fields=*'
-H 'accept: application/json'
-H 'X-API-Key: YOUR_API_KEY' jq .items[].data.uri
**コード例 (Netlas Python Library)**

コマンドラインで実行:```bash
python scripts/dfif/malware_search.py
scripts/dfir/malware_search.pyのソースコード:```python import netlas
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
netlas_query = netlas_connection.query(query="http.title:Gophish http.title:Login")
for response in netlas_query['items']:
print (response['data']['uri'])
print (response['data']['http']['title'])
print (response['data']['geo']['country'])
## 技術とコード例の検索

Netlasは、従来の検索エンジンとは異なり、ページのテキストではなくHTMLコード全体を検索できます。これにより、特定のJavaScriptライブラリを使用しているサイトを見つけることができます。これは、自分のタスクに適したコードサンプルを見つけ、時間を節約するのに役立ちます。
例えば、グラフィックを描画するために古いマイナーなライブラリを使用しているサイトを探す場合:```
http.body:kinetic.js
また、特定のテーマのサイトで異なるCSSフレームワークがどのように使用されているかを確認し、優れたデザインアイデアを借用することもできます:``` http.body:bootstrap.css http.title:travel
また、タグを使用して特定のフレームワークやテクノロジーを使用しているサイトをフィルタリングすることもできます:```
tag.bootstrap:*
tag.angularjs:*
tag.wordpress:*
tag.nextjs:*
Netlasは、他の多くの検索エンジンと同様に、特定の目的なしに使うこともでき、インターネットの未踏の領域を探索して面白いものを見つけることができます。
以下は、Googleでは見つけられないものを発見するのに役立つ検索クエリの例です。
Telnetサーバーのバナー(まだ生きています!)のテキストで検索:``` telnet.banner:library

FTPサーバーのバナーテキストで検索:```
ftp.banner:*library*
書籍や文書へのリンクを検索します:``` http.body:rowlingpdf
音楽と動画へのリンクを検索:```
http.body:*cats*mp4
torrentsファイルへのリンクを検索:``` http.body:catsmp4
Netlas は、データベースに保存されているコンテンツを一切検閲しないことに注意してください。違法または非倫理的なものを見つけた場合は、ドメイン情報に記載されているホスティングプロバイダーに苦情を申し立てる必要があります。
## よくある問題
### エラー 429 - リクエストが多すぎる

アプリケーションが Netlas API に複数のリクエストを行う場合、以下のエラーが発生する可能性があります:```json
{'detail': 'Request was throttled. Expected available in 1 second.'}
この問題を解決する一つの方法として、クエリの実行に時間制限を設定できる特別なPythonライブラリ、例えば Limiter Package を使用する方法があります。
以下は、コードでの使用例です(1分間に60リクエストまでの制限)。まず、パッケージをインストールします:``` pip install ratelimit
そして、rate_limit.pyを実行してください:```bash
python scripts/common_problems/rate_limit.py
入力:```python import netlas from ratelimit import limits
@limits(calls=1, period=1) def netlas_query(): apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `cve.description:weblogic AND cve.has_exploit:true`
netlas_query = netlas_connection.query(query="cve.description:weblogic AND cve.has_exploit:true")
# iterate over data and print: url, first CVE name first CVE description
for response in netlas_query['items']:
print (response['data']['uri'])
print (response['data']['cve'][0]['name'])
print (response['data']['cve'][0]['description'])
netlas_query()
同様のパッケージは他の主要なプログラミング言語にも存在します。なぜなら、ほとんどのAPIを扱う際にリクエスト制限を超えることは非常によくある問題だからです。
本当に1秒あたり1回以上の問い合わせを行う必要がある場合は、[セールスチーム](https://netlas.io/sales/)に連絡することができます。
### KeyError

もう一つのよくある問題は、一部のサーバーのレスポンスに特定のキーが存在しないことです。例えば、`['data']['http']['title']` はかなり頻繁に欠落しています。
キーが欠落していると、スクリプトの実行が停止します。標準的なエラーハンドリングを行うことでこれを回避できます。例えば:```python
try:
print (response['data']['http']['title'])
except:
print ("no title")
Netlas Python または Netlas API を、Netlas.io のウェブ版でクエリを入力する代わりに使用する最大の利点は、汎用的なクエリを入力するための膨大な時間を節約できることです。例えば、非常にシンプルな Python コードを使って、長いドメインリストに関する情報を素早く収集できます。
コマンドラインで実行:```bash python scripts/common_problems/domain_list_search.py
domain_list_search.pyのソースコード:```python
import netlas
apikey = "YOUR_API_KEY"
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# read file domains.txt line by line
with open("scripts/common_problems/domains.txt") as f:
# save each line to domain variable
for domain in f:
# retrieve data from responses by query `domain:domainname`
netlas_query = netlas_connection.query(
query=f"domain:{domain}", datatype="domain-whois"
)
# iterate over data and print: ip, isp
for response in netlas_query['items']:
print (response['data']['ip'])
print (response['data']['isp'])
同様に、証明書、IPアドレス、電子メール、その他必要なもののリストを操作できます。
URLから読み込んだリストからIPアドレスを検索する例は、Tor出口ノード検索にあります。

デフォルトでは、Netlas PythonライブラリはDictionary型(JSONと非常に似ています)のデータを返します。データをMS ExcelやGoogle Sheetsにエクスポートしたい場合、簡単な方法の1つはCSV形式で保存することです。
以下は、CSVパッケージを使用した例です。csv_export.pyを実行してください:```bash python scripts/common_problems/csv_export.py
## はじめに
まずデータベースを初期化します。
```shell
passpie init
データベースディレクトリ(デフォルト:~/.passpie/)にパスワードが保存されます。データベースにアクセスするには、マスターパスワードの作成が必要です。
次に認証情報を追加します。
passpie add [email protected] -p 'mysupersecretpassword'
すべての認証情報を一覧表示します。
passpie list
grep で出力をフィルタリングすることもできます。
passpie list | grep myserver
特定の認証情報をコピーします(自動的にクリップボードにコピーされます)。
passpie copy [email protected]
パスワードを変更する必要がある場合。
passpie update [email protected]
Passpie は、シェルの自動補完もサポートしています。passpie のインストールに関する詳細は、インストールガイド をご覧ください。```python
import netlas
import csv
apikey = "YOUR_API_KEY"
netlas_connection = netlas.Netlas(api_key=apikey)
http.meta:nazarnetlas_query = netlas_connection.query(query="http.meta:nazar")
with open('netlas_results.csv', 'w') as csv_file: # Create CSV writer object writer = csv.writer(csv_file, delimiter =';')
# Create a list with data headers:
header = ['IP', 'URL', 'Title']
# Write headers to CSV file
writer.writerow(header)
# iterate over data and print: ip and url to CSV file
for response in netlas_query['items']:
# Create a list with one line of data:
data = [response['data']['ip'], response['data']['uri']]
# Write line to file
writer.writerow(data)
pass
netlas_results.csv は Excel や任意のテキストエディタで開くことができます。
### データを他の形式で保存する
Python を使用すると、Netlas のデータに基づいて、画像やデータの可視化を挿入し、レイアウトをカスタマイズしたさまざまなドキュメントを生成できます。以下に便利なパッケージの例をいくつか示します。
[XLSXWriter](https://xlsxwriter.readthedocs.io/) - Microsoft Excel ファイルを生成します。
[PyPDF](https://pypdf.readthedocs.io/en/stable/) - PDF ファイルを生成します。
[PythonPPTX](https://python-pptx.readthedocs.io/en/latest/) - Microsoft PowerPoint プレゼンテーションを生成します。
[PythonDOCX](https://python-docx.readthedocs.io/en/latest/) - Microsoft Word ファイルを生成します。
### Punycode ドメインのデコード

前述のとおり、Netlas は非ラテン文字のドメイン名を元のエンコーディングで保存せず、Punycode でエンコードして保存します。これは技術的な理由によるものですが、人間の認識にとってはまったく不便です。
しかし、この問題は数行の Python コードで簡単に解決できます。