aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST.in3
-rw-r--r--PKG-INFO61
-rwxr-xr-xpygm2n99
-rwxr-xr-xpygn2m126
-rw-r--r--setup.cfg4
-rwxr-xr-xsrc/pygm2n99
-rwxr-xr-xsrc/pygn2m126
7 files changed, 0 insertions, 518 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index 9726a32..0000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,3 +0,0 @@
-recursive-include examples *
-recursive-include test *
-global-exclude *.py[cod]
diff --git a/PKG-INFO b/PKG-INFO
deleted file mode 100644
index d88a6ff..0000000
--- a/PKG-INFO
+++ /dev/null
@@ -1,61 +0,0 @@
-Metadata-Version: 1.1
-Name: pygn
-Version: 0.10.1
-Summary: The Python Gateway Script: news2mail mail2news gateway
-Home-page: https://gitlab.com/mcepl/pyg
-Author: Cosimo Alfarano, Matej Cepl
-Author-email: kalfa@debian.org, mcepl@cepl.eu
-License: GPLv3
-Description: Python Gateway Script from news to mail and vice versa.
-
- Copyright:
- Copyright (C) 2000-2001,2012 Cosimo Alfarano <kalfa@debian.org>
- Copyright (C) 2014 Matěj Cepl <mcepl@cepl.eu>
-
- A copy of the GNU General Public License, version 3, can be found in
- http://www.gnu.org/licenses/gpl-3.0.txt
-
- It is intended to be a full SMTP/NNTP rfc compliant gateway
- with whitelist manager.
-
- You will probably have to install a mail-transport-agent and/or
- news-transport-system package to manage SMTP/NNTP traffic.
-
- MTA is needed for mail2news service, since mail have to be
- processed on a box where pyg is installed. You can use a remote
- smtpserver for news2mail.
-
- News system is useful but not needed, since you can send articles to a
- remote SMTP server (ie: moderated NG) where is installed pyg, otherwise you
- will need it.
-
- It refers to rfc 822 (mail) and 850 (news).
-
- ----------------
-
- List of file:
-
- mail2news.py mail to news python class module
- news2mail.py news to mail python class module
- setup.py setup script
- pygm2n mail to news gateway frontend
- pygn2m news to mail gateway frontend
- whitelist.py whitelist managing python class module
- wlp C backend for whitelist parser (wlp) directory
- examples documentation and exaples directory
-
-Keywords: nntp,email,gateway
-Platform: UNKNOWN
-Classifier: Development Status :: 3 - Alpha
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
-Classifier: Programming Language :: Python :: 3.5
-Classifier: Programming Language :: Python :: 3.6
-Classifier: Intended Audience :: System Administrators
-Classifier: Topic :: Utilities
-Classifier: Topic :: Communications :: Usenet News
-Classifier: Environment :: Console
-Classifier: Operating System :: OS Independent
-Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
-Requires: rply
diff --git a/pygm2n b/pygm2n
deleted file mode 100755
index 3629857..0000000
--- a/pygm2n
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-"""News to mail gateway script. Copyright 2000 Cosimo Alfarano
-
-Author: Cosimo Alfarano
-Date: June 11 2000
-
-pygs - Copyright 2000 by Cosimo Alfarano <Alfarano@Students.CS.UniBo.It>
-You can use this software under the terms of the GPL. If we meet some day,
-and you think this stuff is worth it, you can buy me a beer in return.
-
-Thanks to md for this useful formula. Beer is beer.
-
-Gets news article and sends it via SMTP.
-"""
-from __future__ import print_function
-
-import argparse
-import logging
-import mail2news
-import nntplib
-import sys
-
-# logging.basicConfig(level=logging.DEBUG)
-
-def parse_cmdline():
- parser = argparse.ArgumentParser(
- description='%s version %s - Copyright 2000 Cosimo Alfarano\n%s' %
- ('pyg', mail2news.VERSION, mail2news.DESC))
-
- parser.add_argument('-s', '--newsserver', default='')
- parser.add_argument('-a', '--approver', default='',
- help="address of moderator/approver")
- parser.add_argument('-n', '--newsgroup', default='',
- help='newsgroup[s] (specified as comma separated ' +
- 'without spaces list)', required=True)
- parser.add_argument('-u', '--user', default='',
- help='NNTP server user (for authentication)')
- parser.add_argument('-p', '--password', default='',
- help='NNTP server password (for authentication)')
- parser.add_argument('-P', '--port', default='')
- parser.add_argument('-e', '--envellope', default='')
- parser.add_argument('-l', '--logfile')
-
- parser.add_argument('-T', '--test', action='store_true',
- help='test mode (not send article via NNTP)')
- parser.add_argument('-v', '--verbose', action='store_true',
- help='verbose output ' +
- '(usefull with -T option for debugging)')
-
- args = parser.parse_args()
-
- if not args.newsgroup:
- raise argparse.ArgumentError('Error: Missing Newsgroups\n')
-
- return args
-
-
-"""main is structured in 4 phases:
- 1) check and set pyg's internal variables
- 2) check whitelist for users' permission
- 3) format rfc 822 headers from input article
- 4) open smtp connection and send e-mail
-"""
-
-
-try:
-
- """phase 1:
- check and set pyg's internal variables
- """
- opt = parse_cmdline()
-
- m2n = mail2news.mail2news(opt)
- owner = None
-
- """phase 3:
- format rfc 822 headers from input article
- """
- m2n.renameheads() # rename useless heads
- m2n.removeheads() # remove other heads
-
- m2n.sortheads() # sort remaining heads :)
-
- if opt.verbose:
- print(m2n.message.as_string())
-
- logging.debug('m2n.payload = len %d', len(m2n.message.get_payload()))
- if len(m2n.message.get_payload()) > 0:
-# wl.logmsg(m2n.heads_dict,wl.ACCEPT,owner)
- if not opt.test:
- try:
- resp = m2n.sendemail()
- except nntplib.NNTPError as ex:
- print(ex)
-
-except KeyboardInterrupt:
- print('Keyboard Interrupt')
- sys.exit(0)
diff --git a/pygn2m b/pygn2m
deleted file mode 100755
index a2c07cb..0000000
--- a/pygn2m
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-"""News to mail gateway script. Copyright 2000 Cosimo Alfarano
-
-Author: Cosimo Alfarano
-Date: June 11 2000
-
-pygs - Copyright 2000 by Cosimo Alfarano <Alfarano@Students.CS.UniBo.It>
-You can use this software under the terms of the GPL. If we meet some day,
-and you think this stuff is worth it, you can buy me a beer in return.
-
-Thanks to md for this useful formula. Beer is beer.
-
-Gets news article from stdin and sends it via SMTP.
-"""
-from __future__ import print_function
-
-import argparse
-from mail2news import VERSION, DESC
-import news2mail
-import os
-import sys
-import whitelist
-
-
-def parse_cmdline():
- """
- set a dictionary with smtp new header in gw parameter (gw.smtpheads)
- return (test,verbose) boolean tuple
- """
- parser = argparse.ArgumentParser(
- description='pyg version %s - Copyright 2000 Cosimo Alfarano\n%s' %
- (VERSION, DESC))
-
- parser.add_argument('-H', '--smtpserver', default='')
- parser.add_argument('-s', '--sender', required=True, default='')
- parser.add_argument('-e', '--envelope', default='')
- parser.add_argument('-t', '--to', dest='rcpt', required=True)
- parser.add_argument('-w', '--wlfile')
- parser.add_argument('-l', '--logfile')
-
- parser.add_argument('-T', '--test',
- help='test mode (not send article via SMTP)',
- action='store_true')
- parser.add_argument('-v', '--verbose', help='verbose output',
- action='store_true')
-
- opts = parser.parse_args()
-
-# By rfc822 [Resent-]Sender: should be ever set, unless == From:
-# (not this case). Should be a human, while [Resent-]From: may be a program.
-
- if opts.rcpt == '' or opts.sender == '':
- raise argparse.ArgumentError('missing command line option')
-
- if opts.envelope == '' and opts.sender != '':
- opts.envelope = opts.sender
-
- return opts
-
-
-"""main is structured in 4 phases:
- 1) check and set pyg's internal variables
- 2) check whitelist for users' permission
- 3) format rfc 822 headers from input article
- 4) open smtp connection and send e-mail
-"""
-
-"""phase 1:
-check and set pyg's internal variables
-"""
-
-# it returns only test, other parms are set directly in the actual
-# parameter
-args = parse_cmdline()
-
-n2m = news2mail.news2mail(verbose=args.verbose)
-owner = None
-
-# check if n2m has some file prefercences set on commandline
-if args.wlfile is None:
- wl = os.path.expanduser(os.path.join(os.path.dirname(__file__), 'pyg.whitelist'))
-else:
- wl = args.wlfile
-
-if args.logfile is None:
- log = os.path.expanduser(os.path.join(os.path.dirname(__file__), 'pyg.log'))
-else:
- log = args.logfile
-
-wl = whitelist.whitelist(wl, log)
-
-"""phase 2:
-check whitelist for user's permission
-"""
-
-# make a first check of From: address
-owner = wl.checkfrom(n2m.message['From'])
-if owner is None:
- if sys.stdin.isatty() == 1 or args.test:
- print ('"%s" is not in whitelist!' % (n2m.message['From'][:-1]))
- else:
- wl.logmsg(n2m.nntpheads, wl.DENY)
-
- # if verbose, I want to print out headers, so I can't
- # exit now.
- if not args.verbose:
- sys.exit(1)
-
-# Reformat the message
-n2m.process_message()
-
-# prints formatted email message only (without send) if user wants
-if args.verbose:
- print(n2m.message.as_string())
-
-if owner is None:
- sys.exit(1)
-
-"""phase 4:
-open smtp connection and send e-mail
-"""
-
-wl.logmsg(n2m.heads_dict, wl.ACCEPT, owner)
-if not args.test:
- n2m.sendarticle()
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 8bfd5a1..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-[egg_info]
-tag_build =
-tag_date = 0
-
diff --git a/src/pygm2n b/src/pygm2n
deleted file mode 100755
index 3629857..0000000
--- a/src/pygm2n
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-"""News to mail gateway script. Copyright 2000 Cosimo Alfarano
-
-Author: Cosimo Alfarano
-Date: June 11 2000
-
-pygs - Copyright 2000 by Cosimo Alfarano <Alfarano@Students.CS.UniBo.It>
-You can use this software under the terms of the GPL. If we meet some day,
-and you think this stuff is worth it, you can buy me a beer in return.
-
-Thanks to md for this useful formula. Beer is beer.
-
-Gets news article and sends it via SMTP.
-"""
-from __future__ import print_function
-
-import argparse
-import logging
-import mail2news
-import nntplib
-import sys
-
-# logging.basicConfig(level=logging.DEBUG)
-
-def parse_cmdline():
- parser = argparse.ArgumentParser(
- description='%s version %s - Copyright 2000 Cosimo Alfarano\n%s' %
- ('pyg', mail2news.VERSION, mail2news.DESC))
-
- parser.add_argument('-s', '--newsserver', default='')
- parser.add_argument('-a', '--approver', default='',
- help="address of moderator/approver")
- parser.add_argument('-n', '--newsgroup', default='',
- help='newsgroup[s] (specified as comma separated ' +
- 'without spaces list)', required=True)
- parser.add_argument('-u', '--user', default='',
- help='NNTP server user (for authentication)')
- parser.add_argument('-p', '--password', default='',
- help='NNTP server password (for authentication)')
- parser.add_argument('-P', '--port', default='')
- parser.add_argument('-e', '--envellope', default='')
- parser.add_argument('-l', '--logfile')
-
- parser.add_argument('-T', '--test', action='store_true',
- help='test mode (not send article via NNTP)')
- parser.add_argument('-v', '--verbose', action='store_true',
- help='verbose output ' +
- '(usefull with -T option for debugging)')
-
- args = parser.parse_args()
-
- if not args.newsgroup:
- raise argparse.ArgumentError('Error: Missing Newsgroups\n')
-
- return args
-
-
-"""main is structured in 4 phases:
- 1) check and set pyg's internal variables
- 2) check whitelist for users' permission
- 3) format rfc 822 headers from input article
- 4) open smtp connection and send e-mail
-"""
-
-
-try:
-
- """phase 1:
- check and set pyg's internal variables
- """
- opt = parse_cmdline()
-
- m2n = mail2news.mail2news(opt)
- owner = None
-
- """phase 3:
- format rfc 822 headers from input article
- """
- m2n.renameheads() # rename useless heads
- m2n.removeheads() # remove other heads
-
- m2n.sortheads() # sort remaining heads :)
-
- if opt.verbose:
- print(m2n.message.as_string())
-
- logging.debug('m2n.payload = len %d', len(m2n.message.get_payload()))
- if len(m2n.message.get_payload()) > 0:
-# wl.logmsg(m2n.heads_dict,wl.ACCEPT,owner)
- if not opt.test:
- try:
- resp = m2n.sendemail()
- except nntplib.NNTPError as ex:
- print(ex)
-
-except KeyboardInterrupt:
- print('Keyboard Interrupt')
- sys.exit(0)
diff --git a/src/pygn2m b/src/pygn2m
deleted file mode 100755
index a2c07cb..0000000
--- a/src/pygn2m
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-"""News to mail gateway script. Copyright 2000 Cosimo Alfarano
-
-Author: Cosimo Alfarano
-Date: June 11 2000
-
-pygs - Copyright 2000 by Cosimo Alfarano <Alfarano@Students.CS.UniBo.It>
-You can use this software under the terms of the GPL. If we meet some day,
-and you think this stuff is worth it, you can buy me a beer in return.
-
-Thanks to md for this useful formula. Beer is beer.
-
-Gets news article from stdin and sends it via SMTP.
-"""
-from __future__ import print_function
-
-import argparse
-from mail2news import VERSION, DESC
-import news2mail
-import os
-import sys
-import whitelist
-
-
-def parse_cmdline():
- """
- set a dictionary with smtp new header in gw parameter (gw.smtpheads)
- return (test,verbose) boolean tuple
- """
- parser = argparse.ArgumentParser(
- description='pyg version %s - Copyright 2000 Cosimo Alfarano\n%s' %
- (VERSION, DESC))
-
- parser.add_argument('-H', '--smtpserver', default='')
- parser.add_argument('-s', '--sender', required=True, default='')
- parser.add_argument('-e', '--envelope', default='')
- parser.add_argument('-t', '--to', dest='rcpt', required=True)
- parser.add_argument('-w', '--wlfile')
- parser.add_argument('-l', '--logfile')
-
- parser.add_argument('-T', '--test',
- help='test mode (not send article via SMTP)',
- action='store_true')
- parser.add_argument('-v', '--verbose', help='verbose output',
- action='store_true')
-
- opts = parser.parse_args()
-
-# By rfc822 [Resent-]Sender: should be ever set, unless == From:
-# (not this case). Should be a human, while [Resent-]From: may be a program.
-
- if opts.rcpt == '' or opts.sender == '':
- raise argparse.ArgumentError('missing command line option')
-
- if opts.envelope == '' and opts.sender != '':
- opts.envelope = opts.sender
-
- return opts
-
-
-"""main is structured in 4 phases:
- 1) check and set pyg's internal variables
- 2) check whitelist for users' permission
- 3) format rfc 822 headers from input article
- 4) open smtp connection and send e-mail
-"""
-
-"""phase 1:
-check and set pyg's internal variables
-"""
-
-# it returns only test, other parms are set directly in the actual
-# parameter
-args = parse_cmdline()
-
-n2m = news2mail.news2mail(verbose=args.verbose)
-owner = None
-
-# check if n2m has some file prefercences set on commandline
-if args.wlfile is None:
- wl = os.path.expanduser(os.path.join(os.path.dirname(__file__), 'pyg.whitelist'))
-else:
- wl = args.wlfile
-
-if args.logfile is None:
- log = os.path.expanduser(os.path.join(os.path.dirname(__file__), 'pyg.log'))
-else:
- log = args.logfile
-
-wl = whitelist.whitelist(wl, log)
-
-"""phase 2:
-check whitelist for user's permission
-"""
-
-# make a first check of From: address
-owner = wl.checkfrom(n2m.message['From'])
-if owner is None:
- if sys.stdin.isatty() == 1 or args.test:
- print ('"%s" is not in whitelist!' % (n2m.message['From'][:-1]))
- else:
- wl.logmsg(n2m.nntpheads, wl.DENY)
-
- # if verbose, I want to print out headers, so I can't
- # exit now.
- if not args.verbose:
- sys.exit(1)
-
-# Reformat the message
-n2m.process_message()
-
-# prints formatted email message only (without send) if user wants
-if args.verbose:
- print(n2m.message.as_string())
-
-if owner is None:
- sys.exit(1)
-
-"""phase 4:
-open smtp connection and send e-mail
-"""
-
-wl.logmsg(n2m.heads_dict, wl.ACCEPT, owner)
-if not args.test:
- n2m.sendarticle()