Exemplo n.º 1
0
 def __init_core(self):
     log.ThugOpts        = ThugOpts()
     log.ThugVulnModules = ThugVulnModules()
     log.MIMEHandler     = MIMEHandler()
     log.SchemeHandler   = SchemeHandler()
     log.Encoding        = Encoding()
     log.WebTracking     = WebTracking()
Exemplo n.º 2
0
 def __init__(self, configuration_path = thug.__configuration_path__):
     log.configuration_path  = configuration_path
     log.personalities_path  = os.path.join(configuration_path, "personalities") if configuration_path else None
     log.ThugOpts            = ThugOpts()
     log.ThugVulnModules     = ThugVulnModules()
     log.WebTracking         = WebTracking()
     log.MIMEHandler         = MIMEHandler()
     log.SchemeHandler       = SchemeHandler()
     log.JSClassifier        = JSClassifier()
     log.URLClassifier       = URLClassifier()
     log.SampleClassifier    = SampleClassifier()
     log.Encoding            = Encoding()
Exemplo n.º 3
0
from thug.Logging.modules.MongoDB import MongoDB
from thug.ThugAPI.ThugVulnModules import ThugVulnModules
from thug.Logging.ThugLogging import ThugLogging
from thug.Encoding.Encoding import Encoding
from thug.DOM.HTTPSession import HTTPSession

configuration_path = thug.__configuration_path__

log = logging.getLogger("Thug")

log.personalities_path = os.path.join(configuration_path, "personalities") if configuration_path else None
log.ThugOpts           = ThugOpts()
log.configuration_path = configuration_path
log.ThugLogging        = ThugLogging(thug.__version__)
log.ThugVulnModules    = ThugVulnModules()
log.Encoding           = Encoding()
log.HTTPSession        = HTTPSession()


class TestMongoDB:
    cve  = "CVE-XXXX"
    url  = "www.example.com"
    data = b"sample-data"
    desc = "sample-desc"
    cert = "sample-cert"

    file_data = {'sha1': 'b13d13733c4c9406fd0e01485bc4a34170b7d326',
                 'data': data,
                 'ssdeep': u'24:9EGtDqSyDVHNkCq4LOmvmuS+MfTAPxokCOB:97tG5DjQ4LDs+sTAPxLT',
                 'sha256': '459bf0aeda19633c8e757c05ee06b8121a51217cea69ce60819bb34092a296a0',
                 'type': 'JAR',
Exemplo n.º 4
0
# coding=utf-8
import pytest

from thug.Encoding.Encoding import Encoding

encoding = Encoding()


class TestEncoding:
    def test_string(self):
        result = encoding.detect('sample-content')
        assert result['encoding'] in ('ASCII', )

    def test_unicode(self):
        result = encoding.detect(u'sample-content')
        assert result['encoding'] in ('ASCII', )

    def test_utf8_bom(self):
        result = encoding.detect(b'\xEF\xBB\xBF')
        assert result['encoding'] in ('UTF-8-SIG', )

    def test_unicode_utf8(self):
        with pytest.raises(Exception):
            encoding.detect(u'í')