예제 #1
0
def updateWhois(domain, s, domain_sid, c, t):
    
    # change below line to use other Whois module derived from WhoisBase
    w = retWhois(domain)
    xwhois = WhoisGenericRegex()
    xwhois.query(domain, w)
    cname = DNSUtil.retCName(domain)
    tel = xwhois.tel
    email = xwhois.email
    cdate = xwhois.createdate
    name = xwhois.registrar
    owner = xwhois.registrant
    ns = xwhois.ns

    #   check if the same record (by scan date) is found in whois table
    wlist = (domain, email, owner)
    if t == 'whois':
        c.execute("SELECT * FROM whois WHERE domain=? and email=? and registrant=?", (wlist))
    else:
        c.execute("SELECT * FROM passive_whois WHERE domain=? and email=? and registrant=?", (wlist))
    found = c.fetchone()
    if found is None:
        #   preparing list record ...
        list = (domain_sid, s, domain, S_DATE, cdate, name, ns, email, tel, owner)
        return list
    else:
        return ''
예제 #2
0
def updateDomains(ip_addr, ip_sid, s, c, t):
    d = []
    d = DNSUtil.retDomain(ip_addr, d)
    print "There are: " + str(len(d)) + " domains parking to " + ip_addr
    
    #   filter out if ip_addr parked with > 200 domains
    if len(d) > 0 and len(d) < 200:
        #   update domains
        for i in range(0, len(d)):
            
            #   init variables
            domain = d[i]
            
            # get Cname from (d)
            name = DNSUtil.retCName(domain)
            
            # check if the same record is found in domains table
            c.execute("SELECT * FROM domains WHERE domain=?", ((domain),))
            found = c.fetchone()
            
            #   add if not found
            if found is None:
                #   adding record ...
                list = (ip_sid, s, S_DATE, domain, name)
                if t == 'domains':
                    c.execute("INSERT INTO domains VALUES (NULL,?,?,?,?,?)", list)
                    print "[+] Adding to domains... " + domain
                else:
                    c.execute("INSERT INTO passive_domains VALUES (NULL,?,?,?,?,?)", list)
                    print "[+] Adding to passive_domains..." + domain
            else:
                print "[-] No records updated..."
    
    else:
        #   domains not updated
        print "[-] No or too many domain records updated|to be updated..."