[tor-commits] [torflow/master] Check cmdline arguments

mikeperry at torproject.org mikeperry at torproject.org
Sun Oct 16 05:39:11 UTC 2011


commit b5e88e2785aadbbfe50aae87521a436e8e1a4b32
Author: Sathyanarayanan Gunasekaran <gsathya.ceg at gmail.com>
Date:   Sun Oct 9 18:08:55 2011 +0530

    Check cmdline arguments
    
    Make sure the commandline arguments are correct
    before proceding. If not, show error message and
    correct usage.
---
 NetworkScanners/ExitAuthority/soat.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/NetworkScanners/ExitAuthority/soat.py b/NetworkScanners/ExitAuthority/soat.py
index 7e43edb..2cb2931 100755
--- a/NetworkScanners/ExitAuthority/soat.py
+++ b/NetworkScanners/ExitAuthority/soat.py
@@ -2667,7 +2667,14 @@ def main(argv):
   TorUtil.read_config(data_dir+"/torctl.cfg")
 
   opts = ['ssl','rescan', 'pernode=', 'resume=','http','ssh','smtp','pop','imap','dns','dnsrebind','policies','exit=','target=','loglevel=']
-  flags, trailer = getopt.getopt(argv[1:], [], opts)
+  
+  # make sure the arguments are correct
+  try:
+	flags, trailer = getopt.getopt(argv[1:], [], opts)
+  except getopt.error, msg:
+	print msg
+	usage()
+	return
   
   # get specific test types
   do_resume = False
@@ -2704,7 +2711,6 @@ def main(argv):
         plog("ERROR", "Unknown loglevel: "+flag[1])
         sys.exit(0)
 
-
   plog("DEBUG", "Read tor config. Got Socks proxy: "+str(TorUtil.tor_port))
 
   # Make logs go to disk so resumes are less painful





More information about the tor-commits mailing list