tightened up argparse validation
parent
47c75a5902
commit
37f129fe81
|
@ -1,3 +1,7 @@
|
|||
5/2/2016
|
||||
---------
|
||||
-tightened up argparse validation
|
||||
|
||||
4/24/2016
|
||||
---------
|
||||
-Added credentials/get_spn_tickets to request SPN tickets.
|
||||
|
|
28
empire
28
empire
|
@ -1170,22 +1170,30 @@ def start_restful_api(startEmpire=False, suppress=False, username=None, password
|
|||
if __name__ == '__main__':
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--debug', nargs='?', const='1', help='Debug level for output (default of 1).')
|
||||
|
||||
parser.add_argument('-s', '--stager', nargs='?', const="list", help='Specify a stager to generate. Lists all stagers if none is specified.')
|
||||
parser.add_argument('-o', '--stager-options', nargs='*', help="Supply options to set for a stager in OPTION=VALUE format. Lists options if nothing is specified.")
|
||||
parser.add_argument('-l', '--listener', nargs='?', const="list", help='Display listener options. Displays all listeners if nothing is specified.')
|
||||
parser.add_argument('-v', '--version', action='store_true', help='Display current Empire version.')
|
||||
parser.add_argument('--rest', action='store_true', help='Run the Empire RESTful API.')
|
||||
parser.add_argument('--restport', nargs='?', help='Port to run the Empire RESTful API on.')
|
||||
parser.add_argument('--headless', action='store_true', help='Run Empire and the RESTful API headless without the usual interface.')
|
||||
parser.add_argument('--username', nargs='?', help='Start the RESTful API with the specified username instead of pulling from empire.db')
|
||||
parser.add_argument('--password', nargs='?', help='Start the RESTful API with the specified password instead of pulling from empire.db')
|
||||
generalGroup = parser.add_argument_group('General Options')
|
||||
generalGroup.add_argument('--debug', nargs='?', const='1', help='Debug level for output (default of 1, 2 for msg display).')
|
||||
generalGroup.add_argument('-v', '--version', action='store_true', help='Display current Empire version.')
|
||||
|
||||
cliGroup = parser.add_argument_group('CLI Payload Options')
|
||||
cliGroup.add_argument('-l', '--listener', nargs='?', const="list", help='Display listener options. Displays all listeners if nothing is specified.')
|
||||
cliGroup.add_argument('-s', '--stager', nargs='?', const="list", help='Specify a stager to generate. Lists all stagers if none is specified.')
|
||||
cliGroup.add_argument('-o', '--stager-options', nargs='*', help="Supply options to set for a stager in OPTION=VALUE format. Lists options if nothing is specified.")
|
||||
|
||||
restGroup = parser.add_argument_group('RESTful API Options')
|
||||
launchGroup = restGroup.add_mutually_exclusive_group()
|
||||
launchGroup.add_argument('--rest', action='store_true', help='Run the Empire RESTful API.')
|
||||
launchGroup.add_argument('--headless', action='store_true', help='Run Empire and the RESTful API headless without the usual interface.')
|
||||
restGroup.add_argument('--restport', type=int, nargs=1, help='Port to run the Empire RESTful API on.')
|
||||
restGroup.add_argument('--username', nargs=1, help='Start the RESTful API with the specified username instead of pulling from empire.db')
|
||||
restGroup.add_argument('--password', nargs=1, help='Start the RESTful API with the specified password instead of pulling from empire.db')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if not args.restport:
|
||||
args.restport = '1337'
|
||||
else:
|
||||
args.restport = args.restport[0]
|
||||
|
||||
if args.version:
|
||||
print empire.VERSION
|
||||
|
|
Loading…
Reference in New Issue