From eac81455a90c7313c7176e8a349cc28c7f1fb61b Mon Sep 17 00:00:00 2001 From: Joe Testa Date: Wed, 4 Sep 2019 15:05:07 -0400 Subject: [PATCH] Added PyPI package support. --- pypi/MANIFEST.in | 1 + pypi/Makefile | 14 ++++++++++++++ pypi/setup.py | 38 ++++++++++++++++++++++++++++++++++++++ pypi/sshaudit/__init__.py | 0 pypi/sshaudit/__main__.py | 4 ++++ ssh-audit.py | 6 +++++- 6 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 pypi/MANIFEST.in create mode 100644 pypi/Makefile create mode 100644 pypi/setup.py create mode 100644 pypi/sshaudit/__init__.py create mode 100644 pypi/sshaudit/__main__.py diff --git a/pypi/MANIFEST.in b/pypi/MANIFEST.in new file mode 100644 index 0000000..90fc18d --- /dev/null +++ b/pypi/MANIFEST.in @@ -0,0 +1 @@ +include sshaudit/LICENSE diff --git a/pypi/Makefile b/pypi/Makefile new file mode 100644 index 0000000..804b804 --- /dev/null +++ b/pypi/Makefile @@ -0,0 +1,14 @@ +all: + cp ../ssh-audit.py sshaudit/sshaudit.py + cp ../LICENSE sshaudit/LICENSE + cp ../README.md sshaudit/README.md + python3 setup.py sdist bdist_wheel + +uploadtest: + twine upload --repository-url https://test.pypi.org/legacy/ dist/* + +uploadprod: + twine upload dist/* + +clean: + rm -rf build/ dist/ *.egg-info/ sshaudit/sshaudit.py sshaudit/LICENSE sshaudit/README.md diff --git a/pypi/setup.py b/pypi/setup.py new file mode 100644 index 0000000..e9c4c8d --- /dev/null +++ b/pypi/setup.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + + +import re +from setuptools import setup + + +version = re.search('^VERSION\s*=\s*\'v(\d\.\d\.\d)\'', open('sshaudit/sshaudit.py').read(), re.M).group(1) +print("\n\nPackaging ssh-audit v%s...\n\n" % version) + +with open("sshaudit/README.md", "rb") as f: + long_descr = f.read().decode("utf-8") + + +setup( + name = "ssh-audit", + packages = ["sshaudit"], + license = 'MIT', + entry_points = { + "console_scripts": ['ssh-audit = sshaudit.sshaudit:main'] + }, + version = version, + description = "An SSH server configuration security auditing tool", + long_description = long_descr, + long_description_content_type = "text/markdown", + author = "Joe Testa", + author_email = "jtesta@positronsecurity.com", + url = "https://github.com/jtesta/ssh-audit", + classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Information Technology", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Topic :: Security", + "Topic :: Security :: Cryptography" + ]) diff --git a/pypi/sshaudit/__init__.py b/pypi/sshaudit/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pypi/sshaudit/__main__.py b/pypi/sshaudit/__main__.py new file mode 100644 index 0000000..514349d --- /dev/null +++ b/pypi/sshaudit/__main__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +from .sshaudit import main +main() diff --git a/ssh-audit.py b/ssh-audit.py index 8fa3955..c84a865 100755 --- a/ssh-audit.py +++ b/ssh-audit.py @@ -3012,6 +3012,10 @@ def audit(aconf, sshv=None): utils = Utils() out = Output() -if __name__ == '__main__': # pragma: nocover + +def main(): conf = AuditConf.from_cmdline(sys.argv[1:], usage) audit(conf) + +if __name__ == '__main__': # pragma: nocover + main()