argparse-一个python参数解析模块

by Netfairy - 2017-07-16
import argparse

if __name__ == '__main__':
    arg = argparse.ArgumentParser()
    arg.add_argument('target', action = 'store', help = 'target host to attack')
    arg.add_argument('username', action = 'store', help = 'username to be used to authenticate against target')
    arg.add_argument('password', action = 'store', help = "username's password")
    args = arg.parse_args()
    print args.target