【问题标题】:How to query a URL (DNS lookup) using Windows terminal?如何使用 Windows 终端查询 URL(DNS 查找)?
【发布时间】:2014-04-16 21:13:53
【问题描述】:

我正在尝试使用 Windows 的命令行来使用他们的 API (link) 查询 http:BL,但似乎无法执行我想要的命令。

我想我应该使用类似的东西:

ping secretkey.7.1.1.127.dnsbl.httpbl.org

但我只得到:

 [1] ""                                                                                  
 [2] "Pinging secretkey.7.1.1.127.dnsbl.httpbl.org [127.1.1.7] with 32 bytes of data:"
 [3] "Reply from 127.1.1.7: bytes=32 time<1ms TTL=128"                                   
 [4] "Reply from 127.1.1.7: bytes=32 time<1ms TTL=128"                                   
 [5] "Reply from 127.1.1.7: bytes=32 time<1ms TTL=128"                                   
 [6] "Reply from 127.1.1.7: bytes=32 time<1ms TTL=128"                                   
 [7] ""                                                                                  
 [8] "Ping statistics for 127.1.1.7:"                                                    
 [9] "    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),"                          
[10] "Approximate round trip times in milli-seconds:"                                    
[11] "    Minimum = 0ms, Maximum = 0ms, Average = 0ms"    

或者

ping -a secretkey.7.1.1.127.dnsbl.httpbl.org

但似乎都没有给我想要的输出。

关于使用哪个命令有什么建议吗?

更新。

使用:

nslookup -debug secretkey.7.1.1.127.dnsbl.httpbl.org

我明白了:

Non-authoritative answer:
 ------------ Got answer:     HEADER: 
opcode = QUERY, id = 1, rcode = NXDOMAIN 
header flags:  response, want recursion, recursion avail. 
questions = 1,  answers = 0,  authority records = 1,  additional = 0      QUESTIONS: 
1.1.168.192.in-addr.arpa, type = PTR, class = IN     AUTHORITY RECORDS:     ->  168.192.in-addr.arpa 
ttl = 86399 (23 hours 59 mins 59 secs) 
primary name server = dns.netvision.net.il 
responsible mail addr = hostmaster.netvision.net.il 
serial  = 2011010100 
refresh = 1800 (30 mins) 
retry   = 900 (15 mins) 
expire  = 604800 (7 days) 
default TTL = 604800 (7 days)  ------------ Server:  UnKnown Address:  192.168.1.1  ------------ Got answer:     HEADER: 
opcode = QUERY, id = 2, rcode = NOERROR 
header flags:  response, want recursion, recursion avail. 
questions = 1,  answers = 1,  authority records = 3,  additional = 3      QUESTIONS: 
secretkey.7.1.1.127.dnsbl.httpbl.org, type = A, class = IN     ANSWERS:     ->  secretkey.7.1.1.127.dnsbl.httpbl.org 
internet address = 127.1.1.7 
ttl = 300 (5 mins)     AUTHORITY RECORDS:     ->  dnsbl.httpbl.org 
nameserver = ns2.httpbl.org 
ttl = 300 (5 mins)     ->  dnsbl.httpbl.org 
nameserver = ns3.httpbl.org 
ttl = 300 (5 mins)     ->  dnsbl.httpbl.org 
nameserver = ns1.httpbl.org 
ttl = 300 (5 mins)     ADDITIONAL RECORDS:     ->  ns1.httpbl.org 
internet address = 209.124.55.46 
ttl = 300 (5 mins)     ->  ns2.httpbl.org 
internet address = 66.114.104.118 
ttl = 300 (5 mins)     ->  ns3.httpbl.org 
internet address = 81.17.242.92 
ttl = 300 (5 mins)  ------------ ------------ Got answer:     HEADER: 
opcode = QUERY, id = 3, rcode = NOERROR 
header flags:  response, want recursion, recursion avail. 
questions = 1,  answers = 0,  authority records = 1,  additional = 0      QUESTIONS: 
secretkey.7.1.1.127.dnsbl.httpbl.org, type = AAAA, class = IN     AUTHORITY RECORDS:     ->  dnsbl.httpbl.org 
ttl = 1162 (19 mins 22 secs) 
primary name server = dnsbl.httpbl.org 
responsible mail addr = dnsadmin.projecthoneypot.org 
serial  = 1397664327 
refresh = 7200 (2 hours) 
retry   = 7200 (2 hours) 
expire  = 604800 (7 days) 
default TTL = 3600 (1 hour)  ------------ Name:    secretkey.7.1.1.127.dnsbl.httpbl.org Address:  127.1.1.7 > 

【问题讨论】:

    标签: windows terminal ip spam-prevention httpbl


    【解决方案1】:

    你正在寻找nslookup:

    nslookup -debug secretkey.7.1.1.127.dnsbl.httpbl.org
    

    除其他信息外,这部分是您要查找的内容:

    ANSWERS:
    ->  secretkey.7.1.1.127.dnsbl.httpbl.org
        internet address = 127.1.1.7
        ttl = 21236
    

    黑名单中的127.1.1.7 之类的答案通常意味着它是肯定的。没有答案就是否定的。

    【讨论】:

    • 感谢 silverwind - 我用输出更新了问题。关于在那里看什么有什么建议吗? (我看不到“答案”)
    • 不知道为什么你会看到这么多的输出,但internet address = 127.1.1.7 正是你要找的。您可以尝试像这样过滤输出:nslookup -debug secretkey.7.1.1.127.dnsbl.httpbl.org | findstr internet。不过,如果您对 DNS 问题很认真,我会推荐 dig,它也适用于 Windows。
    • 或者,在没有-debug 的情况下运行。带有Non-authoritative answer: 的部分是相关的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-09-28
    • 2019-06-30
    • 2020-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-06
    相关资源
    最近更新 更多