[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Added command line support for the most basic arguments



Update of /home/minion/cvsroot/src/minion/etc
In directory moria.mit.edu:/tmp/cvs-serv14693

Modified Files:
	minionProxy.py 
Log Message:
Added command line support for the most basic arguments
(But still no checking!!!)



Index: minionProxy.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/etc/minionProxy.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- minionProxy.py	5 Mar 2004 17:42:31 -0000	1.1
+++ minionProxy.py	5 Mar 2004 18:28:56 -0000	1.2
@@ -1,19 +1,89 @@
+"""An SMTP and POP3 server that anonymize all traffic using mixminion
+
+Syntax: python minionProxy.py [-Vh] [-H imap_host] [-P pop3_port] [-S smtp_port] [-L local_host]
+-h, --help          - prints this help message
+-V, --version       - prints the version
+-H, --host          - The remote IMAP host to connect and fetch messages from.
+-P, --pop3port      - The local POP3 port (default is 20110)
+-S, --smtpport      - The local SMTP port (default is 20025)
+-L, --localhost     - The local address servers bind to (default "127.0.0.1")
+
+The minionProxy acts as a local SMTP and POP3 server, and your
+favorite email client can be configured to talk to it. It extracts the
+subject line, the nickname contained in the "from" field, and the body
+of the message and relays them anonymously through the mixminion
+network to all receivers. The nickname is the portion of the "from"
+field that does not contain the email address e.g. for Red Monkey
+<red.monkey@jungle.za> the nickname "Red Monkey" will be
+extracted. This can be set by most email clients. Note that not all
+mixminion exit nodes support custom nicknames.
+
+Each anonymous message sent out has attached a Single Use Reply Block,
+that can be used by your correspondant to reply (once) to your
+message. The email portion of the "from" field is encoded as the
+recipient email address (e.g. "red.monkey@jungle.za" for the example
+above)
+
+(Only) Anonymous messages available on the IMAP server specified are
+automatically decoded and can be downloaded using the simple POP3
+protocol. Note that the username and password you specify (using your
+mail client) for the POP3 server is used in fact to authenticate with
+the IMAP server. If the messages contain single use reply blocks the
+address of the form "xxxxxx@nym.taz" can be used to reply. Otherwise
+it is not possible to reply (and the reply address is
+"anonymous@nym.taz")
+
+You need to have the mixminion program on your path for minionProxy
+to work. Download it at: http://mixminion.net
+For comments and BUGS contact "George.Danezis@cl.cam.ac.uk" """
+
 from IMAPproxy import *
 from minionSMTP import *
 import getpass
 
 import asyncore
 
-imap_address = 'imap.hermes.cam.ac.uk'
-local_host = '127.0.0.1'
-smtp_port = 20025
-imap_port = 20110
+program = sys.argv[0]
+__version__ = 'Mixminion SMTP/POP3 form IMAP proxy - 0.0.1'
 
 if __name__ == '__main__':
     import __main__
+
+    imap_address = None
+    local_host = '127.0.0.1'
+    smtp_port = 20025
+    imap_port = 20110
+    # Parse the command line arguments
+    # -V, --version   - gives the version
+    # -h, --help      - gives some help
+    try:
+        opts, args = getopt.getopt(
+            sys.argv[1:], 'VhHPSL',
+            ['version', 'help','host','pop3port','smtpport','localhost'])
+    except getopt.error, e:
+        print e
+
+        print opts
+    for opt, arg in opts:
+        if opt in ('-H', '--host'):
+            imap_address = arg
+        elif opt in ('-I', '--imapport'):
+            imap_port = int(arg)
+        elif opt in ('-L', '--localhost'):
+            local_host = arg
+        elif opt in ('-S', '--smtlport'):
+            imap_port = int(arg)
+        elif opt in ('-h', '--help'):
+            print __doc__
+            sys.exit(0)
+        elif opt in ('-V', '--version'):
+            print >> sys.stderr, __version__
+            sys.exit(0)
+
     print 'Mixminion password:'
     mm_Pass = getpass.getpass()
-    proxy1 = IMAPproxy((local_host, imap_port),imap_address,mm_Pass)
+    if imap_address != None:
+        proxy1 = IMAPproxy((local_host, imap_port),imap_address,mm_Pass)
     proxy2 = minionSMTP((local_host,smtp_port),mm_Pass)
     
     try: