Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make core and trails installable #6298

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
from core.settings import WHITELIST_RANGES
from core.settings import WORST_ASNS
from core.trailsdict import TrailsDict
from thirdparty import six
from thirdparty.six.moves import urllib as _urllib
import six
from six.moves import urllib as _urllib

_ipcat_cache = {}

Expand Down Expand Up @@ -287,4 +287,4 @@ def get_ex_message(ex):
retval = candidate
break

return retval
return retval
2 changes: 1 addition & 1 deletion core/datatype.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

from thirdparty.odict import OrderedDict
from odict import OrderedDict

# Reference: https://www.kunxi.org/2014/05/lru-cache-in-python
class LRUDict(object):
Expand Down
2 changes: 1 addition & 1 deletion core/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import sys

from thirdparty import six
import six

class _(type):
def __getattr__(self, attr):
Expand Down
10 changes: 5 additions & 5 deletions core/httpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
from core.settings import UNAUTHORIZED_SLEEP_TIME
from core.settings import UNICODE_ENCODING
from core.settings import VERSION
from thirdparty import six
from thirdparty.six.moves import BaseHTTPServer as _BaseHTTPServer
from thirdparty.six.moves import http_client as _http_client
from thirdparty.six.moves import socketserver as _socketserver
from thirdparty.six.moves import urllib as _urllib
import six
from six.moves import BaseHTTPServer as _BaseHTTPServer
from six.moves import http_client as _http_client
from six.moves import socketserver as _socketserver
from six.moves import urllib as _urllib

try:
# Reference: https://bugs.python.org/issue7980
Expand Down
2 changes: 1 addition & 1 deletion core/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from core.settings import UNICODE_ENCODING
from core.settings import VERSION
from core.ignore import ignore_event
from thirdparty.six.moves import socketserver as _socketserver
from six.moves import socketserver as _socketserver

_condensed_events = {}
_condensing_thread = None
Expand Down
2 changes: 1 addition & 1 deletion core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from core.addr import make_mask
from core.attribdict import AttribDict
from core.trailsdict import TrailsDict
from thirdparty.six.moves import urllib as _urllib
from six.moves import urllib as _urllib

NAME = "Maltrail"
VERSION = "0.16.232"
Expand Down
4 changes: 2 additions & 2 deletions core/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
from core.settings import ROOT_DIR
from core.settings import UNICODE_ENCODING
from core.settings import USERS_DIR
from thirdparty import six
from thirdparty.six.moves import urllib as _urllib
import six
from six.moves import urllib as _urllib

# patch for self-signed certificates (e.g. CUSTOM_TRAILS_URL)
try:
Expand Down
5 changes: 5 additions & 0 deletions sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

sys.dont_write_bytecode = True

import os
base = os.path.dirname(__file__)
thirdparty = os.path.join(base, 'thirdparty')
sys.path.append(thirdparty)

import core.versioncheck

import cProfile
Expand Down
5 changes: 5 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

sys.dont_write_bytecode = True

import os
base = os.path.dirname(__file__)
thirdparty = os.path.join(base, 'thirdparty')
sys.path.append(thirdparty)

import core.versioncheck

import optparse
Expand Down
40 changes: 40 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from os.path import join, dirname
from setuptools import setup, find_packages

script_dirname = join(dirname(__file__))

__version__ = '0.16'


def read(readme):
return open(join(script_dirname, readme), "rb").read().decode("utf-8")


setup(
name='maltrail',
version=__version__,
packages=['trails', 'maltrail'],
package_dir={
'trails': 'trails',
'maltrail': 'core',
},
include_package_data=True,
url='https://github.com/stamparm/maltrail',
license='MIT',
author='Miroslav Stampar',
author_email='[email protected]',
description='Malicious traffic detection system',
long_description=read('README.md'),
long_description_content_type='text/x-markdown',
classifiers=[
"Development Status :: 4 - Beta",
"Topic :: Software Development :: Libraries :: Python Modules",
],
install_requires=[
'odict',
# pcapy needed for sensor.py, not yet included by setup.py
'six',
],
)
2 changes: 1 addition & 1 deletion trails/custom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from core.settings import config
from core.settings import ROOT_DIR
from core.settings import UNICODE_ENCODING
from thirdparty import six
import six

__url__ = "(custom)"
__reference__ = "(custom)"
Expand Down
4 changes: 2 additions & 2 deletions trails/feeds/bambenekconsultingdga.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from core.settings import NAME
from core.settings import TIMEOUT
from core.settings import UNICODE_ENCODING
from thirdparty import six
from thirdparty.six.moves import urllib as _urllib
import six
from six.moves import urllib as _urllib

__url__ = "https://osint.bambenekconsulting.com/feeds/dga-feed.txt"
__check__ = "Domain used by"
Expand Down
2 changes: 1 addition & 1 deletion trails/static/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import re

from core.settings import UNICODE_ENCODING
from thirdparty import six
import six

__url__ = "(static)"

Expand Down