From cd480394dad66ccdec4d03d92c0931f49f36b55b Mon Sep 17 00:00:00 2001 From: Michel Oosterhof Date: Tue, 11 Sep 2018 12:01:42 +0400 Subject: [PATCH] Setuppy (#876) * setup.py work in progress. should install library now. * add incremental for versioning * Fix 'ls -d' switches (worked wrong way around) and capitalisation in error message. --- MANIFEST.in | 10 +++--- README.md | 1 + setup.py | 64 ++++++++++++++++++++------------------- src/cowrie/__init__.py | 1 + src/cowrie/_version.py | 11 +++++++ src/cowrie/commands/fs.py | 2 +- src/cowrie/commands/ls.py | 2 +- 7 files changed, 53 insertions(+), 38 deletions(-) create mode 100644 src/cowrie/_version.py diff --git a/MANIFEST.in b/MANIFEST.in index e43a2c75..26345fdd 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,6 @@ -include cowrie.cfg.dist include *.md -recursive-include twisted *.py -recursive-include data fs.pickle userdb.txt -graft honeyfs * -graft txtcmds * +include etc/cowrie.cfg.dist +recursive-include src/twisted *.py +recursive-include src/cowrie *.py +graft honeyfs +graft share/cowrie diff --git a/README.md b/README.md index 5566bcc2..4cf303e8 100644 --- a/README.md +++ b/README.md @@ -85,5 +85,6 @@ Many people have contributed to Cowrie over the years. Special thanks to: * Dave Germiquet (davegermiquet) for TFTP support, unit tests, new process handling * Olivier Bilodeau (obilodeau) for Telnet support * Ivan Korolev (fe7ch) for many improvements over the years. +* Florian Pelgrim (craneworks) for his work on code cleanup and Docker. * And many many others. diff --git a/setup.py b/setup.py index 783fc42f..836f5734 100755 --- a/setup.py +++ b/setup.py @@ -10,46 +10,48 @@ setup( maintainer_email="michel@oosterhof.net", keywords="ssh telnet honeypot", url="https://github.com/cowrie/cowrie", - packages=find_packages(), + packages=find_packages('src'), include_package_data=True, + package_dir={'': 'src'}, package_data={'': ['*.md']}, + use_incremental=True, scripts=[ - "bin/fsctl", - "bin/asciinema", - "bin/cowrie", - "bin/createfs", - "bin/playlog" + 'bin/fsctl', + 'bin/asciinema', + 'bin/cowrie', + 'bin/createfs', + 'bin/playlog' + ], + setup_requires=[ + 'incremental', + 'click' ], install_requires=[ - "twisted>=17.1.0", - "cryptography>=0.9.1", - "configparser", - "pyopenssl", - "pyparsing", - "packaging", - "appdirs>=1.4.0", - "python-pyasn1", - "python-gmpy2", - "python-mysqldb", - "klein>=15.0.0", - "treq>=15.0.0", - "python-dateutil", - "service_identity>=14.0.0" + 'twisted>=17.1.0', + 'cryptography>=0.9.1', + 'configparser', + 'pyopenssl', + 'pyparsing', + 'incremental', + 'packaging', + 'appdirs>=1.4.0', + 'python-dateutil', + 'service_identity>=14.0.0' ], entry_points={ - 'console_scripts': ['run-the-app = deployme:main'] + 'console_scripts': ['cowrie = cowrie.scripts.cowrie:run'] }, extras_require={ - 'csirtg': ["csirtgsdk>=0.0.0a17"], - 'dshield': ["requests"], - 'elasticsearch': ["pyes"], - 'mysql': ["mysqlclient"], - 'mongodb': ["pymongo"], - 'rethinkdblog': ["rethinkdb"], - 's3': ["botocore"], - 'slack': ["slackclient"], - 'splunklegacy': ["splunk-sdk"], - 'influxdb': ["influxdb"] + 'csirtg': ['csirtgsdk>=0.0.0a17'], + 'dshield': ['requests'], + 'elasticsearch': ['pyes'], + 'mysql': ['mysqlclient'], + 'mongodb': ['pymongo'], + 'rethinkdblog': ['rethinkdb'], + 's3': ['botocore'], + 'slack': ['slackclient'], + 'splunklegacy': ['splunk-sdk'], + 'influxdb': ['influxdb'] } ) diff --git a/src/cowrie/__init__.py b/src/cowrie/__init__.py index e69de29b..3a8d6d5c 100644 --- a/src/cowrie/__init__.py +++ b/src/cowrie/__init__.py @@ -0,0 +1 @@ +from ._version import __version__ # noqa: F401 diff --git a/src/cowrie/_version.py b/src/cowrie/_version.py new file mode 100644 index 00000000..9e4c586b --- /dev/null +++ b/src/cowrie/_version.py @@ -0,0 +1,11 @@ +""" +Provides cowrie version information. +""" + +# This file is auto-generated! Do not edit! +# Use `python -m incremental.update cowrie` to change this file. + +from incremental import Version + +__version__ = Version('cowrie', 1, 5, 0) +__all__ = ["__version__"] diff --git a/src/cowrie/commands/fs.py b/src/cowrie/commands/fs.py index aacc6924..fdcb43a0 100644 --- a/src/cowrie/commands/fs.py +++ b/src/cowrie/commands/fs.py @@ -499,7 +499,7 @@ class command_touch(HoneyPotCommand): pname = self.fs.resolve_path(f, self.protocol.cwd) if not self.fs.exists(os.path.dirname(pname)): self.errorWrite( - 'touch: cannot touch `{}`: no such file or directory\n'.format(pname)) + 'touch: cannot touch `{}`: No such file or directory\n'.format(pname)) return if self.fs.exists(pname): # FIXME: modify the timestamp here diff --git a/src/cowrie/commands/ls.py b/src/cowrie/commands/ls.py index 9757541d..d3ace36a 100644 --- a/src/cowrie/commands/ls.py +++ b/src/cowrie/commands/ls.py @@ -105,7 +105,7 @@ class command_ls(HoneyPotCommand): def do_ls_l(self, path): try: - if self.protocol.fs.isdir(path) and self.showDirectories: + if self.protocol.fs.isdir(path) and not self.showDirectories: files = self.protocol.fs.get_path(path)[:] if self.showHidden: dot = self.protocol.fs.getfile(path)[:]