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() 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',
def log_init(self, url): log.ThugLogging = ThugLogging(thug.__version__) log.ThugLogging.set_basedir(url)
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.ThugOpts = ThugOpts() log.HTTPSession = HTTPSession() log.URLClassifier = URLClassifier() log.SampleClassifier = SampleClassifier() log.ThugLogging = ThugLogging() @patch('os.kill') class TestWatchDog: def callback(self, signum, frame): log.warning("Signal no. is {}".format(signum)) def test_watch(self, os_kill): with Watchdog(0, callback=self.callback): time.sleep(1) assert not os_kill.called def test_abort(self, os_kill, caplog): caplog.clear() with Watchdog(1, callback=self.callback):
def log_init(self, url): log.ThugLogging = ThugLogging() log.ThugLogging.set_basedir(url)
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() 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, "test_files/sample.jar") sample = { 'sha1': 'b13d13733c4c9406fd0e01485bc4a34170b7d326', 'ssdeep': u'24:9EGtDqSyDVHNkCq4LOmvmuS+MfTAPxokCOB:97tG5DjQ4LDs+sTAPxLT', 'sha256': '459bf0aeda19633c8e757c05ee06b8121a51217cea69ce60819bb34092a296a0', 'type': 'JAR',