当前位置: 首页>>代码示例>>Python>>正文


Python Milter类代码示例

本文整理汇总了Python中Milter的典型用法代码示例。如果您正苦于以下问题:Python Milter类的具体用法?Python Milter怎么用?Python Milter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Milter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: macromilterSUT

def macromilterSUT(request):

    macromilter.LOG_DIR = 'test_output/'
    macromilter.MATCHED_FILE_LOG_DIR = 'test_output/matched_files/'
    macromilter.initialize_async_process_queues(20)
    macromilter.cleanup_queues()

    Milter.factory = macromilter.MacroMilter
    flags = Milter.CHGBODY + Milter.CHGHDRS + Milter.ADDHDRS
    flags += Milter.ADDRCPT
    flags += Milter.DELRCPT
    Milter.set_flags(flags)
    Milter.factory._ctx = TestBase()

    sut = macromilter.MacroMilter()
    sut.messageToParse = StringIO.StringIO()

    def tear_down():
        # clear queues
        macromilter.cleanup_queues()
        macromilter.WhiteList = ()

    request.addfinalizer(tear_down)

    return sut
开发者ID:heinrichheine,项目名称:MacroMilter,代码行数:25,代码来源:test_macromilter.py

示例2: main

def main():
  # Run as a specific user
  if run_as_user != None:
    run_as_uid = getpwnam(run_as_user).pw_uid
    run_as_gid = getpwnam(run_as_user).pw_gid
    print "%s running as %s (uid=%s,gid=%s)" % (time.strftime('%Y%b%d %H:%M:%S'), run_as_user, run_as_uid, run_as_gid)
    # always set gid first, because once we've set uid, we can't set gid anymore
    os.setgid(run_as_gid)
    os.setuid(run_as_uid)

  # Log startup
  print "%s milter startup" % time.strftime('%Y%b%d %H:%M:%S')
  sys.stdout.flush()

  # Handle log printing in the background
  bt = Thread(target=background)
  bt.start()

  # Register to have the Milter factory create instances of your class:
  Milter.factory = MilterSysUser
  #Milter.set_flags(Milter.ADDHDRS) # we only need to add a header

  flags = Milter.CHGBODY + Milter.CHGHDRS + Milter.ADDHDRS
  flags += Milter.ADDRCPT
  flags += Milter.DELRCPT
  Milter.set_flags(flags)       # tell Sendmail which features we use

  Milter.runmilter("pythonfilter", socketname, timeout)

  # Wait for logger to complete
  logq.put(None)
  bt.join()
  print "%s milter shutdown" % time.strftime('%Y%b%d %H:%M:%S')
开发者ID:mensink,项目名称:milter-sysuser,代码行数:33,代码来源:milter-sysuser.py

示例3: run

 def run(self):
     utils.log_to_syslog()
     logger.info('DSPAM Milter startup (v{})'.format(VERSION))
     self.configure()
     utils.daemonize(self.pidfile)
     Milter.factory = DspamMilter
     Milter.runmilter('DspamMilter', self.socket, self.timeout)
     logger.info('DSPAM Milter shutdown (v{})'.format(VERSION))
     logging.shutdown()
开发者ID:cirrax,项目名称:pydspam,代码行数:9,代码来源:milter.py

示例4: main

def main():
  bt = Thread()
  bt.start()
  timeout = 60
  # Register with Milter factory 
  Milter.factory = pgpMilter
  # we don't modify mails, so no flags
  Milter.set_flags(0)
  Milter.runmilter("pgpmilter",socket,timeout)
  bt.join()
开发者ID:glamrock,项目名称:pgpmilter,代码行数:10,代码来源:pgpmilter.py

示例5: main

def main():
  socketname = "/var/run/nomixsock"
  timeout = 600
  # Register to have the Milter factory create instances of your class:
  Milter.factory = NoMixMilter
  print("%s milter startup" % time.strftime('%Y%b%d %H:%M:%S'))
  sys.stdout.flush()
  Milter.runmilter("nomixfilter",socketname,timeout)
  logq.put(None)
  bt.join()
  print("%s nomix milter shutdown" % time.strftime('%Y%b%d %H:%M:%S'))
开发者ID:sdgathman,项目名称:pymilter,代码行数:11,代码来源:milter-nomix.py

示例6: main

def main():
    bt = Thread(target=background)
    bt.start()
    socketname = "/var/run/pagure/paguresock"
    timeout = 600
    # Register to have the Milter factory create instances of your class:
    Milter.factory = PagureMilter
    print "%s pagure milter startup" % time.strftime("%Y%b%d %H:%M:%S")
    sys.stdout.flush()
    Milter.runmilter("paguremilter", socketname, timeout)
    logq.put(None)
    bt.join()
    print "%s pagure milter shutdown" % time.strftime("%Y%b%d %H:%M:%S")
开发者ID:DhritiShikhar,项目名称:pagure,代码行数:13,代码来源:comment_email_milter.py

示例7: main

def main():
  parser = OptionParser()
  parser.add_option('-s', '--socket', dest='socket', help='Socket to listen (e.g. inet:[email protected])')
  parser.add_option('-t', '--timeout', type='int', dest='timeout', default='10', help='MTA timeout (default is 10 sec)')
  (options, args) = parser.parse_args()
  if not options.socket:
    parser.print_help()
    sys.exit(0)
    
  Milter.factory = TuMilter
  print "%s TuMilter startup" % time.strftime('%Y %b %d %H:%M:%S')
  sys.stdout.flush()
  Milter.runmilter("tumilter",options.socket,options.timeout)
