From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1299449-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 61C50139345 for <garchives@archives.gentoo.org>; Mon, 5 Jul 2021 20:24:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A0093E0A68; Mon, 5 Jul 2021 20:24:19 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 88DB6E0A68 for <gentoo-commits@lists.gentoo.org>; Mon, 5 Jul 2021 20:24:19 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 76667342AAE for <gentoo-commits@lists.gentoo.org>; Mon, 5 Jul 2021 20:24:18 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 11F847C0 for <gentoo-commits@lists.gentoo.org>; Mon, 5 Jul 2021 20:24:17 +0000 (UTC) From: "John Helmert III" <ajak@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "John Helmert III" <ajak@gentoo.org> Message-ID: <1625510318.abe128db3bf0ede3f813de854ccee897941638f1.ajak@gentoo> Subject: [gentoo-commits] proj/security:ajak-cvetool commit in: bin/ X-VCS-Repository: proj/security X-VCS-Files: bin/CVETool.py bin/cvetool bin/cvetool.py X-VCS-Directories: bin/ X-VCS-Committer: ajak X-VCS-Committer-Name: John Helmert III X-VCS-Revision: abe128db3bf0ede3f813de854ccee897941638f1 X-VCS-Branch: ajak-cvetool Date: Mon, 5 Jul 2021 20:24:17 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 74f62d8d-5cda-4bbb-8ad6-af797693f9c5 X-Archives-Hash: 01cd665afd3fed563517414fb15bfd86 commit: abe128db3bf0ede3f813de854ccee897941638f1 Author: John Helmert III <ajak <AT> gentoo <DOT> org> AuthorDate: Mon Jul 5 18:38:38 2021 +0000 Commit: John Helmert III <ajak <AT> gentoo <DOT> org> CommitDate: Mon Jul 5 18:38:38 2021 +0000 URL: https://gitweb.gentoo.org/proj/security.git/commit/?id=abe128db bin/: split CVETool class into own file ...and rename cvetool.py back to cvetool Signed-off-by: John Helmert III <ajak <AT> gentoo.org> bin/{cvetool.py => CVETool.py} | 33 ++------------------------------- bin/cvetool | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/bin/cvetool.py b/bin/CVETool.py old mode 100755 new mode 100644 similarity index 90% rename from bin/cvetool.py rename to bin/CVETool.py index 557c030..c5996f6 --- a/bin/cvetool.py +++ b/bin/CVETool.py @@ -1,12 +1,8 @@ -#!/usr/bin/env python3 -# Copyright 2016 Alex Legler -# Distributed under the terms of the GNU General Public License v3 - import re import sys -import os -from urllib.parse import urlencode + from base64 import b64encode +from urllib.parse import urlencode import requests GLSAMAKER_URI = 'https://glsamaker.gentoo.org' @@ -244,28 +240,3 @@ class CVETool: if jsondata: return response.json() return response.text - - -def main(): - if len(sys.argv) == 1: - CVETool(None, 'usage', sys.argv[2:]) - - auth = None - authpath = os.path.join(os.path.expanduser('~'), '.config', 'cvetool_auth') - if 'CVETOOL_AUTH' in os.environ: - auth = os.environ['CVETOOL_AUTH'] - elif os.path.isfile(authpath): - with open(authpath, 'r') as authfile: - auth = authfile.readlines()[0] - elif 'CVETOOL_AUTH' not in os.environ and not sys.argv[1] == 'pw': - print('CVETOOL_AUTH environment variable missing. Generate its contents with the pw subcommand.') - sys.exit(1) - - CVETool(auth, sys.argv[1], sys.argv[2:]) - - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - print('\n ! Exiting.') diff --git a/bin/cvetool b/bin/cvetool new file mode 100755 index 0000000..7e30837 --- /dev/null +++ b/bin/cvetool @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# Copyright 2016 Alex Legler +# Distributed under the terms of the GNU General Public License v3 + +import os +import re +import sys + +from CVETool import CVETool + +def main(): + if len(sys.argv) == 1: + CVETool(None, 'usage', sys.argv[2:]) + + auth = None + authpath = os.path.join(os.path.expanduser('~'), '.config', 'cvetool_auth') + if 'CVETOOL_AUTH' in os.environ: + auth = os.environ['CVETOOL_AUTH'] + elif os.path.isfile(authpath): + with open(authpath, 'r') as authfile: + auth = authfile.readlines()[0] + elif 'CVETOOL_AUTH' not in os.environ and not sys.argv[1] == 'pw': + print('CVETOOL_AUTH environment variable missing. Generate its contents with the pw subcommand.') + sys.exit(1) + + CVETool(auth, sys.argv[1], sys.argv[2:]) + + +if __name__ == "__main__": + try: + main() + except KeyboardInterrupt: + print('\n ! Exiting.')