def do_perform_test(self, caplog, sample, adobe, expected): thug = ThugAPI() thug.set_useragent('win7ie90') thug.set_events('click,storage') thug.disable_cert_logging() thug.set_features_logging() if adobe in ('disable', ): thug.disable_acropdf() else: thug.set_acropdf_pdf(adobe) thug.log_init(sample) thug.run_local(sample) records = [r.message for r in caplog.records] matches = 0 for e in expected: for record in records: if e in record: matches += 1 assert matches >= len(expected)
def do_perform_test(self, caplog, url, expected, type_="remote"): thug = ThugAPI() thug.set_useragent('win7ie90') thug.set_events('click,storage') thug.set_web_tracking() thug.enable_cert_logging() thug.set_features_logging() thug.set_log_verbose() thug.set_ssl_verify() thug.log_init(url) m = getattr(thug, "run_{}".format(type_)) m(url) records = [r.message for r in caplog.records] matches = 0 for e in expected: for record in records: if e in record: matches += 1 assert matches >= len(expected)
def do_perform_test(self, caplog, sample, expected): thug = ThugAPI() thug.set_useragent('win7ie90') thug.set_events('click,storage') thug.set_extensive() thug.disable_cert_logging() thug.set_file_logging() thug.set_json_logging() thug.set_features_logging() thug.set_ssl_verify() thug.set_threshold(3) thug.log_init(sample) thug.run_local(sample) records = [r.message for r in caplog.records] matches = 0 for e in expected: for record in records: if e in record: matches += 1 assert matches >= len(expected)
def do_perform_test(self, caplog, sample, expected, events='', useragent='win7ie90'): thug = ThugAPI() thug.set_useragent(useragent) thug.set_events(events) thug.disable_cert_logging() thug.set_features_logging() thug.log_init(sample) thug.run_local(sample) records = [r.message for r in caplog.records] matches = 0 for e in expected: for record in records: if e in record: matches += 1 assert matches >= len(expected)
def do_perform_test(self, caplog, sample, expected, useragent='osx10safari5'): thug = ThugAPI() thug.set_useragent(useragent) thug.set_events('click,storage') thug.set_connect_timeout(2) thug.disable_cert_logging() thug.set_features_logging() thug.set_ssl_verify() thug.log_init(sample) thug.run_local(sample) records = [r.message for r in caplog.records] matches = 0 for e in expected: for record in records: if e in record: matches += 1 assert matches >= len(expected)
def do_perform_test(self, caplog, sample, shockwave, expected): thug = ThugAPI() thug.set_useragent('win7ie90') thug.set_events('click,storage') thug.disable_cert_logging() thug.set_features_logging() if shockwave in ('disable', ): thug.disable_shockwave_flash() else: thug.set_shockwave_flash(shockwave) thug.log_init(sample) thug.run_local(sample) records = [r.message for r in caplog.records] matches = 0 for e in expected: for record in records: if e in record: matches += 1 assert matches >= len(expected)
def _run(self, context, exploit): sample = os.path.join(MISC, exploit[0]) instance = ThugAPI(None, configuration_path = "/etc/thug") instance.set_events('click') instance.set_timeout(1) instance.log_init(sample) instance.run_local(sample) for assertion in exploit[1].split(","): assert assertion in context.log_capture.getvalue()
def do_perform_test(self, caplog, sample, expected, events = '', useragent = 'win7ie90'): thug = ThugAPI() thug.set_useragent(useragent) thug.set_events(events) thug.disable_cert_logging() thug.set_features_logging() thug.log_init(sample) thug.run_local(sample) records = [r.message for r in caplog.records] matches = 0 for e in expected: for record in records: if e in record: matches += 1 assert matches >= len(expected)
def do_perform_test(self, caplog, sample, expected): thug = ThugAPI() thug.set_useragent('linuxfirefox40') thug.set_events('click,storage') thug.disable_cert_logging() thug.log_init(sample) thug.run_local(sample) records = [r.message for r in caplog.records] matches = 0 for e in expected: for record in records: if e in record: matches += 1 assert matches >= len(expected)
def do_perform_test(self, caplog, sample, expected): thug = ThugAPI() thug.set_useragent('win7ie90') thug.set_events('click,storage') thug.set_features_logging() thug.set_connect_timeout(2) thug.log_init(sample) thug.run_local(sample) records = [r.message for r in caplog.records] matches = 0 for e in expected: for record in records: if e in record: matches += 1 assert matches >= len(expected)
def do_perform_test(self, caplog, sample, expected): thug = ThugAPI() thug.set_useragent('winxpie70') thug.set_events('click') thug.set_connect_timeout(2) thug.disable_cert_logging() thug.set_features_logging() thug.log_init(sample) thug.run_local(sample) records = [r.message for r in caplog.records] matches = 0 for e in expected: for record in records: if e in record: matches += 1 assert matches >= len(expected)
def do_perform_test(self, caplog, url, expected, type_ = "remote"): thug = ThugAPI() thug.set_useragent('win7ie90') thug.set_events('click,storage') thug.set_web_tracking() thug.disable_cert_logging() thug.set_features_logging() thug.log_init(url) m = getattr(thug, "run_{}".format(type_)) m(url) records = [r.message for r in caplog.records] matches = 0 for e in expected: for record in records: if e in record: matches += 1 assert matches >= len(expected)