开发者ID:k0ste,项目名称:tumilter,代码行数:13,代码来源:tumilter.py

示例8: main

def main():
    os.umask(007)
    Milter.set_flags(  Milter.QUARANTINE
                     + Milter.CHGHDRS
                     + Milter.DELRCPT
                     + Milter.ADDRCPT
                     + Milter.CHGFROM)

    config = getConfig()

    def instantiate():
        return DMARCMilter(config)

    Milter.factory = instantiate
    Milter.runmilter("dmarc_milter", config.socket, config.timeout)
开发者ID:matthias-mo,项目名称:dmarc_milter,代码行数:15,代码来源:dmarc.py

示例9: __init__

	def __init__(self):  # A new instance with each new connection.
		self.id = Milter.uniqueID()  # Integer incremented with each call.
		self.messageToParse = None
		self.level = 0
		self.headercount = 0
		self.attachment_contains_macro = False
		self.size = 0
开发者ID:sbidy,项目名称:MacroMilter,代码行数:7,代码来源:macromilter.py

示例10: __init__

 def __init__(self):
   self.tempname = None
   self.mailfrom = None
   self.fp = None
   self.bodysize = 0
   self.id = Milter.uniqueID()
   self.user = None
开发者ID:sdgathman,项目名称:pymilter,代码行数:7,代码来源:sample.py

示例11: envrcpt

  def envrcpt(self, to, *str):
    rcptinfo = to,Milter.dictfromlist(str)
    self.R.append(rcptinfo)
    self.log("to: ", parse_addr(to)[0])

    a = 23
    b = 42
    addr = parse_addr(to)[0]
    euser = addr[0:2]
    ecsum = addr[2:4]
    eitext = addr[4:]
    edomain = parse_addr(to)[1]
    genitext = ''.join((euser, eitext, edomain))
    gencsum = hashlib.sha512(genitext.encode('utf-8')).hexdigest()
    posa = int(a)-1
    posb = int(b)-1
    csuma = gencsum[posa:(posa+1)]
    csumb = gencsum[posb:(posb+1)]

    self.log(addr, euser, ecsum, eitext, edomain, genitext, gencsum, posa, posb, csuma, csumb)

    if(ecsum != "".join((csuma,csumb))):
      self.log("Computer sagt nein.")
      return Milter.REJECT

    self.log("Computer sagt ja.")
    return Milter.CONTINUE
开发者ID:hax404,项目名称:rabf,代码行数:27,代码来源:rabf.py

示例12: main

def main():
  bt = Thread(target=background)
  bt.start()
  socketname = "/home/stuart/pythonsock"
  timeout = 600
  # Register to have the Milter factory create instances of your class:
  Milter.factory = myMilter
  flags = Milter.CHGBODY + Milter.CHGHDRS + Milter.ADDHDRS
  flags += Milter.ADDRCPT
  flags += Milter.DELRCPT
  Milter.set_flags(flags)       # tell Sendmail which features we use
  print("%s milter startup" % time.strftime('%Y%b%d %H:%M:%S'))
  sys.stdout.flush()
  Milter.runmilter("pythonfilter",socketname,timeout)
  logq.put(None)
  bt.join()
  print("%s bms milter shutdown" % time.strftime('%Y%b%d %H:%M:%S'))
开发者ID:sdgathman,项目名称:pymilter,代码行数:17,代码来源:milter-template.py

示例13: __init__

 def __init__(self, conf=None):  # A new instance with each new connection.
     self.id = Milter.uniqueID()
     if conf is not None:
         assert isinstance(conf, config.Config)
         self.conf = conf
     else:
         self.conf = config.Config()
     self.gpgm_gpg = gnupg.GPG(gnupghome=self.conf.gnupghome)
开发者ID:burgerdev,项目名称:gnupg-milter,代码行数:8,代码来源:themilter.py

示例14: main

def main():
  bt = Thread(target=background)
  bt.start()
  socketname = "/home/stuart/pythonsock"
  timeout = 600
 
  Milter.factory = myMilter
  flags = Milter.CHGBODY + Milter.CHGHDRS + Milter.ADDHDRS
  flags += Milter.ADDRCPT
  flags += Milter.DELRCPT
  Milter.set_flags(flags)      
  print "%s milter startup" % time.strftime('%Y%b%d %H:%M:%S')
  sys.stdout.flush()
  Milter.runmilter("pythonfilter",socketname,timeout)
  logq.put(None)
  bt.join()
  print "%s bms milter shutdown" % time.strftime('%Y%b%d %H:%M:%S')
开发者ID:naruto0323,项目名称:Milters,代码行数:17,代码来源:timeanduser.py

示例15: __init__

    def __init__(self):
        """
        Create a new milter instance.

        """
        self.id = Milter.uniqueID()
        self.message = ''
        self.recipients = []
        self.dspam = None
开发者ID:cirrax,项目名称:pydspam,代码行数:9,代码来源:milter.py


注:本文中的Milter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。