This release is a pre-release and may not be stable for production use.
GetDNS
GetDNS 是一个使用DnsDB API查询DNS记录命令行工具。
Dependencies
DnsDB Python SDK >= 0.1.2b2
Install
pip install --upgrade dnsdb-getdns
Usage
查看帮助
getdns -h
Commands
可用子命令
config 更改配置
search 查询DNS
bulk-search 批量查询DNS
resources 获取当前账号资源信息(API剩余请求次数)
查看子命令帮助
getdns <command> -h
config
config 命令用于配置默认的用户名和密码(DnsDB账号),配置该项可以让您在使用 search , api_user 命令时无需再次输入 API ID 和 API Key
getdns config -u <your username> -p <your password>
查看当前配置
getdns config --show
恢复默认配置
getdns config --reset
配置代理:
HTTP代理
getdns config --proxy http://user:pass@host:port
SOCKS5代理
getdns config --proxy socks5://user:pass@host:port
search
search 命令用于查询dns记录。没有使用 -a 或 --all 参数时,该命令每成功执行一次扣除当前账号一次API请求次数, 且每次执行最多返回50条查询结果
getdns search --domain example.com
-o 参数用于指定输出位置, 默认为 - , 表示输出到标准输出( stdout ), 也可以输入到文件中
getdns search --domain example.com -o dns-output.txt
a 或 --all 参数将会返回全部查询结果, 每次查询会根据结果数扣除当前账号的API请求次数
getdns search --domain example.com -a -o dns-output.txt
-m 或 --max 参数限制最多输出查询结果数量。例如限制最多输出5条查询结果:
getdns search --domain example.com -a --max 5
输出格式
search 命令可以通过以下参数改变输出格式
--json 指定输出格式为 JSON ,这是默认选项。
--csv 指定输出格式为 CSV 。
--format <format-string> 自定义输出格式。在 <format-string> 中, #{host} 将会被DNS记录的host替换, #{type} 将会被DNS记录的type替换, #{value} 将会被DNS记录的value替换,其他内容将会被保留。例如:
getdns search --domain exmpale.com --format "host:#{host}, type:#{type}, value:#{value}"
输出结果
host:a1.example.com, type:a, value:1.1.1.1 host:a2.example.com, type:a, value:1.1.1.2 host:a3.example.com, type:a, value:1.1.1.3 host:a4.example.com, type:a, value:1.1.1.4 ......
只输出IPv4地址
getdns search --domain example.com --type a --format "#{value}"
输出结果
1.1.1.1 1.1.1.2 1.1.1.3 1.1.1.4 ......
api_user
查看剩余API请求次数
getdns api_user
FAQ
Mac OS X 使用getdns命令遇到下面错误,您可以查看 这里
requests.exceptions.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)
Links
Metadata
Release files for dnsdb-getdns 0.1.2b1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dnsdb_getdns-0.1.2b1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Release files / dnsdb_getdns-0.1.2b1-py2.py3-none-any.whl
| Download URL | dnsdb_getdns-0.1.2b1-py2.py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c44329d4ac40ca12c46f2a558dc1835a96eb92af1cb0399a8122dd3c5a4a57b3
|
|
BLAKE2b-256 checksum How to use checksums |
71ca44cbe8014fb6ef2c438bd6ad5a6ce621dfe332b54c80cbc39cb6f4a83511
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |