Skip to content

Commit

Permalink
Merge pull request #79 from michaelweiser/python3
Browse files Browse the repository at this point in the history
Python3
  • Loading branch information
michaelweiser authored Apr 25, 2019
2 parents 911ebe0 + 88a7177 commit cb54cc4
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 28 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ For news and announcements follow us on twitter [@peekabooAV](https://twitter.co

### Prerequisites ####

* [Python 2.7](https://www.python.org/downloads/)
* [Python](https://www.python.org/downloads/) (3.6+ recommended, 2.7 still supported)
* [Cuckoo 2.0](https://github.com/cuckoosandbox/cuckoo)
* [AMaViSd 2.11.0](https://www.ijs.si/software/amavisd/)
* Installer is available: [PeekabooAV-Installer](https://github.com/scVENUS/PeekabooAV-Installer)
Expand All @@ -38,7 +38,7 @@ git clone https://github.com/scVENUS/PeekabooAV.git

Start a new virtualenv
```shell
virtualenv --python2 /path/to/venv
virtualenv /path/to/venv
```

Install PeekabooAV
Expand Down
6 changes: 3 additions & 3 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Create a new python virtual environment and install cuckoo into it using pip:

.. code-block:: shell
$ sudo virtualenv --python=/usr/bin/python2.7 /opt/cuckoo
$ sudo virtualenv /opt/cuckoo
$ sudo /opt/cuckoo/bin/pip install cuckoo
In order to test your new Cuckoo installation you should run it once:
Expand All @@ -97,7 +97,7 @@ A released version of Peekaboo can be installed directly via pip as follows:

.. code-block:: shell
$ sudo virtualenv --python=/usr/bin/python2.7 /opt/peekaboo
$ sudo virtualenv /opt/peekaboo
$ sudo /opt/peekaboo/bin/pip install peekabooav
Peekaboo can also be installed from the source directory which is useful in
Expand Down Expand Up @@ -126,7 +126,7 @@ together with all its dependencies into it:

.. code-block:: shell
$ sudo virtualenv --python=/usr/bin/python2.7 /opt/peekaboo
$ sudo virtualenv /opt/peekaboo
$ sudo /opt/peekaboo/bin/pip install .
**Note**: If you want to install Peekaboo for your system wide Python, leave
Expand Down
2 changes: 1 addition & 1 deletion peekaboo.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#group : peekaboo
#socket_file : /var/run/peekaboo/peekaboo.sock
#pid_file : /var/run/peekaboo/peekaboo.pid
#interpreter : /usr/bin/python -u
#interpreter : /usr/bin/python2 -u
#worker_count : 3
#sample_base_dir : /tmp
#job_hash_regex : /amavis/tmp/([^/]+)/parts/
Expand Down
2 changes: 1 addition & 1 deletion peekaboo/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self, config_file=None, log_level=None):
self.log_level = logging.INFO
self.log_format = '%(asctime)s - %(name)s - (%(threadName)s) - ' \
'%(levelname)s - %(message)s'
self.interpreter = '/usr/bin/python -u'
self.interpreter = '/usr/bin/python2 -u'
self.worker_count = 3
self.sample_base_dir = '/tmp'
self.job_hash_regex = '/amavis/tmp/([^/]+)/parts/'
Expand Down
36 changes: 17 additions & 19 deletions peekaboo/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,22 +421,23 @@ def drop(self):
def _db_schema_exists(self):
if not self.__engine.dialect.has_table(self.__engine, '_meta'):
return False
else:
session = self.__session()
# get the first of potentially multiple metadata entries ordered by
# descending schema version to get the newest currently configured
# schema
meta = session.query(PeekabooMetadata).order_by(
PeekabooMetadata.db_schema_version.desc()).first()
if not meta:
return False

schema_version = meta.db_schema_version
session.close()
if schema_version < DB_SCHEMA_VERSION:
logger.info('Adding new database schema.')
return False
return True

session = self.__session()
# get the first of potentially multiple metadata entries ordered by
# descending schema version to get the newest currently configured
# schema
meta = session.query(PeekabooMetadata).order_by(
PeekabooMetadata.db_schema_version.desc()).first()
if not meta:
return False

schema_version = meta.db_schema_version
session.close()
if schema_version < DB_SCHEMA_VERSION:
logger.info('Adding new database schema.')
return False

return True

def _init_db(self):
"""
Expand All @@ -459,6 +460,3 @@ def _init_db(self):
'Cannot initialize the database: %s' % error)
finally:
session.close()

def __del__(self):
self.__engine.dispose()
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sqlalchemy>=1.1.0
Twisted>=17.1.0
service_identity>=16.0.0
python-magic>=0.4.12
oletools>=0.51
oletools>=0.54
sdnotify>=0.3.1
enum34>=1.0.4
yara-python>=3.6.3
Expand Down
2 changes: 1 addition & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_1_default_settings(self):
self.config.sock_file, '/var/run/peekaboo/peekaboo.sock')
self.assertEqual(
self.config.pid_file, '/var/run/peekaboo/peekaboo.pid')
self.assertEqual(self.config.interpreter, '/usr/bin/python -u')
self.assertEqual(self.config.interpreter, '/usr/bin/python2 -u')
self.assertEqual(self.config.worker_count, 3)
self.assertEqual(self.config.sample_base_dir, '/tmp')
self.assertEqual(
Expand Down

0 comments on commit cb54cc4

Please # to comment.