Skip to content
Snippets Groups Projects
Select Git revision
  • test-fat
  • master default protected
  • hpke
  • ppc-chacha-4core
  • delete-internal-name-mangling
  • master-updates
  • ppc-gcm
  • ppc-chacha-2core
  • refactor-ecc-mod
  • ppc-chacha-core
  • use-mpn_cnd-functions
  • optimize-ecc-invert
  • default-m4-quote-char
  • power-asm-wip
  • chacha-3core-neon
  • x86_64-salsa20-2core
  • salsa20-2core-neon
  • bcrypt
  • arm-salsa20-chacha-vsra
  • test-shlib-dir
  • nettle_3.6_release_20200429
  • nettle_3.6rc3
  • nettle_3.6rc2
  • nettle_3.6rc1
  • nettle_3.5.1_release_20190627
  • nettle_3.5_release_20190626
  • nettle_3.5rc1
  • nettle_3.4.1_release_20181204
  • nettle_3.4.1rc1
  • nettle_3.4_release_20171119
  • nettle_3.4rc2
  • nettle_3.4rc1
  • nettle_3.3_release_20161001
  • nettle_3.2_release_20160128
  • nettle_3.1.1_release_20150424
  • nettle_3.1_release_20150407
  • nettle_3.1rc3
  • nettle_3.1rc2
  • nettle_3.1rc1
  • nettle_3.0_release_20140607
40 results

aes192-set-encrypt-key.c

Blame
  • Forked from Nettle / nettle
    Source project has a limited visibility.
    main.py 1.40 KiB
    #!/usr/bin/env python3
    
    import smtpd
    import asyncore
    from email import message_from_bytes
    import email.policy
    from dateutil.parser import parse
    import subprocess
    import re
    
    class CustomSMTPServer(smtpd.SMTPServer):
        def process_message(self, peer, mailfrom, rcpttos, data, **kwargs):
            msg = message_from_bytes(data, policy=email.policy.default)
            body = msg.get_content()
            d = parse(msg.get('Date'))
            title = msg.get('Subject')
    
            if not title:
                print("Title missing")
                return
    
            valid_destinations = [
                    'massutskick@vastgota.nation.liu.se',
                    'massutskick@vastgota.lysator.liu.se',
                    ]
    
            for destination in valid_destinations:
                if destination in msg.get('To'):
                    break
            else:
                print('Will only publish massutskick')
                return
    
            title = re.sub('^\[.*\] *', '', title)
    
            subprocess.run(['wp', 'post', 'create',
                    '--post_author=2'
                    f'--post_date={d:%Y-%m-%d}',
                    f"--post_title={title}",
                    '--post_status=publish',
                    '--post_category=Veckomail',
                    f"--post_content=<pre>{body}</pre>"],
                    cwd='/usr/share/wordpress',
                    shell=False)
            return
    
    
    server = CustomSMTPServer(('0.0.0.0', 1025), None,
            decode_data=False)
    asyncore.loop()