switched to argparse
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@677 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -19,27 +19,27 @@
|
|||||||
# virtualsmartcard. If not, see <http://www.gnu.org/licenses/>.
|
# virtualsmartcard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
from optparse import OptionParser
|
import argparse
|
||||||
parser = OptionParser()
|
parser = argparse.ArgumentParser('Virtual Smart Card')
|
||||||
parser.add_option("-f", "--file", action="store", type="string",
|
parser.add_argument("-f", "--file", action="store", type=str,
|
||||||
default=None,
|
default=None,
|
||||||
help="Load a saved card")
|
help="Load a saved card")
|
||||||
parser.add_option("-n", "--hostname", action="store", type="string",
|
parser.add_argument("-n", "--hostname", action="store", type=str,
|
||||||
default='localhost',
|
default='localhost',
|
||||||
help="Address of Virtual PCD [default: %default]")
|
help="Address of Virtual PCD [default: %default]")
|
||||||
parser.add_option("-p", "--port", action="store", type="int",
|
parser.add_argument("-p", "--port", action="store", type=int,
|
||||||
default=35963,
|
default=35963,
|
||||||
help="Port of Virtual PCD [default: %default]")
|
help="Port of Virtual PCD [default: %default]")
|
||||||
parser.add_option("-r", "--reader", action="store", type="int",
|
parser.add_argument("-r", "--reader", action="store", type=int,
|
||||||
default=None,
|
default=None,
|
||||||
help="Number of reader for relaying")
|
help="Number of reader for relaying")
|
||||||
parser.add_option("-t", "--type", action="store", type="choice",
|
parser.add_argument("-t", "--type", action="store",
|
||||||
default='iso7816',
|
default='iso7816',
|
||||||
choices=['iso7816', 'cryptoflex', 'ePass', 'nPA', 'relay'],
|
choices=['iso7816', 'cryptoflex', 'ePass', 'nPA', 'relay'],
|
||||||
help="Type of Smartcard [default: %default]")
|
help="Type of Smartcard [default: %default]")
|
||||||
(options, args) = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
from virtualsmartcard.VirtualSmartcard import VirtualICC
|
from virtualsmartcard.VirtualSmartcard import VirtualICC
|
||||||
vicc = VirtualICC(options.file, options.type,
|
vicc = VirtualICC(args.file, args.type,
|
||||||
options.hostname, options.port, readernum=options.reader)
|
args.hostname, args.port, readernum=args.reader)
|
||||||
vicc.run()
|
vicc.run()
|
||||||
|
|||||||
Reference in New Issue
Block a user