import os
import socket
import traceback

data = open('ips.txt').read().splitlines()
f = open('gips.txt','w')

for it in data:
    try:
        hostname = socket.gethostbyaddr(it)
        hs = hostname[0].lower()
        if hs.startswith('rate') and hs.endswith('google.com'):
            print(f'GootHost {hs}  ip: {it}')
            f.write(f'{it}\n')
    except:
        print(traceback.format_exc())
        hostname=''
        print(f'{it} -- {hostname}')

    