summaryrefslogtreecommitdiff
path: root/backup/old/whois_script.py
blob: a4a6a6e565fab2ea056d69be4c0673ad106fbc40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from pprint import pprint

import json
import subprocess
import whois

if __name__ == "__main__":
    f = open('output', 'r')
    d = json.loads(f.read())
    # bashCommand = "whois -h whois.cymru.com \" -v 192.42.173.30\""
    # process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
    # output, error = process.communicate()
    #
    # r = []
    # x = output.split('\n')[2:-1]
    #
    # for y in x:
    #     z = y.split('|')
    #     r.append(z[0].strip(' '))
    #
    # print r

    f = open('list03', 'w')
    f.write('begin\n')


    for tld in d:
        print tld
        for host in d[tld]:
            f.write(d[tld][host][0] + '\n')

    f.write('end\n')