flaretool.nettool package¶
Submodules¶
flaretool.nettool.common module¶
flaretool.nettool.models module¶
- class flaretool.nettool.models.IpInfo(*, ipaddr: str | None = None, hostname: str | None = None, country: str | None = None)¶
Bases:
BaseDataModel
- country: str | None¶
- hostname: str | None¶
- ipaddr: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class flaretool.nettool.models.PunyDomainInfo(*, originalvalue: str, encodevalue: str, decodevalue: str)¶
Bases:
BaseDataModel
- decodevalue: str¶
- encodevalue: str¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- originalvalue: str¶
Module contents¶
- flaretool.nettool.domain_exists(domain: str) bool ¶
指定されたドメイン名が存在するかどうかを判定する関数
- Parameters:
domain (str) – ドメイン名
- Returns:
指定されたドメイン名が存在する場合はTrue、それ以外の場合はFalse
- Return type:
bool
- flaretool.nettool.get_adhost(domain: str = None) list[str] ¶
広告および危険なホストのリストを取得
- Parameters:
domain (str, optional) – 検索ドメイン(デフォルトはNone)
- Returns:
ホストリスト
- Return type:
list[str]
- flaretool.nettool.get_country_ip_list(country: Country = Country.JP) list[str] ¶
特定の国のIPアドレスを取得(デフォルトは日本)
- Parameters:
country (Country, optional) – 国コード. Defaults to Country.JP.
- Returns:
IPアドレスのリスト
- Return type:
list[str]
- flaretool.nettool.get_global_ipaddr_info(addr: str = None) IpInfo ¶
指定されたグローバルIPアドレスの情報を取得する関数 (指定がない場合は実行端末のグローバルIPを取得)
- Parameters:
addr (str) – IPアドレス または ホスト名(デフォルトはNone)
- Returns:
IPアドレスの情報(取得できない項目はNoneをセット)
- Return type:
- flaretool.nettool.get_japanip_list() list[str] ¶
日本のIPアドレスを取得する関数
- Returns:
日本のIPアドレスのリスト
- Return type:
list[str]
- flaretool.nettool.get_puny_code(domain: str) PunyDomainInfo ¶
日本語を含むドメインをpunycodeに変換する関数
- Parameters:
domain (str) – ドメイン名
- Returns:
取得結果
- Return type:
- flaretool.nettool.get_robots_txt_url(url: str) str ¶
スクレイピング対象URLからrobots.txtファイルのURLを生成
- Parameters:
url (str) – スクレイピング対象のURL
- Returns:
robots.txtファイルのURL
- Return type:
str
- flaretool.nettool.is_country_ip(ipaddr: str, country: Country = Country.JP) bool ¶
指定されたアドレスが指定の国のIPアドレスか確認する関数(デフォルトは日本)
- Parameters:
ipaddr (str) – IPアドレス
country (Country, optional) – 国コード. Defaults to Country.JP.
- Returns:
指定されたIPアドレスが指定した国のIPの場合はTrue、それ以外の場合はFalse
- Return type:
bool
- flaretool.nettool.is_ip_in_allowed_networks(ipaddr: str, allow_networks: list[str]) bool ¶
指定されたIPアドレスが指定されたネットワークに属しているかどうかを判定する関数
- Parameters:
ipaddr (str) – IPアドレス
allow_networks (list[str]) – 許可されたネットワークのリスト
- Returns:
指定されたIPアドレスが指定されたネットワークに属している場合はTrue、それ以外の場合はFalse
- Return type:
bool
- flaretool.nettool.is_japan_ip(ipaddr: str) bool ¶
指定されたアドレスが日本のIPアドレスか確認する関数
- Parameters:
ipaddr (str) – IPアドレス
- Returns:
指定されたIPアドレスが日本のIPの場合はTrue、それ以外の場合はFalse
- Return type:
bool
- flaretool.nettool.is_scraping_allowed(url: str, user_agent: str = '*') bool ¶
指定されたURLに対してスクレイピングが許可されているかどうかを判定
- Parameters:
url (str) – スクレイピング対象のURL
user_agent (str, optional) – 使用するユーザーエージェント デフォルトは”*”
- Returns:
スクレイピングが許可されている場合はTrue、禁止されている場合はFalse
- Return type:
bool
- flaretool.nettool.lookup_domain(ip: str) str ¶
指定されたIPアドレスからドメイン名を取得する関数
- Parameters:
ip (str) – IPアドレス
- Returns:
ドメイン名
- Return type:
str
- flaretool.nettool.lookup_ip(domain: str) str ¶
指定されたドメイン名からIPアドレスを取得する関数
- Parameters:
domain (str) – ドメイン名
- Returns:
IPアドレス
- Return type:
str