How to use the thug.ThugAPI.ThugOpts.ThugOpts function in thug

To help you get started, we’ve selected a few thug examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github buffer / thug / tests / Logging / modules / test_MongoDB.py View on Github external
import mongomock

import thug
from thug.ThugAPI.ThugOpts import ThugOpts
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()
log.PyHooks            = dict()


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

    file_data = {'sha1': 'b13d13733c4c9406fd0e01485bc4a34170b7d326',
github buffer / thug / tests / Logging / test_ThugLogging.py View on Github external
import thug
from thug.ThugAPI.ThugOpts import ThugOpts
from thug.DOM.HTTPSession import HTTPSession
from thug.Logging.ThugLogging import ThugLogging
from thug.Classifier.URLClassifier import URLClassifier
from thug.Classifier.SampleClassifier import SampleClassifier

configuration_path = thug.__configuration_path__

log                    = logging.getLogger("Thug")
log.configuration_path = configuration_path
log.personalities_path = os.path.join(configuration_path, "personalities") if configuration_path else None

log.PyHooks          = dict()
log.ThugOpts         = ThugOpts()
log.HTTPSession      = HTTPSession()
log.URLClassifier    = URLClassifier()
log.SampleClassifier = SampleClassifier()

thug_logging = ThugLogging(thug.__version__)


class TestThugLogging:
    js       = "var i = 0;"
    cert     = "sample-certificate"
    content  = b"sample, content"
    cwd_path = os.path.dirname(os.path.realpath(__file__))
    jar_path = os.path.join(cwd_path, os.pardir, os.pardir, "tests/test_files/sample.jar")
    sample   = {'sha1': 'b13d13733c4c9406fd0e01485bc4a34170b7d326',
                'ssdeep': u'24:9EGtDqSyDVHNkCq4LOmvmuS+MfTAPxokCOB:97tG5DjQ4LDs+sTAPxLT',
                'sha256': '459bf0aeda19633c8e757c05ee06b8121a51217cea69ce60819bb34092a296a0',
github buffer / thug / tests / ThugAPI / test_ThugOpts.py View on Github external
import os
import pytest
import logging

import thug
from thug.ThugAPI.ThugOpts import ThugOpts

configuration_path = thug.__configuration_path__

log                    = logging.getLogger("Thug")
log.configuration_path = configuration_path
log.personalities_path = os.path.join(configuration_path, "personalities") if configuration_path else None


class TestThugOpts:
    opts = ThugOpts()

    def test_verbose(self):
        self.opts.verbose = True
        assert self.opts.verbose

        self.opts.verbose = False
        assert not self.opts.verbose

    def test_debug(self):
        self.opts.debug = True
        assert self.opts.debug

        self.opts.debug = False
        assert not self.opts.debug

    def test_proxy(self):
github buffer / thug / tests / AST / disabled_test_AST.py View on Github external
import os
import logging

import thug
from thug.AST.AST import AST
from thug.ThugAPI.ThugOpts import ThugOpts
from thug.Logging.ThugLogging import ThugLogging

configuration_path     = thug.__configuration_path__
log                    = logging.getLogger("Thug")
log.configuration_path = configuration_path
log.personalities_path = os.path.join(configuration_path, "personalities") if configuration_path else None
log.ThugOpts           = ThugOpts()
log.ThugLogging        = ThugLogging(thug.__version__)


class TestAST(object):
    DEBUG = True

    def debug_info(self, script, ast):
        if not self.DEBUG:
            return

        print(script)
        print(ast.names)
        print(ast.breakpoints)
        print(ast.assignments)

    def testAssign(self):
github buffer / thug / tests / Logging / modules / test_ElasticSearch.py View on Github external
import thug
from thug.Logging.modules.ElasticSearch import ElasticSearch
from thug.ThugAPI.ThugVulnModules import ThugVulnModules
from thug.ThugAPI.ThugOpts import ThugOpts

log = logging.getLogger("Thug")

cwd_path = os.path.dirname(os.path.realpath(__file__))
configuration_path = os.path.join(cwd_path, os.pardir, os.pardir, "test_files")

log.configuration_path = thug.__configuration_path__
log.personalities_path = os.path.join(configuration_path, "personalities") if configuration_path else None

log.ThugVulnModules = ThugVulnModules()
log.ThugOpts = ThugOpts()

log.ThugOpts.useragent = 'winxpie60'

config = ConfigParser.ConfigParser()
conf_file = os.path.join(log.configuration_path, 'thug.conf')
config.read(conf_file)


class TestElasticSearch:
    @elasticmock
    def test_export(self):
        log.ThugOpts.elasticsearch_logging = True
        log.configuration_path = configuration_path
        assert log.ThugOpts.elasticsearch_logging

        with patch('elasticmock.FakeElasticsearch.indices', create=True):
github buffer / thug / tests / DOM / test_SchemeHandler.py View on Github external
import os
import logging

import thug

from thug.DOM.SchemeHandler import SchemeHandler
from thug.Logging.ThugLogging import ThugLogging
from thug.ThugAPI.ThugOpts import ThugOpts

log = logging.getLogger("Thug")

configuration_path = thug.__configuration_path__
log.personalities_path = os.path.join(configuration_path, "personalities") if configuration_path else None
log.configuration_path = thug.__configuration_path__

log.ThugOpts = ThugOpts()
log.PyHooks  = dict()

log.ThugLogging = ThugLogging(thug.__version__)


class TestSchemeHandler(object):
    def test_hcp(self):
        handler = SchemeHandler()

        handler.handle_hcp(None, "test")
        handler.handle_hcp(None, "svr=foo")
        handler.handle_hcp(None, "svr=foo")
        handler.handle_hcp(None, "svr=foo")
github buffer / thug / tests / Analysis / test_VirusTotal.py View on Github external
import os
import logging

from thug.Analysis.virustotal.VirusTotal import VirusTotal
from thug.ThugAPI.ThugOpts import ThugOpts

log = logging.getLogger("Thug")
log.configuration_path = "/etc/thug"
log.personalities_path = "/etc/thug/personalities"
log.ThugOpts = ThugOpts()


class TestVirusTotal(object):
    cwd_path = os.path.dirname(os.path.realpath(__file__))
    samples_path = os.path.join(cwd_path, os.pardir, os.pardir, "tests/test_files")

    pe_path = os.path.join(samples_path, "sample.exe")

    def build_sample(self):
        with open(self.pe_path, "rb") as fd:
            data = fd.read()

        sample = {
            'md5' : '52bfb8491cbf6c39d44d37d3c59ef406'
        }
github buffer / thug / tests / DOM / test_Personality.py View on Github external
import os
import logging

import thug

from thug.DOM.Personality import Personality
from thug.ThugAPI.ThugVulnModules import ThugVulnModules
from thug.ThugAPI.ThugOpts import ThugOpts

log = logging.getLogger("Thug")

configuration_path = thug.__configuration_path__
log.personalities_path = os.path.join(configuration_path, "personalities") if configuration_path else None

log.ThugVulnModules = ThugVulnModules()
log.ThugOpts = ThugOpts()

log.ThugOpts.useragent = 'winxpie60'


class TestPersonality(object):
    def test_personality(self):
        personality = Personality()

        assert 'Windows NT 5.1' in personality.userAgent
        assert 'Mozilla/4.0 (Windows XP 5.1) Java' in personality.javaUserAgent
        assert '6.0' in personality.browserVersion
        assert 'Win32' in personality.platform
        assert personality.browserMajorVersion == 6
        assert '5.6' in personality.cc_on['_jscript_version']
        assert personality.isIE() is True
        assert personality.isEdge() is False
github buffer / thug / thug / ThugAPI / ThugAPI.py View on Github external
def __init_core(self):
        log.ThugOpts        = ThugOpts()
        log.ThugVulnModules = ThugVulnModules()
        log.MIMEHandler     = MIMEHandler()
        log.SchemeHandler   = SchemeHandler()
        log.Encoding        = Encoding()
        log.WebTracking     = WebTracking()
        log.HTMLInspector   = HTMLInspector()