我在用这个Python脚本做错什么了?

时间:2018-12-06 14:24:10

标签: python-3.x dig

这是我的第一个python脚本(一般为脚本和编程)。我有一个IP列表,我想对每个IP进行反向挖掘。我发现最简单的方法是编写python脚本来做到这一点。输出看起来没有希望。有人可以指出我在做什么错。 TIA

from subprocess import call

f_file = open("NET-DNS.txt", "r")

for IP in f_file.readlines():
    call("dig @4.2.2.2 ANY -x " + IP + "+short")

f_file.close()

输出:

 ; <<>> DiG 9.12.3 <<>> @4.2.2.2 ANY -x 98.138.219.231
+short
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35543
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 8192
;; QUESTION SECTION:
;231\010+short.219.138.98.in-addr.arpa. IN ANY

;; ANSWER SECTION:
231\010+short.219.138.98.in-addr.arpa. 1560 IN PTR UNKNOWN-98-138-219-X.yahoo.com.

;; AUTHORITY SECTION:
219.138.98.in-addr.arpa. 9832   IN  NS  ns3.yahoo.com.
219.138.98.in-addr.arpa. 9832   IN  NS  ns1.yahoo.com.
219.138.98.in-addr.arpa. 9832   IN  NS  ns5.yahoo.com.
219.138.98.in-addr.arpa. 9832   IN  NS  ns4.yahoo.com.
219.138.98.in-addr.arpa. 9832   IN  NS  ns2.yahoo.com.

;; Query time: 9 msec
;; SERVER: 4.2.2.2#53(4.2.2.2)
;; WHEN: Thu Dec 06 06:01:11 Pacific Standard Time 2018
;; MSG SIZE  rcvd: 197

;; communications error to 4.2.2.2#53: end of file

; <<>> DiG 9.12.3 <<>> @4.2.2.2 ANY -x 98.138.219.231
+short
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1539
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 8192
;; QUESTION SECTION:
;231\010+short.219.138.98.in-addr.arpa. IN ANY

;; ANSWER SECTION:
231\010+short.219.138.98.in-addr.arpa. 1555 IN PTR UNKNOWN-98-138-219-X.yahoo.com.

;; AUTHORITY SECTION:
219.138.98.in-addr.arpa. 9827   IN  NS  ns3.yahoo.com.
219.138.98.in-addr.arpa. 9827   IN  NS  ns1.yahoo.com.
219.138.98.in-addr.arpa. 9827   IN  NS  ns5.yahoo.com.
219.138.98.in-addr.arpa. 9827   IN  NS  ns4.yahoo.com.
219.138.98.in-addr.arpa. 9827   IN  NS  ns2.yahoo.com.

;; Query time: 9 msec
;; SERVER: 4.2.2.2#53(4.2.2.2)
;; WHEN: Thu Dec 06 06:01:16 Pacific Standard Time 2018
;; MSG SIZE  rcvd: 197

;; communications error to 4.2.2.2#53: end of file
;; communications error to 4.2.2.2#53: end of file

Process finished with exit code 0

0 个答案:

没有答案
相关问题