Exemple #1
0
 def run(self):
     myplugin = Plugin()
     myplugin.config()
     handled = 0
     domain = None
     while True:
         (domain, nameservers) = self.channel.get()
         if domain == "" or domain is None:
             break
         handled = handled + 1
         try:
             result = myplugin.query(domain, nameservers)
         except Exception:
             print >>sys.stderr, traceback.format_exc()
             fatal ("%s: Cannot query domain %s\n\n" % (self.getName(), domain))
         if debug > 2:
             print "Result for %s: \"%s\"" % (domain, result)
         try:
             result.store(self.uuid)
             del result
         except Exception:
             print >>sys.stderr, traceback.format_exc()
             fatal ("%s: Cannot store domain %s\n\n" % \
                    (self.getName(), domain))
         if handled % report_every_n_domains == 0:
             self.report.put("PROGRESS:%s:%i" % (self.getName(), handled))
             handled = 0 # "handled" is not the total from the beginning of the thread,
             # it is the number of domains processed since the last report.
     self.report.put("FINAL:%s:%i" % (self.getName(), handled))
     myplugin.final()
     if debug > 1:
         print "%s ends" % self.getName()
Exemple #2
0
except getopt.error, reason:
    usage(reason)
    sys.exit(1)
if len(args) < 1:
    usage()
    sys.exit(1)
zonefile = args[0]
if module is None:
    usage("-m option is mandatory")
    sys.exit(1)
module_args = args[1:]

try:
    exec ("import DNSdelve.%s as %s" % (module, module))
except ImportError, message:
    fatal ("No such module " + module + \
           " in my Python path: " + str(message))
except Exception:
    fatal ("Module " + module + " cannot be loaded: " + \
           str(sys.exc_type) + ": " + str(sys.exc_value) + \
           ".\n    May be a missing or erroneous option?")
try:
    exec ("from DNSdelve.%s import Plugin" % module)
except ImportError, message:
    fatal ("No constructor Plugin in " + module + \
           ": " + str(message))
try:
    exec ("%s.config(%s, \"%s\", %s)" % (module, str(module_args), zonefile, percentage_domains))
except AttributeError, message:
    fatal ("No method (or invalid methode) config() in " + module + \
           ": " + str(message))
if debug > 0: