Skip to content

Commit

Permalink
rename --pastebin alias -p to -P; add --product alias -p #48
Browse files Browse the repository at this point in the history
  • Loading branch information
ryran committed Nov 22, 2016
1 parent e0c9072 commit 8e39523
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 42 deletions.
47 changes: 24 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,19 @@ sys 0m0.055s

```
$ rhsecapi -h
usage: rhsecapi [--q-before YEAR-MM-DD] [--q-after YEAR-MM-DD] [--q-bug BZID]
usage: rhsecapi [--q-before YYYY-MM-DD] [--q-after YYYY-MM-DD] [--q-bug BZID]
[--q-advisory RHSA] [--q-severity IMPACT] [--q-package PKG]
[--q-cwe CWEID] [--q-cvss SCORE] [--q-cvss3 SCORE] [--q-empty]
[--q-pagesize PAGESZ] [--q-pagenum PAGENUM] [--q-raw RAWQUERY]
[--q-iava IAVA] [-s] [-0] [-f FIELDS | -a | -m]
[--product PRODUCT] [-j] [-u] [-w [WIDTH]] [-c]
[-l {debug,info,notice,warning}] [-t THREDS] [-p] [--dryrun]
[-E [DAYS]] [-h] [--help]
[CVE [CVE ...]]
[--q-iava IAVA] [-s] [-0] [-f FIELDS | -a | -m] [-p PRODUCT]
[-j] [-u] [-w [WIDTH]] [-c] [-l {debug,info,notice,warning}]
[-t THREDS] [-P] [-E [DAYS]] [--dryrun] [-h] [--help]
[CVE-YYYY-NNNN [CVE-YYYY-NNNN ...]]
Run rhsecapi --help for full help page
VERSION:
rhsecapi v1.0.0_rc2 last mod 2016/18/10
rhsecapi v1.0.0_rc5 last mod 2016/11/22
See <http://github.com/ryran/rhsecapi> to report bugs or RFEs
```

Expand Down Expand Up @@ -600,24 +599,23 @@ CVE-2016-4979
## Full help page

```
usage: rhsecapi [--q-before YEAR-MM-DD] [--q-after YEAR-MM-DD] [--q-bug BZID]
usage: rhsecapi [--q-before YYYY-MM-DD] [--q-after YYYY-MM-DD] [--q-bug BZID]
[--q-advisory RHSA] [--q-severity IMPACT] [--q-package PKG]
[--q-cwe CWEID] [--q-cvss SCORE] [--q-cvss3 SCORE] [--q-empty]
[--q-pagesize PAGESZ] [--q-pagenum PAGENUM] [--q-raw RAWQUERY]
[--q-iava IAVA] [-s] [-0] [-f FIELDS | -a | -m]
[--product PRODUCT] [-j] [-u] [-w [WIDTH]] [-c]
[-l {debug,info,notice,warning}] [-t THREDS] [-p] [--dryrun]
[-E [DAYS]] [-h] [--help]
[CVE [CVE ...]]
[--q-iava IAVA] [-s] [-0] [-f FIELDS | -a | -m] [-p PRODUCT]
[-j] [-u] [-w [WIDTH]] [-c] [-l {debug,info,notice,warning}]
[-t THREDS] [-P] [-E [DAYS]] [--dryrun] [-h] [--help]
[CVE-YYYY-NNNN [CVE-YYYY-NNNN ...]]
Make queries against the Red Hat Security Data API
Original announcement: https://access.redhat.com/blogs/766093/posts/2387601
Docs: https://access.redhat.com/documentation/en/red-hat-security-data-api/
FIND CVES BY ATTRIBUTE:
--q-before YEAR-MM-DD
--q-before YYYY-MM-DD
Narrow down results to before a certain time period
--q-after YEAR-MM-DD Narrow down results to after a certain time period
--q-after YYYY-MM-DD Narrow down results to after a certain time period
--q-bug BZID Narrow down results by Bugzilla ID (specify one or
more, e.g.: '1326598,1084875')
--q-advisory RHSA Narrow down results by errata advisory (specify one or
Expand Down Expand Up @@ -651,8 +649,10 @@ FIND CVES BY IAVA:
above search parameters
QUERY SPECIFIC CVES:
CVE Retrieve a CVE or space-separated list of CVEs (e.g.:
'CVE-2016-5387')
CVE-YYYY-NNNN Retrieve a CVE or list of CVEs (e.g.:
'CVE-2016-5387'); note that case-insensitive regex-
matching is done -- extra characters & duplicate CVEs
will be discarded
-s, --extract-search Extract CVEs them from search query (as initiated by
at least one of the --q-xxx options)
-0, --extract-stdin Extract CVEs from stdin (CVEs will be matched by case-
Expand Down Expand Up @@ -683,7 +683,8 @@ CVE DISPLAY OPTIONS:
-m, --most-fields Display all fields mentioned above except the heavy-
text ones -- (excludes: acknowledgement, details,
statement, mitigation, references)
--product PRODUCT Spotlight a particular PRODUCT via case-insensitive
-p, --product PRODUCT
Spotlight a particular PRODUCT via case-insensitive
regex; this hides CVEs where 'FIXED_RELEASES' or
'FIX_STATES' don't have an item with 'cpe' (e.g.
'cpe:/o:redhat:enterprise_linux:7') or 'product_name'
Expand All @@ -708,20 +709,20 @@ GENERAL OPTIONS:
stderr
-t, --threads THREDS Set number of concurrent worker threads to allow when
making CVE queries (default on this system: 8)
-p, --pastebin Send output to Fedora Project Pastebin
-P, --pastebin Send output to Fedora Project Pastebin
(paste.fedoraproject.org) and print only URL to stdout
--dryrun Skip CVE retrieval; this option only makes sense in
concert with --extract-stdin, for the purpose of
quickly getting a printable list of CVE ids from stdin
-E, --pexpire [DAYS] Set time in days after which paste will be deleted
(defaults to '28'; specify '0' to disable expiration;
DAYS defaults to '1' if option is used but DAYS is
omitted)
--dryrun Skip CVE retrieval; this option only makes sense in
concert with --extract-stdin, for the purpose of
quickly getting a printable list of CVE ids from stdin
-h Show short usage summary and exit
--help Show this help message and exit
VERSION:
rhsecapi v1.0.0_rc2 last mod 2016/18/10
rhsecapi v1.0.0_rc5 last mod 2016/11/22
See <http://github.com/ryran/rhsecapi> to report bugs or RFEs
```

Expand Down
26 changes: 7 additions & 19 deletions rhsecapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
# Globals
prog = 'rhsecapi'
vers = {}
vers['version'] = '1.0.0_rc4'
vers['date'] = '2016/11/20'
vers['version'] = '1.0.0_rc5'
vers['date'] = '2016/11/22'


# Logging
Expand Down Expand Up @@ -226,7 +226,7 @@ def parse_args():
const='MOST',
help="Display all fields mentioned above except the heavy-text ones -- (excludes: {0})".format(", ".join(rhsda.cveFields.not_most)))
g_cveDisplay.add_argument(
'--product',
'-p', '--product',
help="Spotlight a particular PRODUCT via case-insensitive regex; this hides CVEs where 'FIXED_RELEASES' or 'FIX_STATES' don't have an item with 'cpe' (e.g. 'cpe:/o:redhat:enterprise_linux:7') or 'product_name' (e.g. 'Red Hat Enterprise Linux 7') matching PRODUCT; this also hides all items in 'FIXED_RELEASES' & 'FIX_STATES' that don't match PRODUCT")
g_cveDisplay.add_argument(
'-j', '--json', action='store_true',
Expand All @@ -250,26 +250,14 @@ def parse_args():
'-t', '--threads', metavar="THREDS", type=int, default=rhsda.numThreadsDefault,
help="Set number of concurrent worker threads to allow when making CVE queries (default on this system: {0})".format(rhsda.numThreadsDefault))
g_general.add_argument(
'-p', '--pastebin', action='store_true',
'-P', '--pastebin', action='store_true',
help="Send output to Fedora Project Pastebin (paste.fedoraproject.org) and print only URL to stdout")
g_general.add_argument(
'--dryrun', action='store_true',
help="Skip CVE retrieval; this option only makes sense in concert with --extract-stdin, for the purpose of quickly getting a printable list of CVE ids from stdin")
# g_general.add_argument(
# '-A', '--p-author', metavar="NAME", default=prog,
# help="Set alphanumeric paste author (default: '{0}')".format(prog))
# g_general.add_argument(
# '--p-password', metavar="PASSWD",
# help="Set password string to protect paste")
# g_general.add_argument(
# '--p-public', dest='p_private', default='yes', action='store_const', const='no',
# help="Set paste to be publicly-discoverable")
g_general.add_argument(
'-E', '--pexpire', metavar="DAYS", nargs='?', const=1, default=28, type=int,
help="Set time in days after which paste will be deleted (defaults to '28'; specify '0' to disable expiration; DAYS defaults to '1' if option is used but DAYS is omitted)")
# g_general.add_argument(
# '--p-project', metavar="PROJECT",
# help="Associate paste with a project")
g_general.add_argument(
'--dryrun', action='store_true',
help="Skip CVE retrieval; this option only makes sense in concert with --extract-stdin, for the purpose of quickly getting a printable list of CVE ids from stdin")
g_general.add_argument(
'-h', dest='showUsage', action='store_true',
help="Show short usage summary and exit")
Expand Down

0 comments on commit 8e39523

Please sign in to comment.