def build_cli_parser():
parser = OptionParser(usage="%prog [options]", description="Parse the command line using a regular expression (includes the options to count matches & leverage reference groups to define output). NOTE: Given that this script parses all command line data stored in Carbon Black, this script can take from several minutes to several hours to run depending upon the size of your Carbon Black ER datastore & the CbER server's hardware. It is reccomended to use output redirection as then you can tail as well as monitor the output file's size to check the status of long running queries.")
# for each supported output type, add an option
parser.add_option("-c", "--cburl", action="store", default=None, dest="url",
help="CB server's URL. e.g., https://127.0.0.1:443")
parser.add_option("-a", "--apitoken", action="store", default=None, dest="token",
help="API Token for Carbon Black server")
parser.add_option("-n", "--no-ssl-verify", action="store_false", default=True, dest="ssl_verify",
help="Do not verify server SSL certificate.")
parser.add_option("-r", "--regex", action="store", default=None, dest="regex",
help="Regular Expression for parsing cmdline")
parser.add_option("-i", "--ignore-case", action="store", default=None, dest="ignore_case",
help="Flag to force regex to ignore character case when matching")
parser.add_option("-G", "--group-reference-to-match", action="store", default=None, dest="group_reference_to_match",
help="User an integer to specify which parenthesized reference group in the regex to match")
parser.add_option("-C", "--count", action="store_true", default=False, dest="count_flag",
help="Count instances of matched regex hits (in some cases, enabling this function may cause this script to run for a long time)")
parser.add_option("-M", "--matches-only", action="store_true", default=False, dest="matches_only_flag",
help="Match MUST begin at the 1st character of the command line string (ASSUME ^ at start of regex)")
return parser
process_cmdline_regex.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录