def create_get_pkg(handler, pkg_name, pkg_opts): try: p = handler.get('package', name=pkg_name)[0] m = 'Found package {}, skipped creation'.format except: p = handler.create_package(name=pkg_name, **pkg_opts) m = 'Created package {}'.format print m(pkg_name) return p if __name__ == "__main__": console = HistoryConsole() utils.version_check(__version__) parent_parser = utils.setup_parser(__doc__) parser = utils.CustomArgParse( description=__doc__, parents=[parent_parser], ) args = parser.parse_args() all_args = args.__dict__ if not args.username: username = raw_input('Tanium Username: '******'username'] = username.strip() if not args.password: password = getpass.getpass('Tanium Password: '******'password'] = password.strip() if not args.host:
def process_handler_args(parser, all_args): handler_grp_names = ["Handler Authentication", "Handler Options"] handler_opts = utils.get_grp_opts(parser, handler_grp_names) handler_args = {k: all_args.pop(k) for k in handler_opts} h = pytan.Handler(**handler_args) print str(h) return h if __name__ == "__main__": utils.version_check(__version__) parser = utils.setup_parser(__doc__, True) arggroup = parser.add_argument_group("Create Package Options") arggroup.add_argument( "-n", "--name", required=True, action="store", dest="name", default=None, help="Name of package to create" ) arggroup.add_argument( "-c", "--command", required=True, action="store", dest="command", default="", help="Command to execute with package", )
def process_handler_args(parser, all_args): my_args = dict(all_args) handler_grp_names = ['Handler Authentication', 'Handler Options'] handler_opts = utils.get_grp_opts(parser, handler_grp_names) handler_args = {k: my_args.pop(k) for k in handler_opts} # handler_args['session_lib'] = 'httplib' try: h = pytan.Handler(**handler_args) print str(h) except Exception: traceback.print_exc() sys.exit(99) return h parent_parser = utils.setup_parser(__doc__) parser = utils.CustomArgParse( description=__doc__, parents=[parent_parser], ) args = parser.parse_args() all_args = args.__dict__ if not args.username: username = raw_input('Tanium Username: '******'username'] = username.strip() if not args.password: password = getpass.getpass('Tanium Password: '******'password'] = password.strip() if not args.host: